一、所需源码包: 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 二、准备环境: yum install -y make gcc gcc-c++ openssl openssl-devel expat-devel

三、将下载的包解压到/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表示自动验证编译是否成功并切换目录 -----------------其它包安装方法同上---------------------

**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=event

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