>>安装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