借鉴前辈的经验加上在网上找资料整合而成。
环境:本文中的Linux操作系统为CentOS 5.3,Linux 2.6.18 内核 ,Apache安装及基本配置过程记录下来以供参考:
一. Apache Web服务器的源代码安装,Tarball安装方式:
1. 源码包:httpd-2.2.6.tar.gz 从 www.apache.org 下载到此目录下:/usr/local/src 同时在 /usr/local/webserver下创建一个httpd目录:mkdir httpd
2. 解压安装包:tar -zxvf httpd-2.2.6.tar.gz
3. 进入解压后的安装包:cd httpd-2.2.6
4. 配置:./configure --prefix=/usr/local/webserver/httpd --enable-cgi ( 意义支持CGI)
5. 编译:make
6. 安装:make install
本文来自优快云博客http://blog.youkuaiyun.com/orzorz/archive/2010/03/07/5353213.aspx
7.启动web服务:
/usr/local/webserver/httpd/binapachectl start这样web服务就启动了。service httpd start暂时不能启动,因为还没有做相关配置
8.添加为系统服务
cp /usr/local/webserver/httpd/binapachectl /usr/local/bin/httpd
cp /usr/local/webserver/httpd/binapachectl /usr/local/bin/httpd
cp /usr/local/webserver/httpd/binapachectl /etc/init.d/httpd
ln -s /etc/init.d/httpd /etc/rc.d/rc3.d/S61httpd
ln -s /etc/init.d/httpd /etc/rc.d/rc4.d/S61httpd
ln -s /etc/init.d/httpd /etc/rc.d/rc5.d/S61httpd
vi /etc/init.d/httpd
把着两行添加进去
#chkconfig:345 61 61
#description:Apache
保存!
这样就把httpd添加为系统服务了
查看是否存在
chkconfig --list|grep httpd
添加
chkconfig --add httpd
添加开机启动级别
chkconfig --levels 345 httpd on
最后大功告成!
可以通过service httpd start|stop|restart启动 停止 重启服务。不过没有提示信息。如果需要提示信息还要编写相应的脚本。。。