Centos7下安装httpd源码包

今天小编来跟大家做个练习,就是如何在Centos7下安装httpd源码包.

一:下载httpd最新版本的源码包

[root@localhost ~]# rpm -qa |grep httpd  //查询系统上是否已安装httpd包
httpd-tools-2.4.6-45.el7.centos.4.x86_64
httpd-2.4.6-45.el7.centos.4.x86_64
[root@localhost ~]# rpm -qai |grep httpd  //查询安装过的httpd包信息
Name        : httpd-tools
Source RPM  : httpd-2.4.6-45.el7.centos.4.src.rpm
URL         : http://httpd.apache.org/
The httpd-tools package contains tools which can be used with
Name        : httpd
Source RPM  : httpd-2.4.6-45.el7.centos.4.src.rpm
URL         : http://httpd.apache.org/  //小编这两步就是为了找出httpd包下载地址

二:解压源码包

[root@localhost /app]# ls  //小编把压缩包放到了/app下
httpd-2.4.27.tar.bz2
[root@localhost /app]# tar -jxf httpd-2.4.27.tar.bz2  //这里-j来解压后缀名为.tar.bz2的压缩包
[root@localhost /app]# ls
httpd-2.4.27  httpd-2.4.27.tar.bz2  //解压完成后出现http-2.4.27目录

三:安装包组Development Tools

[root@localhost /app]# yum groupinstall Development Tools

四:查看INSTALL或者READEME

[root@localhost /app]# cd httpd-2.4.27/  //进入到解压后的目录下
[root@localhost /app/httpd-2.4.27]# ls
ABOUT_APACHE     BuildBin.dsp    emacs-style     LAYOUT        NOTICE            srclib
acinclude.m4     buildconf       httpd.dep       libhttpd.dep  NWGNUmakefile     support
Apache-apr2.dsw  CHANGES         httpd.dsp       libhttpd.dsp  os                test
Apache.dsw       CMakeLists.txt  httpd.mak       libhttpd.mak  README            VERSIONING
apache_probes.d  config.layout   httpd.spec      LICENSE       README.cmake
ap.d             configure       include         Makefile.in   README.platforms
build            configure.in    INSTALL         Makefile.win  ROADMAP
BuildAll.dsp     docs            InstallBin.dsp  modules       server
[root@localhost /app/httpd-2.4.27]# less INSTALL  //下面小编截取部分内容

五:生成makefile文件

[root@localhost /app/httpd-2.4.27]# ./configure --prefix=/app/apache27 --sysconfdir=/etc/apache27   //这里configure是脚本文件,./configure执行它;照INSTALL里的说明,--prefix来指定安装路径于/app下,--sysconfdir来指定配置文件目录

六:编译并安装

[root@localhost /app/httpd-2.4.27]# make && make install

七:启动httpd服务

七:启动httpd服务
[root@localhost /app/apache27]# /app/apache27/bin/apachectl start 
[root@localhost /app/apache27]# systemctl status firewalld.service  //查看防火墙状态
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)
[root@localhost /app/apache27]# netstat -ntl  //查看网络监听情况
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     
tcp6       0      0 :::111                  :::*                    LISTEN     
tcp6       0      0 :::80                   :::*                    LISTEN     
tcp6       0      0 :::22                   :::*                    LISTEN     
tcp6       0      0 ::1:631                 :::*                    LISTEN     
tcp6       0      0 ::1:25                  :::*                    LISTEN  
[root@localhost /app/apache27]# ps -aux |grep httpd   //查看是否存在httpd服务            
root      60242  0.0  0.1  74784  2336 ?        Ss   15:57   0:00 /app/apache27/bin/httpd -k start
daemon    60243  0.0  0.2 365832  4276 ?        Sl   15:57   0:00 /app/apache27/bin/httpd -k start
daemon    60244  0.0  0.2 431368  4876 ?        Sl   15:57   0:00 /app/apache27/bin/httpd -k start
daemon    60245  0.0  0.2 365832  4276 ?        Sl   15:57   0:00 /app/apache27/bin/httpd -k start
daemon    60335  0.0  0.2 365832  4280 ?        Sl   15:57   0:00 /app/apache27/bin/httpd -k start
root      60364  0.0  0.0 112648   964 pts/0    R+   15:57   0:00 grep --color=auto httpd
[root@localhost /app/apache27]# ls
bin  build  cgi-bin  error  htdocs  icons  include  logs  man  manual  modules
[root@localhost /app/apache27]# cd htdocs/
[root@localhost /app/apache27/htdocs]# ls
index.html
[root@localhost /app/apache27/htdocs]# vim index.html

八:设置PATH及man路径

[root@localhost /app/apache27]# echo 'export PATH=$PATH:/app/apache27/bin/' > /etc/profile.d/apache27.sh
[root@localhost /app/apache27]# cat  /etc/profile.d/apache27.sh
export PATH=$PATH:/app/apache27/bin/
[root@localhost /app]# vim /etc/man_db.conf 

[root@localhost /app/apache27]# man apachectl

至此,Centos7下安装httpd源码包练习完成,请多多指教,小编在此等候大家的评论哦。

转载于:https://www.cnblogs.com/Qian-free/p/7624240.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值