CentOS7.6手動編譯httpd-2.4.25

手動編譯httpd-2.4.25

系統:CentOS7.1810html

httpd:2.4.25nginx

編譯時報錯解決技巧:報什麼錯,就裝這個錯誤的devel,好比報http2錯誤,就yum search http2,找到libnghttp2-devel,而後yum install libnghttp2-devel再從新configureapache

# 配置EPEL源,有些包只有epel源有

[root@centos7 ~]# cat /etc/yum.repos.d/epel.repo 
[epel]
name=aliyun epel
baseurl=https://mirrors.aliyun.com/epel/7/x86_64/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/epel/RPM-GPG-KEY-EPEL-7
enabled=1

1、下載地址:

https://www.lanzous.com/i5csh0hvim

http://archive.apache.org/dist/httpd/httpd-2.4.25.tar.bz2centos

2、安裝依賴

[root@imooc-nginx ~]# yum install gcc openssl-devel pcre-devel apr-devel apr-util-devel libnghttp2-devel ncurses-devel

3、解壓

[root@imooc-nginx ~]# bzip2 -d httpd-2.4.25.tar.bz2 
[root@imooc-nginx ~]# tar xf httpd-2.4.25.tar

4、開始編譯

[root@imooc-nginx ~]# cd httpd-2.4.25/
[root@imooc-nginx httpd-2.4.25]# ./configure \
 --prefix=/apps/httpd24 \
 --sysconfdir=/etc/httpd \
 --enable-http2 \
 --disable-auth-basic \
 --enable-ssl \
 --enable-so

5、根據Makefile,構建應用程序

[root@imooc-nginx httpd-2.4.25]# make
# make -j 2   #能夠多線程編譯,根據CPU個數寫

6、make install

# 拷貝文件
[root@imooc-nginx httpd-2.4.25]# make install

7、啓動apache

能夠考慮加PATH變量或作軟連接多線程

[root@imooc-nginx httpd-2.4.25]# /apps/httpd24/bin/apachectl start
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::20c:29ff:fe4d:5986. Set the 'ServerName' directive globally to suppress this message

8、測試訪問

主頁內容:/apps/httpd24/htdocs/index.htmlapp

root@ubutnu:~# curl -q http://172.18.145.106
<html><body><h1>It works!</h1></body></html>

9、讓httpd開機自啓

[root@imooc-nginx httpd-2.4.25]# vim /etc/rc.d/rc.local 
[root@imooc-nginx httpd-2.4.25]# tail -1 /etc/rc.d/rc.local
/apps/httpd24/bin/apachectl start
[root@imooc-nginx httpd-2.4.25]# chmod +x /etc/rc.d/rc.local
相關文章
相關標籤/搜索