Linux Centos7下Apache httpd服务安装,查看,启动和卸载

>>安装Apache httpd服务

1, 通过yum在线安装或者内网本地yum源仓库

# yum install httpd

2, 通过下载的rpm包安装

httpd-2.4.6-89.el7.centos.x86_64.rpm: http://mirrors.cn99.com/centos/7.6.1810/updates/x86_64/Packages/httpd-2.4.6-89.el7.centos.x86_64.rpm

httpd-2.2.2-1.x86_64.rpm: http://archive.apache.org/dist/httpd/binaries/rpm/x86_64/httpd-2.2.2-1.x86_64.rpm

# rpm -ivh httpd-2.4.6-89.el7.centos.x86_64.rpm

>>使用rpm -qa | grep httpd查看是否已经安装了httpd

# rpm -qa | grep httpd
httpd-tools-2.4.6-89.el7.centos.x86_64
httpd-2.4.6-89.el7.centos.x86_64

>>使用httpd -v查看已经安装的httpd的版本

# httpd -v
Server version: Apache/2.4.6 (CentOS)
Server built:   Apr 24 2019 13:45:48

>>使用ps -ef | grep httpd查看httpd的进程

>>使用service httpd status查看httpd的运行状态

# service httpd status
Redirecting to /bin/systemctl status httpd.service
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
   Active: inactive (dead)
     Docs: man:httpd(8)
           man:apachectl(8)

>>使用service httpd start 可以启动httpd

>>加入测试文件index.html

# echo 'hello world' > /var/www/html/index.html

>>测试httpd服务

# curl 127.0.0.1
hello world

>>使用service httpd stop可以停止httpd

 

 

>>卸载Apache httpd服务

1, 确认是否有安装过,或者系统自带了httpd服务

# rpm -qa | grep httpd
或:
# yum list | grep httpd

2, 停止httpd服务

# systemctl stop httpd.service

3, 卸载Apache httpd

# yum erase httpd.x86_64

 

 

转载于:https://my.oschina.net/jerval/blog/3051264

  • 2
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值