1、所需源碼包:
1.httpd-2.4.43.tar.gz
2.apr-1.7.tar.gz
3.apr-util-1.6.1.tar.gz
4.pcre-8.44.tar.gz
5.php-7.2.31.tar
6.mysql-5.7.30.tar.gz
2、準備環境:
yum install -y make gcc gcc-c++ openssl openssl-devel expat-develphp
3、將下載的包解壓到/usr/local/xxx
1)tar -xf apr-1.7.tar.gz -C/use/local/apr
cd /usr/local/apr
./configure --prefix=/usr/local/apr
make -j 4 && make install && cd ----4覈編譯 cd表示自動驗證編譯是否成功並切換目錄
-----------------其它包安裝方法同上---------------------mysql
2)tar -xf 1.httpd-2.4.43.tar.gz -C /usr/local/apache
cd /usr/local/apache
./configure --prefix=/usr/local/apatch --enable-so --enable-rewrite --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre --enable-modules=most --enable-mpms-shared=all --with-mpm=event
選項說明:
prefix=/usr/local/apache /安裝路勁
--enable-so /支持動態加載模塊
--enable-ssl /支持SSL加密
--with-prce=/usr/local/pcre /pcre安裝的路徑
--with-apr=/usr/local/apr /apr安裝的路徑
--with-apr-util=/usr/local/apr-util /apr-util安裝的路徑
--enable-modules=most /啓用mpm模塊
--enable-mpms-shared=all
--with-mpm=eventc++
make && make install && cd ----生成apache啓動腳本----------- cp /usr/local/apache/bin/apachectl /etc/init.d/ chmod +x /etc/init.d/apachectl -------------寫一個Apache系統服務腳本,並754權限保存該文件------------- vim /usr/lib/.systemd/system/apache.service [Unit] Descrition=apache service After=network.target [Service] Type=forking ExexStart=/etc/init.d/apachectl start ExexStop=/etc/init.d/apachectl stop ExexReload=/etc/init.d/apachectl restart Private Tmp=true WantedBy=multi-user.target