1, avoid port, program conflict, use RPM uninstall httpd
[Email protected]/]# rpm-qa httpd #检查httpd的包 [[email protected]/]# rpm-e httpd--nodeps #卸载
2. Source code compilation and installation
- Download HTTPD package, unzip
[Email protected]/]# wget http://mirror.bit.edu.cn/apache/httpd/httpd-2.2.31.tar.gz[[Email Protected]/]# tar zxf httpd-2.2. tar.gz-c/usr/src #解压到/usr//]# cd/usr/src/httpd-2.2. /
[Email protected] httpd-2.2. to]# ls INSTALL README #遇到不熟悉的软件是可参考这两个文件 [[email protected] httpd-2.2. to]# less readme[[email protected] httpd-2.2. to]# less INSTALL [[email protected] httpd-2.2. to]#./configure--Help #各种配置选项及含义 [[email protected] httpd-2.2. to]# Yum-y install gcc[[email protected] httpd-2.2. to]#./configure--prefix=/usr/local/httpd--enable-so--enable-rewrite--enable-charset-lite--enable-CGI--prefix #安装目录--enable-So #启用加载状态模块--enable-rewrite #启用网页地址重写功能--enable-charset-Lite #启用字符集支持--enable-CGI #启用CGI脚本程序支持 [[email protected] httpd-2.2. to]# echo $?0
- Compiling the installation
[Email protected] httpd-2.2. +] # made && make install # makes for compiling, making install [[email protected] httpd-2.2. ]# echo $? 0
3. Confirm the installation result
[Email protected] httpd-2.2. +] # ls/usr/local/httpd/bin cgi-bin error icons lib man modulesbuild Conf htdocs include logs manual
4. Optimize Execution path
[Email protected] httpd-2.2. +] # ln-s/usr/local/httpd/bin/* /usr/local/bin/[[email protected] httpd-2.2.31]# ls-l/usr/local/bin/ Httpd/usr/local/bin/apachectl lrwxrwxrwx. 1 root root 23:49/usr/local/bin/apachectl-/usr/local/httpd/bin/apachectllrwxrwxrwx. 1 root root 23:49/usr/local/bin/httpd Sep-/usr/local/httpd/bin/httpd
5. Add httpd system service
[Email protected] httpd-2.2. to]# cp/usr/local/httpd/bin/apachectl/etc/init.d/Httpd[[email protected] httpd-2.2. to]# vim/etc/init.d/httpd #!/bin/sh# chkconfig: * - +#3, starting in 5, starting off in the order of 85, +# Description:start Apache HTTP Server #服务描述 [[email protected] httpd-2.2. to]# Chkconfig--add httpd #添加系统服务ch [[email protected] httpd-2.2. to]# Chkconfig--list httpd #查看httpd服务的自启动状态httpd0: Off1: Off2: Off3: On4: Off5: On6: Off
6, configure httpd service, and start
[Email protected] httpd-2.2. to]# vim/usr/local/httpd/conf/httpd.confservername www.httpd.com[[email protected] httpd-2.2. to]#/usr/local/httpd/bin/apachectl-T #语法检查Syntax ok[[email protected] httpd-2.2. to]#/etc/init.d/httpd start[[email protected] httpd-2.2. to]# NETSTAT-ANPT |grep httpdtcp0 0::: the:::* LISTEN50141/httpd
7. Visit the Web site
[Email protected] httpd-2.2. +] # vim/etc/hosts192.168. 119.131 www.httpd.com[[email protected] httpd-2.2. ]# Curl www.httpd.com
8. View Web site access
Access log access_log error log error_log[[email protected] httpd-2.2. to]# tail/usr/local/httpd/logs/Access_log192.168.119.131- - [ -/sep/ .:xx: to: -+0800]"get/http/1.1" $ -[email protected] httpd-2.2. to]# Tail/usr/local/httpd/logs/error_log
centos-6.5 Installing Apache