本文实例讲述了Centos7.4服务器安装apache及安装过程出现的问题解决方法。分享给大家供大家参考,具体如下:
一、安装httpd
1. 安装之前,先查看系统中是否存在已经安装了的httpd.rpm包,如果,没有就是没安装,有的话rpm -e 对应的rpm包名进行删除
#rpm -qa | grep httpd
2. 使用yum安装(自动安装依赖包),简单方便
#yum -y install httpd
3. 安装成功后,httpd-v 查看安装的apache版本,查找apache的配置文件位置
#find / -name "httpd.conf"
4. 将找到的源配置文件备份一份,防止错误后无法恢复
#cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.bak
5. 启动Apache服务
#systemctl start httpd.service
6. 开机自动启动Apache服务
#systemctl enable httpd.service 开机自启httpd
#systemctl disable httpd.service 开机不启动httpd
7. 查看httpd的状态
#systemctl status httpd.service
二、安装过程出现的问题
1. Apache启动失败,Job for httpd.service failed because the control process exited with error code. See “systemctl status httpd.service” and “journalctl