LAMP架構(1)-安裝apache
實驗環境:redhat6.5
實驗目的:安裝apache
準備材料:redhat6.5系統 apache安裝包
實驗步驟:
輸入tar xzvf http-2.4.2.tar.gz -C /opt
tar xzvf apr-1.4.6.tar.gz -C /opt
tar xzvf apr-util-1.4.1.tar.gz -C /opt
依次安裝
輸入cp -R apr-1.4.6/ /opt/httpd-2.4.2/srclib/apr
cp -R apr-util-1.4.1/ /opt/httpd-2.4.2/srclib/apr-util
將兩個apr包復制進httpd中
輸入yum install gcc gcc-c++ make pcre pcre-devel -y
yum安裝前置包
輸入cd /opt/httpd-2.4.2 進入目錄
再輸入
./configure \
--prefix=/usr/local/apache \
--enable-so \
--enable-rewrite \
--enable-mods-shared=most \
--with-mpm=worker \
--disable-cgid \
--disable-cgi
運行 運行完畢如下圖
接下來輸入 make & make install 進行安裝
安裝完成如下圖
輸入grep -v "#" /usr/local/apache/bin/apachectl > /etc/init.d/httpd
在文件最前面插入下面的行
#!/bin/sh
chkconfig:2345 85 15
# description:Apache is a World Wide Web server.
依次輸入
chmod +x /etc/init.d/httpd 給予運行權限
chkconfig --add httpd
chkconfig --list httpd
chkconfig --level 35 httpd on 自啟動
ln -s /usr/local/apache/conf/httpd.conf /etc/httpd.conf 建立軟連接便於管理
vi /etc/httpd.conf 進行編輯
更改主機名
關掉防火墻,並重啟httpd服務
通過另一臺機器訪問本機IP,當顯示 It works! 時 則代表apache安裝成功
LAMP架構(1)-安裝apache