當前位置:首頁 » 編程軟體 » centos編譯安裝apache

centos編譯安裝apache

發布時間: 2022-09-27 23:04:23

Ⅰ Centos 下Apache(httpd) 安裝過程

其實,網上這塊的部署文章非常多 。隨便搜索,都有 。

這篇文章,老徐幫大家挑選幾個比較重點的過程 & 命令 。

1. 有些 linux 版本中已經預置了有Apache,並且已經是服務了,所有首先檢查系統中是否已經存在httpd的服務

1)先檢查 伺服器 上是否已經啟動了此服務 。

命令如下

ps -ef|grep httpd

2)查看linux系統服務中有沒有httpd

chkconfig --list | grep httpd

3)如果有服務存在,那麼需要先關閉httpd服務自啟動
命令 chkconfig httpd off

4)停止httpd服務
命令 service httpd stop

5)再次查看,是否有進程存在
命令 ps -ef|grep httpd

6)如果有進程存在,關閉進程
命令 kill -9 pid

1)先檢查 安裝包 的名字

命令 rpm -qa|grep httpd

<pre style="box-sizing: border-box; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 12px; white-space: pre-wrap; display: block; padding: 9.5px; margin: 0px 0px 10px; line-height: 1.38462; color: rgb(51, 51, 51); word-break: break-all; overflow-wrap: break-word; background-color: rgb(245, 245, 245); border: 1px solid rgb(204, 204, 204); border-radius: 4px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">[root@istester]~# rpm -qa|grep httpd
httpd-2.2.15-69.el6.centos.x86_64
httpd-tools-2.2.15-69.el6.centos.x86_64</pre>

2)根據安裝包名字刪除包

rpm -e httpd-tools-2.2.15-69.el6.centos.x86_64

rpm -e httpd-2.2.15-69.el6.centos.x86_64

3)刪除httpd.conf文件

<pre class="prettyprint" style="box-sizing: border-box; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 12px; white-space: pre-wrap; display: block; padding: 9.5px; margin: 0px 0px 10px; line-height: 1.38462; color: rgb(51, 51, 51); word-break: break-all; overflow-wrap: break-word; background-color: rgb(245, 245, 245); border: 1px solid rgb(204, 204, 204); border-radius: 4px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">#先檢查文件在哪
find / -name httpd.conf

rm /xxx/xxx/httpd.conf</pre>

3. 准備事項已完成,剩下的就是常規安裝了 。

註:我們通過yum的方式,在線安裝,非常簡單 。

1)檢查是否存在httpd包

<pre style="box-sizing: border-box; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 12px; white-space: pre-wrap; display: block; padding: 9.5px; margin: 0px 0px 10px; line-height: 1.38462; color: rgb(51, 51, 51); word-break: break-all; overflow-wrap: break-word; background-color: rgb(245, 245, 245); border: 1px solid rgb(204, 204, 204); border-radius: 4px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">[www@istester ~]$ yum list httpd
Loaded plugins: security
base | 3.7 kB 00:00
epel | 4.7 kB 00:00
epel/primary_db | 6.0 MB 00:00
extras | 3.4 kB 00:00
extras/primary_db | 28 kB 00:00
updates | 3.4 kB 00:00
updates/primary_db | 3.2 MB 00:00
Available Packages
httpd.x86_64 2.2.15-69.el6.centos base</pre>

2、安裝Apache
yum install httpd

