(1)安裝mysql5.5.30 編譯參數: cd /tmp/mysql-5.5.30 cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ -DMYSQL_DATADIR=/data/dbdata \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_PARTITION_STORAGE_ENGINE=1 \ -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DMYSQL_UNIX_ADDR=/usr/local/mysql/tmp/mysql.sock \ -DMYSQL_TCP_PORT=3306 \ -DENABLED_LOCAL_INFILE=1 \ -DWITH_EXTRA_CHARSETS=all \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DWITH_SSL=yes make make install (2)配置DNS [root@nan88 ~]# yum list|grep bind [root@nan88 ~]# yum install bind-libs.x86_64 bind-utils.x86_64 bind-chroot.x86_64 bind.x86_64 [root@nan88 ~]# vim /etc/named.conf options { listen-on port 53 { any; }; listen-on-v6 port 53 { ::1; }; directory "/var/named"; dump-file "/var/named/data/cache_dump.db"; statistics-file "/var/named/data/named_stats.txt"; memstatistics-file "/var/named/data/named_mem_stats.txt"; allow-query { any; }; recursion yes; } zone "." IN { type hint; file "named.ca"; }; zone "cat.com" IN { type master; file "named.cat.com"; }; [root@nan88 ~]# vim /var/named/named.cat.com $TTL 600 @ IN SOA cat.com. root (2014030401 1H 15M 1W 1D); @ IN NS cat.com. cat.com. IN A 10.10.54.88 www.cat.com. IN A 10.10.54.88 bbs.cat.com. IN A 10.10.54.88 hr.cat.com. IN A 10.10.54.88 [root@nan88 ~]# /etc/init.d/named restart (3)安裝apache 安裝apache編譯版本 [root@nan88 softs]# tar xvf httpd-2.2.21.tar.gz [root@nan88 softs]# cd httpd-2.2.21 [root@nan88 httpd-2.2.21]# ./configure --prefix=/usr/local/apache --enable-modules=most --enable-mods-shared=all --enable-so --with-included-apr [root@nan88 httpd-2.2.21]# make [root@nan88 httpd-2.2.21]# make install //把apache的bin目錄加入到PATH變量中去,在文件加入一下面的行,這樣就能夠直接使用apachectl start/stop/restart [root@nan88 ~]# vim /etc/profile export PATH=$PATH:/usr/local/apache/bin [root@nan88 ~]# source /etc/profile //或者把/usr/local/apache/bin/apachectl啓動文件放到/etc/init.d下 [root@nan88 bin]# /etc/init.d/httpd restart (4)安裝編譯版本php [root@nan88 softs]# tar xvf php-5.4.25.tar.gz [root@nan88 softs]# cd php-5.4.25 ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --with-freetype-dir --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap --enable-session --with-gettext --with-mcrypt ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 出現錯誤: configure: error: mcrypt.h not found. Please reinstall libmcrypt. 解決方法: wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/attic/libmcrypt/libmcrypt-2.5.7.tar.gz 安裝: tar -zxvf libmcrypt-2.5.7.tar.gz cd libmcrypt-2.5.7 mkdir -p /usr/local/libmcrytp ./configure prefix=/usr/local/libmcrytp/ make make install ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 再編譯: ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --with-freetype-dir --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap --enable-session --with-gettext --with-mcrypt=/usr/local/libmcrypt --注意修改with-mcrypt=/usr/local/libmcrypt [root@nan88 php-5.4.25]# make [root@nan88 php-5.4.25]# make test [root@nan88 php-5.4.25]# make install @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 出現警告: ** WARNING! Backed up old pear to /usr/local/bin/pear_old The 'pear' command is now at your service at /usr/local/php/bin/pear ** The 'pear' command is not currently in your PATH, so you need to ** use '/usr/local/php/bin/pear' until you have added ** '/usr/local/php/bin' to your PATH environment variable. Run it without parameters to see the available actions, try 'pear list' to see what packages are installed, or 'pear help' for help. For more information about PEAR, see: http://pear.php.net/faq.php http://pear.php.net/manual/ Thanks for using go-pear! /softs/php-5.4.25/build/shtool install -c ext/phar/phar.phar /usr/local/php/bin ln -s -f /usr/local/php/bin/phar.phar /usr/local/php/bin/phar Installing PDO headers: /usr/local/php/include/php/ext/pdo/ 解決方法: [root@nan88 softs]# cp go-pear.php php-5.4.25/pear/install-pear @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ (5)編輯apache配置文件,最終整合apache+mysql+php環境 [root@nan88 ~]# vim /usr/local/apache/conf/httpd.conf LoadModule php5_module modules/libphp5.so --看到上面一句代表apache如今已經集成了對php的支持,不過目前,apache還不「認識」.php擴展名的文件,若是經過瀏覽器請求.php擴展名的文件,那麼apache會返回該文件的源代碼。解決方法是在Load php Module這一行的下面 <IfModule !mod_php5.c> LoadModule php5_module lib/modules/libphp5.so </IfModule> <IfModule mod_php5.c> AddType application/x-httpd-php .php --注意若是你的文件的擴展名是.php必定要加這句 AddType application/x-httpd-php .php5 --同上,若是你的文件擴展名是.php5必定要加這句 AddType application/x-httpd-php-source .phps AddType application/x-httpd-php-source .php5s DirectoryIndex index.php DirectoryIndex index.php5 </IfModule> (6)測試 [root@nan88 htdocs]# pwd /usr/local/apache/htdocs [root@nan88 htdocs]# vim index.php <?php phpinfo(); ?> [root@nan88 htdocs]# /etc/init.d/httpd restart 客戶端配置: #vim /etc/resolv.conf nameserver 10.10.54.88 在客戶端瀏覽器裏輸入「http://www.cat.com/」 --DNS配置的域名 (7)建立論壇 [root@nan88 softs]# mv Discuz_X3.0_SC_UTF8.zip /usr/local/apache/bbs/ [root@nan88 bbs]# yum install unzip.x86_64 [root@nan88 bbs]# unzip Discuz_X3.0_SC_UTF8.zip [root@nan88 readme]# /etc/init.d/httpd restart [root@nan88 apache]# chown daemon.daemon bbs -R 測試: 在瀏覽器中輸入:http://bbs.cat.com/upload/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 出現錯誤: Forbidden You don't have permission to access /upload on this server. 解決方法: [root@nan88 apache]# vim /usr/local/apache/conf/httpd.conf <Directory /> Options FollowSymLinks AllowOverride None Order deny,allow allow from all </Directory> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 再進行測試。