RHEL5.4 +MYSQL5.1.36 +APACHE2.2.4 +PHP5.2.3

1.安裝MySQL //查看系統中是否已經安裝了MySQL,如果是卸載所有以mysql開頭的包。 # rpm -qa | grep mysql # rpm -e mysql-* # rm -f /etc/my.cnf groupadd mysql useradd mysql -c "start mysqld's account" -d /dev/null -g mysql -s /sbin/nologin cd /usr/local/src/ tar -xzvf mysql-5.1.36.tar.gz cd mysql-5.1.36 ./configure / --prefix=/usr/local/mysql / --with-mysqld-user=mysql / --without-debug / --with-client-ldflags=-all-static / --with-mysqld-ldflags=-all-static / --disable-shared / --localstatedir=/var/lib/mysql / --without-isam / --without-innodb / --enable-assembler make && make install cp support-files/my-medium.cnf /etc/my.cnf /usr/local/mysql/bin/mysql_install_db --user=mysql chown -R root:mysql /usr/local/mysql/ chown -R mysql:mysql /var/lib/mysql /usr/local/mysql/bin/mysqld_safe --user=mysql & 配置系統啓動時自動啓動MySQl cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysql cd /etc/init.d chmod 755 mysql chkconfig --add mysql chkconfig --level 3 mysql on cp /usr/local/mysql/bin/mysql /usr/bin mysql use mysql; UPDATE user SET Password=PASSWORD('ddl') WHERE user='root'; FLUSH PRIVILEGES; (2).安裝apache cd /usr/local/src tar -zxvf httpd-2.2.4.tar.gz cd httpd-2.2.4 ./configure --prefix=/usr/local/apache2 --enable-module=so --enable-rewrite make && make install 設置自啓動 cp support/apachectl /etc/init.d/httpd 修改/etc/init.d/httpd vi /etc/init.d/httpd(在第兩行之後添加如下內容) #!/bin/sh # # Startup script for the Apache Web Server # chkconfig: - 85 15 # description: Apache is a World Wide Web server. It is used to serve / # HTML files and CGI. # processname: httpd # pidfile: /usr/local/apache2/log/httpd.pid # config: /usr/local/apache2/conf/httpd.conf chkconfig --add httpd chmod 755 /etc/init.d/httpd chkconfig httpd on 啓動 /usr/local/apache2/bin/apachectl start 在RHEL5.4上報下面的錯是因爲開着selinux.關閉即可 [root@localhost bin]# ./apachectl start httpd: Syntax error on line 53 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/libphp5.so into server: /usr/local/apache2/modules/libphp5.so: cannot restore segment prot after reloc: Permission denied (3).安裝PHP 先安裝zlib,freetype,libpng,jpeg以便於讓PHP支持GD庫(Cacti的WeatherMap插件必須要較新GD庫的支持)庫文件下載地址:http://oss.oetiker.ch/rrdtool/pub/libs/ 1).安裝zlib cd /usr/local/src tar -xzvf zlib-1.2.3.tar.gz cd zlib-1.2.3 ./configure --prefix=/usr/local/zlib make && make install (2).安裝libpng cd /usr/local/src tar zxvf libpng-1.2.18.tar.gz cd libpng-1.2.18/scripts/ mv makefile.linux ../makefile cd .. make && make install 注意,這裏的makefile不是用./configure生成,而是直接從scripts/裏拷一個 3).安裝freetype cd /usr/local/src tar -xzvf freetype-2.3.4.tar.gz cd freetype-2.3.4 ./configure --prefix=/usr/local/freetype make && make install 4).安裝Jpeg cd /usr/local/src tar -zxvf jpegsrc.v6b.tar.gz cd jpeg-6b/ mkdir /usr/local/libjpeg mkdir /usr/local/libjpeg/include mkdir /usr/local/libjpeg/bin mkdir /usr/local/libjpeg/lib mkdir /usr/local/libjpeg/man mkdir /usr/local/libjpeg/man/man1 ./configure --prefix=/usr/local/libjpeg / --enable-shared / --enable-static make && make install 注意,這裏configure一定要帶--enable-shared參數,不然,不會生成共享庫 5)相關RPM包 [root@ddl htdocs]# rpm -qa | grep fontconf fontconfig-2.4.1-7.el5 fontconfig-devel-2.4.1-7.el5 [root@ddl htdocs]# rpm -qa | grep Xpm libXpm-devel-3.5.5-3 libXpm-3.5.5-3 6).安裝GD cd /usr/local/src tar -zxvf gd-2.0.34.tar.gz cd gd-2.0.34 ./configure --prefix=/usr/local/libgd / --with-png / --with-freetype=/usr/local/freetype / --with-jpeg=/usr/local/libjpeg / --enable-m4_pattern_allow make && make install 編譯時顯示以下信息: ** Configuration summary for gd 2.0.34: Support for PNG library: yes Support for JPEG library: yes Support for Freetype 2.x library: yes Support for Fontconfig library: yes Support for Xpm library: yes Support for pthreads: yes 7).編輯/etc/ld.so.conf,添加以下幾行到此文件中 /usr/local/zlib/lib /usr/local/freetype/lib /usr/local/libjpeg/lib /usr/local/libgd/lib 並執行ldconfig命令,使用動態裝入器裝載找到共享庫 8).安裝libxml cd /usr/local/src/ tar -xzvf libxml2-2.6.25.tar.gz cd libxml2-2.6.25 ./configure make && make install 9).安裝PHP cd /usr/local/src/ tar -zxvf php-5.2.3.tar.gz cd php-5.2.3 ./configure --prefix=/usr/local/php / --with-apxs2=/usr/local/apache2/bin/apxs / --with-mysql=/usr/local/mysql / --with-gd=/usr/local/libgd / --enable-gd-native-ttf / --with-ttf / --enable-ftp / --enable-gd-jis-conv / --with-freetype-dir=/usr/local/freetype / --with-jpeg-dir=/usr/local/libjpeg / --with-png-dir=/usr / --with-zlib-dir=/usr/local/zlib / --enable-xml / --enable-mbstring / --enable-sockets make && make install cp php.ini-dist /usr/local/php/lib/php.ini 修改apache配置文件httpd.conf vi /usr/local/apache2/conf/httpd.conf 添加以下內容 AddType application/x-httpd-php .php .phtml AddType application/x-httpd-php-source .phps AddType application/x-tar .tgz AddType image/x-icon .ico 修改DirectoryIndex 行,添加index.php 修改爲DirectoryIndex index.php index.html index.html.var cd /usr/local/apache2/htdocs/ touch info.php vi info.php 建立測試頁面:info.php,添加以下內容:

重啓動apache /usr/local/apache2/bin/apachectl stop /usr/local/apache2/bin/apachectl start 在瀏覽器中輸入:http://www.yourdomain.com/info.php進行測試。 對php編譯選項的解釋: --prefix=/usr/local/php //指定PHP的安裝目錄 --with-apxs2=/usr/local/apache2/bin/apxs //支持Apache模塊 --with-mysql=/usr/local/mysql //支持MySQl --with-gd=/usr/local/libgd //支持GD庫 --enable-gd-native-ttf //激活對本地 TrueType 字符串函數的支持 --with-ttf //激活對 FreeType 1.x 的支持 --enable-ftp //打開ftp的支持 --with-freetype-dir=/usr/local/freetype //激活對 FreeType 2.x 的支持 --with-jpeg-dir=/usr/local/libjpeg //激活對 jpeg-6b 的支持 --with-png-dir=/usr //激活對 png 的支持 --with-zlib-dir=/usr/local/zlib //激活對zlib 的支持 --enable-mbstring //激活mbstring模塊 --enable-gd-jis-conv //使JIS-mapped可用,支持日文字體 --with-mail //支持Mail函數 --enable-xml //支持XML --enable-sockets //支持套接字

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章