虛擬機: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服務
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.