安裝環境: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
# make
# make install
# /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# make# make install# 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)