1 将 httpd-2.4.25.tar.bz2下载 到 centos7的 /app目录下
[root@localhost app]# ls
httpd-2.4.25.tar.bz2
2 将该文件解压
[root@localhost app]# tar -xvf httpd-2.4.25.tar.bz2
[root@localhost app]# ls
httpd-2.4.25 httpd-2.4.25.tar.bz2
3 安装开发包组
[root@localhost httpd-2.4.25]# yum groupinstall “Development tools”
4
[root@localhost httpd-2.4.25]# ./configure –prefix=/app/httpd –sysconfdir=/etc/httpd/
5 报错, 根据提示还得装下面这些包
yum install apr-devel
yum install apr-util-devel
yum install pcre-devel
6
make
7
make install
8
[root@localhost bin]# cd /app/httpd/bin
9 开启服务器并启动端口
[root@localhost bin]# apachectl start
[root@localhost bin]# netstat -tnl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN
tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:6011 0.0.0.0:* LISTEN
tcp6 0 0 :::111 :::* LISTEN
tcp6 0 0 :::80 :::* LISTEN
tcp6 0 0 :::21 :::* LISTEN
tcp6 0 0 :::22 :::* LISTEN
tcp6 0 0 ::1:631 :::* LISTEN
tcp6 0 0 ::1:25 :::* LISTEN
tcp6 0 0 ::1:6010 :::* LISTEN
tcp6 0 0 ::1:6011 :::* LISTEN
10 查看本机IP地址
[root@localhost bin]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.130 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::f36e:9e00:5218:4cbb prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:1c:1c:10 txqueuelen 1000 (Ethernet)
RX packets 39129 bytes 44634625 (42.5 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 13242 bytes 2208017 (2.1 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1 (Local Loopback)
RX packets 28 bytes 2408 (2.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 28 bytes 2408 (2.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:a0:c6:47 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
11 在浏览器中输入 http://192.168.1.130/ 就可以看到 IT,s work 页面
12 如果 想不在 /app/httpd/bin 目录下就可以启动http服务器则需要 在/etc/profile.d/httpd.sh 文件中加入一行 PATH=$PATH:/app/httpd/bin
[root@localhost ~]# cd /etc/profile.d/
[root@localhost profile.d]# vim httpd.sh
#! /bin/bash
PATH=$PATH:/app/httpd/bin
[root@localhost profile.d]# cd /root
[root@localhost ~]# apachectl start
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN
tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:6011 0.0.0.0:* LISTEN
tcp6 0 0 :::111 :::* LISTEN
tcp6 0 0 :::80 :::* LISTEN
tcp6 0 0 :::21 :::* LISTEN
tcp6 0 0 :::22 :::* LISTEN
tcp6 0 0 ::1:631 :::* LISTEN
tcp6 0 0 ::1:25 :::* LISTEN
tcp6 0 0 ::1:6010 :::* LISTEN
tcp6 0 0 ::1:6011 :::* LISTEN
原创文章,作者:fsy,如若转载,请注明出处:http://www.178linux.com/74118
评论列表(1条)
对编译安装httpd进行了流程式的介绍,内容总结的很详细,需要注意排版。把执行的代码放入到”插入程序代码”中去