摘要:在環(huán)境下對(duì)于服務(wù)的安裝是必不可少的,在環(huán)境下安裝軟件也有兩種不同的方式,一種是安裝當(dāng)然了不同的發(fā)行版本使用略有不同,另一種是通過(guò)編譯安裝,編譯安裝要比安裝要可控此,但是要比安裝略微麻煩些我們下面這種方式就是通過(guò)編譯安裝的方式安裝服務(wù)器軟件,
在LAMP環(huán)境下對(duì)于服務(wù)的安裝是必不可少的,在linux環(huán)境下安裝軟件也有兩種不同的方式,一種是yum安裝當(dāng)然了不同的linux發(fā)行版本使用略有不同,另一種是通過(guò)編譯安裝,編譯安裝要比yum安裝要可控此,但是要比yum安裝略微麻煩些我們下面這種方式就是通過(guò)編譯安裝的方式安裝Apache2服務(wù)器軟件,如果你覺(jué)得麻煩可以使用類似的yum方式哦!
安裝軟件運(yùn)行基礎(chǔ) apr 下載地址下載地址
[root@localhost soft]# wget -i http://www-eu.apache.org/dist//apr/apr-1.6.3.tar.gz解壓編譯安裝
解壓
[root@localhost soft]# tar -zxf apr-1.6.3.tar.gz && apr-1.6.3
編譯
[root@localhost apr-1.6.3]# ./configure --prefix=/usr/local/apr
安裝
[root@localhost apr-1.6.3]# make && make installapr-util 下載地址
下載地址
[root@localhost soft]# wget -i http://www-eu.apache.org/dist//apr/apr-util-1.6.1.tar.gz解壓編譯安裝
解壓
[root@localhost soft]# tar -zxf apr-util-1.6.1.tar.gz && cd apr-util-1.6.1
編譯
[root@localhost apr-util-1.6.1]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
安裝
[root@localhost apr-util-1.6.1]# make && make installpcre 下載地址
下載地址
[root@localhost soft]# wget -i https://ftp.pcre.org/pub/pcre/pcre-8.41.tar.gz解壓編譯安裝
解壓
[root@localhost soft]# tar -zxf pcre-8.41.tar.gz && cd pcre-8.41
編譯
[root@localhost pcre-8.41]# ./configure --prefix=/usr/local/pcre
安裝
[root@localhost pcre-8.41]# make && make install安裝Apache2 下載地址
下載地址
[root@localhost soft]# wget -i http://www-us.apache.org/dist//httpd/httpd-2.4.29.tar.bz2解壓編譯安裝
解壓
[root@localhost soft]# tar -jxf httpd-2.4.29.tar.bz2 && cd httpd-2.4.29
編譯
[root@localhost httpd-2.4.29]# ./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre
安裝
[root@localhost httpd-2.4.29]# make && make install配置Apache2 修改配置文件
[root@localhost soft]# vim /usr/local/apache2/conf/httpd.conf
修改監(jiān)聽端口號(hào)
Listen 8088
修改 ServerName
ServerName www.apache-host.dev:8088
修改項(xiàng)目目錄
DocumentRoot "/www/apache-host"
修改項(xiàng)目目錄具體參數(shù)
設(shè)置Apache2為L(zhǎng)inux服務(wù)并實(shí)現(xiàn)開機(jī)自啟動(dòng)
添加Apache2配置文件 apachectl 到linux服務(wù)
拷貝文件并重命名
[root@localhost soft]# cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd
將系統(tǒng)配置目錄下的 httpd 添加到 系統(tǒng)服務(wù)
[root@localhost soft]# chkconfig --add httpd
設(shè)置系統(tǒng)服務(wù) httpd 為開機(jī)啟動(dòng)
[root@localhost soft]# chkconfig httpd on檢測(cè)系統(tǒng)服務(wù) httpd 是否啟動(dòng)成功
查看系統(tǒng)服務(wù)狀態(tài)
[root@localhost soft]# chkconfig --list | grep httpd
系統(tǒng)服務(wù)狀態(tài)詳情
Note: This output shows SysV services only and does not include native systemd services. SysV configuration data might be overridden by native systemd configuration. If you want to list systemd services use "systemctl list-unit-files". To see services enabled on particular target use "systemctl list-dependencies [target]". httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
可見服務(wù)已經(jīng)在 第2 到 第5 運(yùn)行等級(jí)打開, 說(shuō)明系統(tǒng)服務(wù) httpd 已正常開啟開機(jī)啟動(dòng)禁用系統(tǒng)服務(wù) httpd
禁用系統(tǒng)服務(wù)
[root@localhost soft]# chkconfig httpd off
禁用系統(tǒng)服務(wù)狀態(tài)
Note: This output shows SysV services only and does not include native systemd services. SysV configuration data might be overridden by native systemd configuration. If you want to list systemd services use "systemctl list-unit-files". To see services enabled on particular target use "systemctl list-dependencies [target]". httpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
可見服務(wù)已經(jīng)在 第1 到 第6 運(yùn)行等級(jí)關(guān)閉, 說(shuō)明系統(tǒng)服務(wù) httpd 已正常關(guān)閉開機(jī)啟動(dòng)功能開啟系統(tǒng)服務(wù)Apache2
[root@localhost soft]# systemctl start httpd.service查看系統(tǒng)服務(wù)運(yùn)行狀態(tài)
[root@localhost soft]# systemctl status httpd.service驗(yàn)證是否成功安裝Apache2 通過(guò)curl命令行檢測(cè)是否安裝成功
檢測(cè)
[root@localhost soft]# curl -I "http://127.0.0.1:8088"
結(jié)果
HTTP/1.1 200 OK Date: Sun, 31 Dec 2017 18:23:24 GMT Server: Apache/2.4.29 (Unix) Content-Type: text/html;charset=ISO-8859-1通過(guò)瀏覽器檢測(cè)是否安裝成功
文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。
轉(zhuǎn)載請(qǐng)注明本文地址:http://www.ezyhdfw.cn/yun/35899.html
摘要:這是我首次嘗試的經(jīng)驗(yàn)最小化安裝,走了很多坑,借此記錄一下,希望朋友們少走一些彎路我是通過(guò)下載源碼安裝的,所有的下載文件為壓縮包不同壓縮方式,解壓方式不同,我就下載同一種了一下載安裝包一次性把文件下載好,其中包括如果沒(méi)記錯(cuò)的話,這個(gè)不 這是我首次嘗試的經(jīng)驗(yàn)(Centos7最小化安裝),走了很多坑,借此記錄一下,希望朋友們少走一些彎路;我是通過(guò)下載源碼安裝的,所有的下載文件為*.tar.b...
摘要:這是我首次嘗試的經(jīng)驗(yàn)最小化安裝,走了很多坑,借此記錄一下,希望朋友們少走一些彎路我是通過(guò)下載源碼安裝的,所有的下載文件為壓縮包不同壓縮方式,解壓方式不同,我就下載同一種了一下載安裝包一次性把文件下載好,其中包括如果沒(méi)記錯(cuò)的話,這個(gè)不 這是我首次嘗試的經(jīng)驗(yàn)(Centos7最小化安裝),走了很多坑,借此記錄一下,希望朋友們少走一些彎路;我是通過(guò)下載源碼安裝的,所有的下載文件為*.tar.b...
閱讀 3389·2023-04-25 22:47
閱讀 3876·2021-10-11 10:59
閱讀 2366·2021-09-07 10:12
閱讀 4352·2021-08-11 11:15
閱讀 3492·2019-08-30 13:15
閱讀 1812·2019-08-30 13:00
閱讀 1029·2019-08-29 14:02
閱讀 1743·2019-08-26 13:57