1. 程式人生 > >Linux系列之離線安裝Apache HTTP

Linux系列之離線安裝Apache HTTP

1.  安裝準備

1.1  下載介質

1.2  上傳介質 

scp -r /opt/tools/httpd 192.168.233.130:/opt/tools/httpd

2.  安裝HTTP

2.1  編譯安裝apr

cd /opt/tools/httpd
tar -zxvf apr-1.5.2.tar.gz -C ./

cd ./apr-1.5.2
./configure --prefix=/usr/local/httpd/apr
make 
make install

2.2  編譯安裝apr-util

cd /opt/tools/httpd
tar -zxvf apr-util-1.5.4.tar.gz -C ./

cd ./apr-util-1.5.4
./configure --prefix=/usr/local/httpd/apr-util --with-apr=/usr/local/httpd/apr/bin/apr-1-config
make 
make install

2.3  編譯安裝pcre

cd /opt/tools/httpd
tar -zxvf pcre-8.42.tar.gz -C ./

cd ./pcre-8.42
./configure --prefix=/usr/local/httpd/pcre --with-apr=/usr/local/httpd/apr/bin/apr-1-config
make 
make install

2.4  編譯安裝httpd

cd /opt/tools/httpd
tar -zxvf httpd-2.4.34.tar.gz -C ./

cd ./httpd-2.4.34
./configure --prefix=/usr/local/httpd/apache2 --with-apr=/usr/local/httpd/apr/bin/apr-1-config --with-apr-util=/usr/local/httpd/apr-util/bin/apu-1-config --with-pcre=/usr/local/httpd/pcre/bin/pcre-config --enable-dav --enable-so
make 
make install

2.5 修改httpd配置

    # vim /usr/local/httpd/apache2/conf/httpd.conf

ServerName 192.168.233.130:80

3.  啟動HTTP

3.1  將apachectl加入service系統服務

cp /usr/local/httpd/apache2/bin/apachectl /etc/rc.d/init.d/apache
chkconfig --add apache    

3.2  啟動apache服務

service apache start 

3.3  驗證啟動

ps -ef | grep http
netstat -an | grep :80    

3.4 WEB UI驗證

3.5  配置HTTP環境變數

    # vim /etc/profile

# HTTP_HOME
export HTTP_HOME=/usr/local/httpd/apache2
export PATH=$PATH:$HTTP_HOME/bin

3.6 驗證HTTP環境

source /etc/profile
httpd -v