Centos 原始碼安裝apache

2021-08-13 14:57:57 字數 3494 閱讀 7526

安裝apache前準備:

1、檢查該環境中是否已經存在httpd服務的配置檔案,預設儲存路徑:/etc/httpd/httpd.conf(這是centos預裝的apache的乙個ent版本,一般我們安裝源**版的apache

)。如果已經存在/etc/httpd/httpd.conf,請先解除安裝或者關閉centos系統自帶的web服務,執行命令:chkconfig  httpd off,再或者把centos自帶的httpd服務的80埠改為其他埠,只要不與我們安裝的apache服務的埠衝突就可以啦。

停止並解除安裝linux系統自帶的httpd服務:

3、kill -9 pid號(逐個刪除)

5、rpm -e httpd軟體包

httpd-2.2.23版本編譯命令:

./configure --prefix=/usr/local/apache2 (安裝目錄引數後面可以不加任何引數,直接安裝即可)

make

make install

httpd-2.4.3版本編譯命令:

./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre (除了指定apache的安裝目錄外,還要安裝apr、apr-util、pcre,並指定引數)

make

make install

apache在2.4版本以後,編譯時:

# ./configure --prefix=/usr/local/apache2 --with-included-apr --enable-so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared --with-pcre
出現如下錯誤:

configure: error: bundled apr requested but not found at ./srclib/. download and unpack the corresponding apr and

apr-util packages to ./srclib/.

網上搜尋的解決方法雖正確,**卻是打不開;於是,去apache官網找:

# cd /usr/local/src

# wget

# wget

# tar -jxvf apr-util-1.5.4.tar.bz2

# tar -jxvf apr-1.5.2.tar.bz2

將解壓的庫資料夾移動到httpd子目錄srclib裡(去掉版本號):

# cp -rf apr-1.5.2 /usr/local/src/httpd-2.4.18/srclib/apr   //將版本號去掉,下同

完成上面操作,在執行編譯的時候,就不會報錯了。

在編譯apache(在安裝httpd-2.4.3時遇到的問題)時分別出現了apr not found、apr-util not found、pcre-config for libpcre not found的問題,下面就httpd-2.4.3的這些問題解決來實際操作一把。

[root@localhost bin]#

tar -zxf apr-1.4.5.tar.gz

[root@localhost apr-1.4.5]#

./configure --prefix=/usr/local/apr

[root@localhost apr-1.4.5]#

make

[root@localhost apr-1.4.5]#

make install

2.解決apr-util not found問題

[root@localhost bin]#

tar -zxf apr-util-1.3.12.tar.gz

[root@localhost apr-util-1.3.12]#

./configure --prefix=/usr/local/apr-util -with-apr=/usr/local/apr/bin/apr-1-config

[root@localhost apr-util-1.3.12]#

make

[root@localhost apr-util-1.3.12]#

make install

3、解決pcre-config for libpcre not found問題

[root@localhost ~]#

unzip pcre-8.31.zip

[root@localhost ~]#

cd pcre-8.31

[root@localhost pcre-8.31]#

./configure --prefix=/usr/local/pcre

[root@localhost pcre-8.31]#

make[root@localhost pcre-8.31]# make install

如果已經存在/etc/httpd/httpd.conf,請先解除安裝或者關閉centos系統自帶的web服務,執行命令:chkconfig  httpd off,再或者把centos自帶的httpd服務的80埠改為其他埠,只要不與我們安裝的apache服務的埠衝突就可以啦。

•啟動apache:/usr/local/apache2/bin/apachectl start

•停止apache:/usr/local/apache2/bin/apachectl stop

•重啟apache:/usr/local/apache2/bin/apachectl restart

**放在/usr/local/apache2/htdocs目錄下

在ie中通過http://localhost:80,如果看到頁面中顯示「it works!」字樣,則代表apache驗證通過。如果**的index字尾是php格式的,則要修改httpd.conf配置檔案(/usr/local/apache2/conf),在directoryindex增加 index.php。

#directoryindex: sets the file that apache will serve if a directory

#is requested.

#directoryindex index.html index.php

CentOS原始碼安裝PHP

先安裝需要的庫 yum y install libxml2 yum y install libxml2 devel yum y install gd yum y install gd devel yum y install curl curl devel yum y install libjpeg ...

CentOS 原始碼安裝PHP

2 解壓縮並且進入解壓縮後的檔案目錄下 4 make make install 遇到問題 1 configure error xml2 config not found.please check your libxml2 installation 參看 安裝php時的報錯 checking libx...

centos原始碼安裝mysql

b 步驟 b shell cp mysql 5.1.43 linux.tar.gz home shell cd home shell tar zxvf mysql 5.1.43 linux.tar.gz shell cp home mysql 5.1.43 linux i686 glibc23 su...