日期:2014-05-16  浏览次数:20748 次

在linux上面LAMP安装

1. Apache安装

1. download httpd 2.2.16

# mkdir -p /usr/local/apache2
生成/usr/local/apache2目录

2. ./configure \
??? --prefix=/usr/local/apache2 \
??? --enable-so \
??? --enable-mods-shared=all \
??? --with-included-apr \
??? --enable-proxy=shared \
??? --enable-cache=shared \
??? --enable-file-cache=shared \
??? --enable-disk-cache=shared \
??? --enable-mem-cache=shared

?

if compile error show zlib not found, then use command check:

rpm -qa | grep -i zlib

if zlib is already installed, zlib-devel is needed to be installed:

yum install zlib-devel

?

we can use ./configure -help | grep mpm to see module options. After installation, we can use httpd -l? to see compiled modules.


??? make
??? make install

?

# vi /usr/local/apache2/conf/httpd.conf
设置DocumentRoot 的路径
保存退出,现在就这么简单配置apache。

# /usr/local/apache2/bin/apachectl -k start
启动apahce
用浏览器查看 (这里写你自己网站,如http://localhost/ ),得到It works,说明apache已经配置成功了。

# /usr/local/apache2/bin/apachectl -k stop
停止apache
# /usr/local/apache/bin/apachectl restart
重启Apache

?
把httpd 添加到系统的启动项里
# cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd
# chmod 700 /etc/rc.d/init.d/httpd
# vi /etc/rc.d/init.d/httpd
在第三行后增加
# Comments to support chkconfig on RedHat Linux
# chkconfig: 2345 90 90
# description:http server
注意:没有这几行,在使用chkconfig时会提示你:service httpd does not support chkconfig。
chkconfig –add httpd
chkconfig –level 345 httpd on
这样,在运行级别345上httpd就可以自动启动了。
?
二,Mysql的安装
?
# cd /root
# tar -zvxf? mysql-5.1.32-linux-i686-glibc23.tar.gz
# mkdir -p /usr/local/mysql (省略也可)
# cp -r? mysql-5.1.32-linux-i686-glibc2