CentOS 6.5上編譯安裝Apache服務(wù)器的方法(最小化安裝)
inux系統(tǒng):CentOS 6.5 mini版,如果是VMware虛擬機(jī),網(wǎng)卡要求“橋接”
1、編譯安裝前首先yum 安裝“開(kāi)發(fā)環(huán)境”“兼容庫(kù)”“中文支持”即執(zhí)行如下命令
#yum groupinstall "Development tools" "Compatibility libraries" "Chinese Support [zh]" -y
安裝man, vim, wget 工具
#yum install man vim wget -y
2、因?yàn)檫@次要編譯安裝httpd2.4.25,此版本需要更高版本的apr和apr-util。
因此要首先編譯安裝apr和apr-util。
wget http://mirrors.hust.edu.cn/apache/apr/apr-1.5.2.tar.bz2
wget http://mirrors.hust.edu.cn/apache/apr/apr-util-1.5.4.tar.bz2
2.1編譯安裝apr
tar xf apr-1.5.2.tar.bz2 cd apr-1.5.2 ./configure --prefix=/usr/local/apr echo $? ###如果執(zhí)行結(jié)果是0,則繼續(xù)執(zhí)行make && make install
2.2編譯安裝apr-util
tar xf apr-util-1.5.4.tar.bz2 cd apr-util-1.5.4 ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr echo $? ###如果執(zhí)行結(jié)果是0,則繼續(xù)執(zhí)行make && make install
3、重量級(jí)選手出廠了,正式開(kāi)始編譯httpd-2.4.25
wget http://mirrors.hust.edu.cn/apache/httpd/httpd-2.4.25.tar.bz2
多次編譯經(jīng)驗(yàn)得知,缺少pcre相關(guān)文件,openssl is too old
執(zhí)行如下命令:
yum install pcre-devel openssl openssl-devel -y tar xf httpd-2.4.25 cd httpd-2.4.25 ./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/
有如上提示則繼續(xù)執(zhí)行:make && make install
再執(zhí)行echo$?如果結(jié)果是0,則說(shuō)明httpd2.4.25到此編譯成功,然后進(jìn)行簡(jiǎn)單的配置,就可以使用了
4、配置httpd
關(guān)閉linux防火墻
service httpd stop
關(guān)閉SELinux
setenforce 0
復(fù)制啟動(dòng)文件
cp /usr/local/apache/bin/apachectl /etc/init.d/httpd
把httpd的環(huán)境變量添加到“環(huán)境變量”
echo 'export PATH=$PATH:/usr/local/apache/bin' > /etc/profile.d/httpd.sh
chmod +x /etc/profile.d/httpd.sh
source /etc/profile.d/httpd.sh
編輯httpd的配置文件:
vim /etc/httpd/httpd.conf
在ServerRoot下一行,添加 ServerName localhost
如果想把Apache服務(wù)加入到開(kāi)機(jī)啟動(dòng),可以修改服務(wù)啟動(dòng)腳本:
vim /etc/init.d/httpd
在第二行下添加:# chkconfig:235 85 15
# description: This is apache server
保存退出
執(zhí)行命令service httpd start #提示lynx找不到???那就yum install lynx -y
執(zhí)行命令netstat -ntlp #查看httpd是否啟動(dòng),是否有80端口
最后在你的瀏覽器輸入虛擬機(jī)IP地址
It works!
則Apache,安裝成功
1、編譯安裝--默認(rèn)的index.html首頁(yè)在/usr/local/apache/htdocs
2、配置文件:/etc/httpd/httpd.conf
3、啟動(dòng)腳本:/etc/init.d/httpd
4、cgi-bin文件目錄:/etc/local/apache/cgi-bin
相關(guān)文章
ubuntu開(kāi)機(jī)后使用使用終端運(yùn)行應(yīng)用程序的設(shè)置方法
這篇文章主要給大家介紹了關(guān)于ubuntu開(kāi)機(jī)后使用使用終端運(yùn)行應(yīng)用程序的設(shè)置方法,文中通過(guò)圖文介紹的非常詳細(xì),對(duì)大家學(xué)習(xí)或者使用Mubuntu具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2019-09-09Linux系統(tǒng)利用cp命令實(shí)現(xiàn)強(qiáng)制覆蓋功能的方法
cp命令是我日常學(xué)習(xí)中經(jīng)常會(huì)遇到的一個(gè)命令,下面這篇文章主要給大家介紹了關(guān)于Linux系統(tǒng)利用cp命令實(shí)現(xiàn)強(qiáng)制覆蓋功能的方法,并且給大家簡(jiǎn)單的介紹了cp命令的基礎(chǔ)知識(shí),需要的朋友可以參考借鑒,下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧。2017-11-11Linxu下性能指標(biāo)采集工具之nmon工具的使用
Linux下查看CPU信息一般采用top命令來(lái)實(shí)時(shí)觀察,但是這種對(duì)于只是通過(guò)觀察數(shù)據(jù)的變化來(lái)評(píng)估cpu的實(shí)時(shí)情況顯然不太科學(xué)。如果想要通過(guò)圖標(biāo)的形式來(lái)表現(xiàn)則需要借助一些外部工具,今天就來(lái)講解一下nmon工具的使用2023-04-04linux下怎樣用命令啟動(dòng)docker服務(wù)
這篇文章主要介紹了linux下怎樣用命令啟動(dòng)docker服務(wù)問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-04-04Linux在批量服務(wù)器管理中實(shí)用的PS1命令提示符格式實(shí)現(xiàn)方法
PS1是神馬?PS1是linux里頭的一個(gè)默認(rèn)的環(huán)境變量,至于當(dāng)前系統(tǒng)的PS1是如何設(shè)置的,你可以使用命令“env|grep PS1”來(lái)查看2015-09-09