确认源代码编译环境,需要支持C/C++程序语言的编译器,如:
gcc-4.4.7-4.el6 gcc-c++ -4.4.7-4.el6 make-3.8.1-20.el6
一、在服务器ftp://172.16.0.1中下载源代码
二、在Xhell中点,将httpd-2.2.17.tar移到Xshell中/root ,/, /usr/src
三、tar解包
[root@localhost ~]# tar -xf httpd-2.2.17.tar.gz -C /usr/src
[root@localhost ~]# ls /usr/src
httpd-2.2.17
tar命令中格式及-xf -C意思见下图详解
四、预配置
[root@localhost httpd-2.2.17]# cd /usr/src/httpd-2.2.17/
[root@localhost httpd-2.2.17]# ./configure --prefix=/usr/local/apache
–prefix=软件安装目录
五、编译—执行make 命令
[root@localhost httpd-2.2.17]# make
六、安装—执行make install 命令
[root@localhost httpd-2.2.17]# make install
七、编译安装步骤
(1)备份后,修改配置文件
[root@localhost httpd-2.2.17]# cd /usr/local/apache/conf/
[root@localhost conf]# cp httpd.conf httpd.conf.bak
[root@localhost conf]# vi /usr/local/apache/conf/httpd.conf
……
#ServerName www.example.com:80
ServerName www.example.com:80
……
cd—切换工作路径
cp—复制命令见下图详解
vi 文本编辑器—进入之后是命令模式,按o键进入输入模式修改,再按ESC键退回命令模式
(2)启动Apache
[root@localhost conf]# /usr/local/apache/bin/apachectl start
(3)运行 lynx 127.0.0.1
如果没有lynx ,gcc,gcc-c++,make软件包,需要创建yum仓库,快速安装包