<pre style="box-sizing: border-box; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 12px; white-space: pre-wrap; display: block; padding: 9.5px; margin: 0px 0px 10px; line-height: 1.38462; color: rgb(51, 51, 51); word-break: break-all; overflow-wrap: break-word; background-color: rgb(245, 245, 245); border: 1px solid rgb(204, 204, 204); border-radius: 4px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">Total 20 MB/s | 932 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : apr-util-ldap-1.3.9-3.el6_0.1.x86_64 1/4
Updating : httpd-tools-2.2.15-69.el6.centos.x86_64 2/4
Installing : httpd-2.2.15-69.el6.centos.x86_64 3/4
Cleanup : httpd-tools-2.2.15-53.el6.centos.x86_64 4/4
Verifying : httpd-tools-2.2.15-69.el6.centos.x86_64 1/4
Verifying : httpd-2.2.15-69.el6.centos.x86_64 2/4
Verifying : apr-util-ldap-1.3.9-3.el6_0.1.x86_64 3/4
Verifying : httpd-tools-2.2.15-53.el6.centos.x86_64 4/4

Installed:
httpd.x86_64 0:2.2.15-69.el6.centos

Dependency Installed:
apr-util-ldap.x86_64 0:1.3.9-3.el6_0.1

Dependency Updated:
httpd-tools.x86_64 0:2.2.15-69.el6.centos

Complete!</pre>

安裝過程,不用理會,如果看到如上提示,說明安裝成功了。

3、設置Apache服務的啟動級別
chkconfig --levels 235 httpd on
Apache是一個服務,所以,可以通過設置服務的啟動級別來讓它啟動。

4、啟動服務

兩種方式,

1)如下 /etc/init.d/httpd start

2)如下

service httpd start

5、查看服務是否正常啟動

兩種方式,

1)查看服務狀態

<pre style="box-sizing: border-box; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 12px; white-space: pre-wrap; display: block; padding: 9.5px; margin: 0px 0px 10px; line-height: 1.38462; color: rgb(51, 51, 51); word-break: break-all; overflow-wrap: break-word; background-color: rgb(245, 245, 245); border: 1px solid rgb(204, 204, 204); border-radius: 4px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">[root@istester www]# service httpd status
httpd (pid 10339) is running...</pre>

2)查看進程

<pre style="box-sizing: border-box; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 12px; white-space: pre-wrap; display: block; padding: 9.5px; margin: 0px 0px 10px; line-height: 1.38462; color: rgb(51, 51, 51); word-break: break-all; overflow-wrap: break-word; background-color: rgb(245, 245, 245); border: 1px solid rgb(204, 204, 204); border-radius: 4px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">[root@istester www]# ps -ef|grep httpd | grep -v grep
root 10339 1 0 23:15 ? 00:00:00 /usr/sbin/httpd
apache 10341 10339 0 23:15 ? 00:00:00 /usr/sbin/httpd
apache 10342 10339 0 23:15 ? 00:00:00 /usr/sbin/httpd
apache 10343 10339 0 23:15 ? 00:00:00 /usr/sbin/httpd
apache 10344 10339 0 23:15 ? 00:00:00 /usr/sbin/httpd
apache 10345 10339 0 23:15 ? 00:00:00 /usr/sbin/httpd
apache 10346 10339 0 23:15 ? 00:00:00 /usr/sbin/httpd
apache 10347 10339 0 23:15 ? 00:00:00 /usr/sbin/httpd
apache 10348 10339 0 23:15 ? 00:00:00 /usr/sbin/httpd</pre>

補充,

1)停止服務

service httpd stop

2)重啟服務

service httpd restart

6、安裝之後的說明:

1)驗證是否安裝成功
現在打開 http://ip 地址,看看有沒有Apache的默認頁面出來了?如果有就對了。

2)安裝目錄說明
Apache默認將網站的根目錄指向 /var/www/html
默認的主配置文件是 /etc/httpd/conf/httpd.conf
配置存儲在的/etc/httpd/conf.d/目錄

End

文 / IDO老徐

Ⅱ centos安裝apache mysql php用YUM安裝與編譯安裝有什麼區別

YUM安裝:需要連接網路,依賴庫可以自動補全;
編譯安裝:自己下載安裝包,依賴包要自己補

Ⅲ centos 自帶安裝了apache和php,現在想單獨編譯安裝php怎麼弄

