安裝環境:VMware Workstation 5.5.0 build-18463
Linux版本:Red Hat Enterprise Linux AS (2.6.9-42.EL)
軟體版本:MySQL5 - mysql-5.0.37.tar.gz
Apache2 - httpd-2.2.4.tar.gz
PHP5 - php-5.2.1.tar.gz
(将以上檔案儲存至/home/tmp目錄)
[MySQL]
# cd /home/tmp (進入壓縮包所在目錄)
# groupadd mysql (建立mysql組)
# useradd -g mysql mysql (在mysql組中建立mysql使用者)
# tar -zxvf mysql-5.0.37.tar.gz (解壓mysql源碼,bz2壓縮包請用“tar -jvxf 檔案名”指令)
# cd mysql-5.0.37 (進入解壓目錄)
# ./configure --prefix=/usr/local/mysql (prefix參數指明mysql安裝目錄)
# make
# make install
# /usr/local/mysql/bin/mysql_install_db --user=mysql
# cp support-files/my-medium.cnf /etc/my.cnf (複制mysql配置文檔到/etc目錄)
# cp support-files/mysql.server /etc/rc.d/init.d/mysqld
# chmod 700 /etc/rc.d/init.d/mysqld
# chkconfig --add mysqld
# cd /usr/local/mysql (進入mysql安裝目錄)
# chown -R root . (不要漏了後面的“.”)
# chown -R mysql var
# chgrp -R mysql . (不要漏了後面的“.”)
# /usr/local/mysql/bin/mysqld_safe --user=mysql & (啟動mysql,出現mysqld ended時點選回車,回到指令行)
# bin/mysql -u root -p (登陸mysql,目前密碼為空)
mysql> selcet version(); (檢視mysql的版本号)
mysql> quit; (退出mysql)
[Apache]
# cd /home/tmp
# tar -zxvf httpd-2.2.4.tar.gz
# cd httpd-2.2.4
# ./configure --prefix=/server/apache --enable-so
# /usr/local/apache/bin/apachectl start (啟動apache)
[PHP]
# cd /usr/down
# tar -zxvf php-5.2.1.tar.gz
# cd php-5.2.1
# ./configure --prefix=/server/php --with-mysql=/server/mysql --with-apxs2=/server/apache/bin/apxs
# cp php.ini-dist /usr/local/lib/php.ini
# vi /usr/local/apache/conf/httpd.conf
(AddType application/x-tar .tgz下加一行
AddType application/x-httpd-php .php)