虚拟机:192.168.2.21
【停止防火墙】
sudo systemctl stop firewalld.service --停止防火墙
sudo systemctl disable firewalld.service --开机关闭防火墙
【安装apache httpd服务】
cat /etc/yum.repos.d/CentOS-Media.repo -----查看镜像配置
yum --disablerepo=\* --enablerepo=c7-media,offline-extras,offline-storage-gluster38 list | grep httpd --查看本地镜像是否有 apache httpd 的rpm安装包
sudo yum --disablerepo=\* --enablerepo=c7-media,offline-extras,offline-storage-gluster38 install httpd --安装httpd服务
sudo systemctl list-unit-files httpd.service --查看httpd服务
sudo systemctl enable httpd.service && sudo systemctl start httpd.service --启动httpd服务
sudo systemctl -l status httpd.service --查看httpd服务
sudo netstat -tpnl --查看httpd服务占用端口
curl http://localost --测试httpd是否安装成功
curl http://127.0.0.1 --测试httpd是否安装成功
curl http://192.168.2.21 --测试httpd是否安装成功
sudo systemctl -l status firewalld.service --查看防火墙状态
sudo systemctl stop firewalld.service --停止防火墙
sudo systemctl disable firewalld.service --开机关闭防火墙
ls /var/www/html --这是封装的http访问的入口
sudo ln -s /home/ecp2/mirror/ /var/www/html/ --在/var/www/html下创建/home/ecp2/mirror 目录的 快捷方式 但由于权限的问题 这种操作访问不了
sudo chown -R apache: mirror/ --将文件mirror文件的读权限给apache用户 (这样依然没有权限访问)
sudo cp -r /home/ecp2/mirror . --把/home/ecp2/mirror镜像目录复制到.当前目录 即/var/www/html (这样在浏览器http://192.168.2.21/mirror 就可以访问了)
CentOS7安装apache httpd服务
原创fei_0123456789 博主文章分类:技术文档 ©著作权
©著作权归作者所有:来自51CTO博客作者fei_0123456789的原创作品,请联系作者获取转载授权,否则将追究法律责任
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
虚拟机安装CentOS7
本章节我们将学习如何安装创建一个Linux学习环境。
CentOS VMware 云计算 系统 运维 -
Centos7安装python3.12
centos7 安装高版本的python3.12的方法和过程;
python 软链接 python3