無法聯網時升級不了的!建議你能上網的時候,用YUM把原來帶的刪除了,然後你找個linux版本的xapmm算了,這個直接就能用了,資料庫什麼的都集成在里邊,比自己安裝省事多了。

Ⅳ centos編譯安裝php7怎麼加入apache

直接下載PHP7.0.2的安裝包解壓,編譯,安裝:
下載php7,並解壓
$ cd /usr/src/
$ wget http://cn2.php.net/distributions/php-7.0.2.tar.gz
#解壓
$ tar -xzxvf php-7.0.2.tar.gz
$ cd php-7.0.2
解壓完後先不要編譯,請檢查是否安裝了gcc ,沒有的話執行yum install gcc
檢查是否安裝了libxml2 ,沒有的話執行yum install libxml2
檢查是否安裝了libxml2-devel,沒有的話執行yum install libxml2-devel
註:因為改為用nginx了,所以編譯參數中的--with-apxs2=/usr/bin/apxs去掉了,如果要配置apache用,安裝PHP前,請先安裝apache。

Ⅳ centos安裝apache mysql php用YUM安裝與編譯安裝有什麼區別

yum安裝方便,內容固定。
編譯安裝內容定製靈活,但手續稍復雜。

Ⅵ centos編譯安裝php7怎麼加入apache

centos編譯安裝php7怎麼加入apache
可以直接下載PHP7.0.2的安裝包解壓,編譯,安裝:
下載php7,並解壓
$ cd /usr/src/
$ wget http://cn2.php.net/distributions/php-7.0.2.tar.gz
#解壓
$ tar -xzxvf php-7.0.2.tar.gz
$ cd php-7.0.2
解壓完後先不要編譯,請檢查是否安裝了gcc ,沒有的話執行yum install gcc
檢查是否安裝了libxml2 ,沒有的話執行yum install libxml2
檢查是否安裝了libxml2-devel,沒有的話執行yum install libxml2-devel
註:因為改為用nginx了,所以編譯參數中的--with-apxs2=/usr/bin/apxs去掉了,如果要配置apache用,安裝PHP前,請先安裝apache。

Ⅶ 如何在linux centos中安裝apache

Apache在Linux系統中,其實叫「httpd」,它「無恥的」占據了官方名義!
CentOS可以使用yum命令,非常簡單和容易的安裝Apache,下面演示一下步驟:

1、安裝Apache
yum install httpd

2、設置Apache服務的啟動級別
chkconfig --levels 235 httpd on
Apache是一個服務,所以,可以通過設置服務的啟動級別來讓它啟動。2,3,5三個級別分別表示什麼意思就不用我多說了吧。

3、現在就啟動它
/etc/init.d/httpd start

安裝之後的說明:

1、驗證是否安裝成功
現在打開http://ip地址,看看有沒有Apache的默認頁面出來了?如果有就對了。

2、安裝目錄介紹
Apache默認將網站的根目錄指向/var/www/html 目錄
默認的主配置文件是/etc/httpd/conf/httpd.conf
配置存儲在的/etc/httpd/conf.d/目錄

熱點內容
資料庫數據插入語句 發布:2025-05-15 01:30:01 瀏覽:870
js是無需編譯直接運行嗎 發布:2025-05-15 01:28:30 瀏覽:476
android文件夾重命名 發布:2025-05-15 01:13:50 瀏覽:481
cns腳本 發布:2025-05-15 01:13:38 瀏覽:722
數據結構與演算法筆試題 發布:2025-05-15 01:04:20 瀏覽:417
搜狗輸入法如何直接編輯配置文件 發布:2025-05-15 00:51:47 瀏覽:668
電箱都有哪些配置 發布:2025-05-15 00:30:21 瀏覽:74
安卓qq邀請碼在哪裡尋找 發布:2025-05-15 00:02:04 瀏覽:35
三菱fx編程口 發布:2025-05-15 00:01:23 瀏覽:810
醫院招商引資宣傳片腳本 發布:2025-05-15 00:01:21 瀏覽:368