yum安装
yum install -y httpd#查看通过yum安装的mpm应用#启动systemctl start httpd#设置开机启动systemctl enable httpd#停止systemctl stop httpdhttpd -lCompiled in modules: core.c mod_so.c http_core.c#yum安装默认应用eventMPM模块
源码编译安装
#安装编译环境yum -y groupinstall "Development Tools"yum -y install openssl-devel pcre-devel expat-devel libtool#apr下载地址:http://apr.apache.org/wget https://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-1.7.0.tar.gzwget https://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-util-1.6.1.tar.gz#解压apr和apr-util包gzip -d apr-1.7.0.tar.gz gzip -d apr-util-1.6.1.tar.gz tar -xvf apr-1.7.0.tar tar -xvf apr-util-1.6.1.tarcd apr-1.7.0/./configure --prefix=/usr/local/aprmake&&make installcd apr-util-1.6.1/./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/aprmake&&make installgzip -d httpd-2.4.46.tar.gz tar -xvf httpd-2.4.46.tar cd httpd-2.4.46/./configure --prefix=/usr/local/httpd --sysconfdir=/etc/httpd --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --enable-modules=most --enable-mpms-shared=all --with-mpm=preforkmake&&make installvim /etc/profile.d/httpd.shexport PATH=/usr/local/httpd/bin:$PATHsource /etc/profile#测试httpd配置文件的正确性[root@localhost hehe]# httpd -tSyntax OK#启动httpd服务apachectl start