LAMP安装全攻略
1、获取软件包
httpd-2.2.4.tar.gz
mysql-6.0.0-alpha.tar.gz
php-5.2.2.tar.gz
去相应的官方网站都可以下载到,把它们全部放到 /usr/local/src 下面.
2、安装 mysql
这三个软件包的安装应该没有先后顺序,但我还是习惯先安装mysql:
>tar -zxvf mysql-6.0.0-alpha.tar.gz >cd mysql-6.0.0-alpha >./configure --prefix=/usr/local/mysql >make >make install >cp support-files/my-medium.cnf /etc/my.cnf >cd
/usr/local/mysql >chown -R
mysql . >chgrp -R mysql . >bin/mysql_install_db --user=mysql >chown -R mysql var >bin/mysqld_safe --user=mysql &
|
到这里mysql就算安装并启动完毕了,但是还有一些工作也是必须要做的,比如设置root密码、让mysql开机自启动:
设置mysql的root密码:
>bin/mysqladmin
-u root password 新密码
|
设置mysql开机自启动:
>cp
/usr/local/src/mysql-6.0.0-alpha/support-files/mysql.server /etc/rc.d/init.d/mysql >chmod
+x /etc/rc.d/init.d/mysql >chkconfig
--add mysql
|
3、安装Apache
>tar
-zxvf httpd-2.2.4.tar.gz >cd
httpd-2.2.4 >./configure --prefix=/usr/local/apache --with-mysql=/usr/local/mysql --enable-module=so --enable-shared=max >make >make install
|
4、安装PHP
>tar
-zxvf php-5.2.2.tar.gz >cd
php-5.2.2 >./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-apxs2=/usr/local/apache/bin/apxs >make >make
install >cp php.ini-dist /usr/local/php/lib/php.ini >vi
/usr/local/php/lib/php.ini
修改 register_globals=On
|
5、配置httpd.conf
>vi
/usr/local/apache/conf/httpd.conf
找到"AddType application/x-gzip .tgz"(第294行),在它的下面添加 "AddType application/x-httpd-php .php"和"AddType
application/x-httpd-php-source .phps"
找到"DirectoryIndex
index.html " 在index.html
前添加 index.php
|
>vi
/usr/local/apache/htdocs/index.php
内容为:
<?php
phpinfo();
?>
>/usr/local/apache/bin/apachectl
-k start
阅读(1310) | 评论(0) | 转发(0) |