溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

CentOS 7上安裝源碼Apache包并啟用該服務,含解決

發(fā)布時間:2020-07-06 22:12:04 來源:網(wǎng)絡 閱讀:726 作者:xiaoluogoal 欄目:系統(tǒng)運維

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 如何在CentOS 7上安裝源碼Apache包并啟用該服務


? ? ? ?第1步:先從Apache官網(wǎng)下載最新的Apache包,然后通過WinSCP上傳到遠程的Centos 7上

并掛載VMware的 iso?CentOS 7鏡像后部署好本地的yum源-----

使VMware 12中的DVD自動掛載,添加如下語句到/etc/fstab

[root@Franklin13 ~]# cat /etc/fstab|grep cdrom

/dev/cdrom /media/cdrom auto defaults 0 0


CentOS 7上安裝源碼Apache包并啟用該服務,含解決

CentOS 7上安裝源碼Apache包并啟用該服務,含解決


CentOS 7上安裝源碼Apache包并啟用該服務,含解決


CentOS 7上安裝源碼Apache包并啟用該服務,含解決


CentOS 7上安裝源碼Apache包并啟用該服務,含解決


--------編譯安裝過程如下 -------------

? ? ?第2步:?查看源碼包里的INSTALL或readme文件并用yum命令查看Development Tools組合包是否已安裝

(因./configure編譯時要調用?Development Tools安裝后的某個軟件,比如GCC )


[root@Franklin13 httpd-2.4.41]# ls -l|grep IN*

-rw-r--r--.? 1 root dip? ? 3782 May 18? 2016 INSTALL

CentOS 7上安裝源碼Apache包并啟用該服務,含解決


有時,yum groupinstall "Development tools"會出現(xiàn)如下報錯,且用yum clean all; yum makecache后仍舊出現(xiàn)這種報錯

經Google后發(fā)現(xiàn)需要用如下方式安裝才能進行:

yum groupinstall "Development Tools" --setopt=group_package_types=mandatory,default,optional


這種情況的原因很多,見如下網(wǎng)址

?https://access.redhat.com/solutions/1310043


CentOS 7上安裝源碼Apache包并啟用該服務,含解決


第3步:進入解壓后的httpd目錄中,運行編譯的3部曲 ./configure --prefix=...&make&make install:

但有時會出現(xiàn)報錯,比如我遇到的 “?checking for APR... no ”


[root@Franklin13 httpd-2.4.41]# ./configure --prefix=/usr/local/apache2.4.41 --sysconfdir=/etc/httpd2

checking for chosen layout... Apache

checking for working mkdir -p... yes

checking for grep that handles long lines and -e... /usr/bin/grep

checking for egrep... /usr/bin/grep -E

checking build system type... x86_64-pc-linux-gnu

checking host system type... x86_64-pc-linux-gnu

checking target system type... x86_64-pc-linux-gnu

configure:?

configure: Configuring Apache Portable Runtime library...

configure:?

checking for APR... no

CentOS 7上安裝源碼Apache包并啟用該服務,含解決


經百度后發(fā)現(xiàn)是如下原因:?

參考文章----?https://www.cnblogs.com/yewandemty/p/5396338.html

? ? ? 先將這些模塊(apr和apr-util?安裝,再進行httpd的安裝 )

Apr的下載網(wǎng)址:?http://archive.apache.org/dist/

Apr-util的下載:?http://archive.apache.org/dist/apr/

(注意:要先安裝 apr,再安裝?apr-uti,且安裝apr-uti時要添加??--with-apr=后面跟之前編譯apr的安裝路徑 )


下圖為如何右擊來下載?apr-util模塊

CentOS 7上安裝源碼Apache包并啟用該服務,含解決


然后再編譯安裝 httpd時必須添加如下兩個 with參數(shù),也是醉了:

[root@Franklin13 httpd-2.4.41]# ./configure --prefix=/usr/local/apache2.4.41 --sysconfdir=/etc/httpd2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util

[root@Franklin13 httpd-2.4.41]#

但出現(xiàn)了如下新的報錯 “?pcre-config for libpcre not found"

故不得不下載 pcre模塊,然后編譯安裝


CentOS 7上安裝源碼Apache包并啟用該服務,含解決


CentOS 7上安裝源碼Apache包并啟用該服務,含解決



CentOS 7上安裝源碼Apache包并啟用該服務,含解決

之后,httpd源碼包才能安裝成功

[root@Franklin13 httpd-2.4.41]# history 5

502 ?./configure --prefix=/usr/local/apache2.4.41 --sysconfdir=/etc/httpd2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre

503 ?make

504 ?history 5

505 ?make install

506 ?history 5

CentOS 7上安裝源碼Apache包并啟用該服務,含解決

安裝成功后到安裝路徑目錄下 /bin下運行 apachectl start即可

[root@Franklin13 bin]# pwd

/usr/local/apache2.4.41/bin

[root@Franklin13 bin]# apachectl start

[root@Franklin13 bin]#?

[root@Franklin13 bin]# netstat -tan|grep 80

tcp6? ? ? ?0? ? ? 0 :::80? ? ? ? ? ? ? ? ? ?:::*? ? ? ? ? ? ? ? ? ? LISTEN? ? ?

[root@Franklin13 bin]#?

[root@Franklin13 bin]#?

[root@Franklin13 bin]# ps -ef|grep httpd

root? ? ? 59193? ? ? 1? 0 16:27 ?? ? ? ? 00:00:01 /usr/sbin/httpd -DFOREGROUND

apache? ? 59199? 59193? 0 16:27 ?? ? ? ? 00:00:00 /usr/sbin/httpd -DFOREGROUND

apache? ? 59201? 59193? 0 16:27 ?? ? ? ? 00:00:00 /usr/sbin/httpd -DFOREGROUND

apache? ? 59203? 59193? 0 16:27 ?? ? ? ? 00:00:00 /usr/sbin/httpd -DFOREGROUND

apache? ? 59204? 59193? 0 16:27 ?? ? ? ? 00:00:00 /usr/sbin/httpd -DFOREGROUND

apache? ? 59205? 59193? 0 16:27 ?? ? ? ? 00:00:00 /usr/sbin/httpd -DFOREGROUND

root? ? ? 63802? 19545? 0 17:46 pts/5? ? 00:00:00 grep --color=auto httpd

[root@Franklin13 bin]#?


--------------------? ?全文完 ----------------------------------------------------------



向AI問一下細節(jié)

免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經查實,將立刻刪除涉嫌侵權內容。

AI