安装环境: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)