APACHE源碼安裝

安裝環(huán)境:Centos7.6

? 下載鏈接沒用了都,自己找吧,實(shí)在不行,直接最新版,不過網(wǎng)卡配置有點(diǎn)煩,搞8版本的話

? http://centos.hbcse.tifr.res.in/centos/7.6.1810/isos/x86_64/?? //找到一個(gè)能用的(補(bǔ)上)

一、卸載已經(jīng)安裝的httpd服務(wù)(新機(jī)器可無視)

????????? rpm -e httpd --nodeps

二、下載安裝包,需要Linux上網(wǎng),當(dāng)然也可以先在官網(wǎng)下載Apache的Linux版本,在傳到Linux系統(tǒng)中

????? httpd-2.4.43.tar.bz2 我是去Apache官網(wǎng)找的,鏈接都炸掉了,很煩

????? yum install wget -y? //安裝下載工具

?????? yum -y install gcc gcc++ zlib zlib-devel pcre-devel binutils glibc openssl-devel?

???????? //搞得有點(diǎn)多,以后基本編譯啥都不用安環(huán)境了

????? 下載一下依賴包,啥?你說依賴包干啥的,好像是移植不同系統(tǒng)用的,這不是重點(diǎn)啦

????? wget https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-1.6.5.tar.gz

? ? ? wget https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-util-1.6.1.tar.gz

???????? tar zxvf httpd-2.4.43.tar.bz2 -C /opt/?????? //習(xí)慣解壓到/opt下面

???????? tar xf apr-1.6.5.tar.gz -C /opt/

???????? tar xf apr-util-1.6.1.tar.gz -C /opt/

三、編譯,安裝

????? cd /opt/

?????? mv apr-1.6.5/ httpd-2.4.43/srclib/apr

? ? ?? mv apr-util-1.6.1/ httpd-2.4.43/srclib/apr-util

??????? cd httpd-2.4.43/

???????? ./configure \??????????????????? //預(yù)編譯一下

??????? ? ? --prefix=/usr/local/httpd \

??????? ?? --enable-so \

??????????? --enable-rewrite \

???????? ?? --enable-charset-lite \

??????????? --enable-cgi

???????? make && make install??? //編譯+安裝

四、修改主配置文件,并加入systemctl管理

cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd

vi /etc/init.d/httpd

# chkconfig: 35 85 21? ? ? ? ?//第2,3行加入

# description: Apache is a World Wide Web server

chkconfig --add /etc/init.d/httpd

??? systemctl start httpd??? //可以通過你的web瀏覽器進(jìn)行訪問啦

? ? systemctl status httpd? //查看httpd服務(wù)的狀態(tài)

? ? systemctl stop httpd? ?//關(guān)閉httpd服務(wù)

? ? systemctl? restart httpd? //重啟httpd服務(wù)

可以直接在瀏覽器訪問IP,獲取apache服務(wù)頁面,如果要修改,可以在/usr/local/httpd/htdocs/下修改

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容