apache安装与启动

1.配置好正确的yum源仓库,推荐使用阿里云的
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo


2.清空旧仓库源缓存信息,并且生成新的仓库源缓存
[root@backup yum.repos.d]# yum clean all        #清空缓存
[root@backup yum.repos.d]# yum makecache         #生成新的缓存


3.使用yum命令直接安装apache(linux的软件包httpd)
[root@backup yum.repos.d]# yum install httpd -y


4.检查linux是否启动了80端口
 netstat -tunlp|grep "80"


5.启动httpd服务,启动apache,配置apache开机自启
systemctl start httpd         #启动
systemctl status httpd        #检查运行状态
systemctl enable httpd        #配置开机启动
systemctl disable httpd       #去下开机启动


6.检查阿帕奇进程是否启动
[root@backup yum.repos.d]# ps -ef |grep apache|grep -v "grep"
apache     2321   2320  0 19:20 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache     2322   2320  0 19:20 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache     2323   2320  0 19:20 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache     2324   2320  0 19:20 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache     2325   2320  0 19:20 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache     2383   2320  0 19:24 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache     2384   2320  0 19:24 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache     2385   2320  0 19:24 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache     2389   2320  0 19:24 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache     2390   2320  0 19:24 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND

你可能感兴趣的:(apache安装与启动)