1、檢查環境
getenforce #查看seLinux運行狀態 Enforcing #強行執行 setenforce 0 #臨時關閉selinux vim /etc/selinux/config #編輯selinux配置文件 ########### 將SELINUX=enforcing改為 SELINUX=disabled ###########

2、臨時關閉防火牆
(因為在實際應用時不能關閉防火牆,因此此時暫時關閉防火牆)
systemctl stop firewalld #臨時關閉防火牆
systemctl disable firewalld #禁止防火牆開機啟動

3、配置yum源
mkdir /iso #創建掛載點 mount /dev/cdrom /iso #掛載光盤到掛載點 df -h #查看掛載是否成功

cd /etc/yum.repos.d/ #進入yum源目錄 rm -rf *.repo #刪除官方源 vim iso.repo #編輯源文件 ############## [iso] #源標示 name=iso #源名稱 baseurl=file:///iso #源地址 file:// + /iso enabled=1 #開啟源 gpgcheck=0 #關閉驗證 ############## yum clean all #清理Yum源緩存
4.安裝服務
yum -y install httpd #安裝httpd服務
rm -rf /etc/httpd/conf.d/welcome.conf #刪除歡迎頁

5.啟動服務
rm -rf /etc/httpd/conf.d/welcome.conf #刪除歡迎頁
systemctl start httpd #啟動httpd
systemctl enable httpd #設置httpd開機啟動
ip a #查看本機IP

瀏覽器畫面:

6.編輯主頁
curl www.XXX.com > /var/www/html/index.html #把某個網站的內容加入到index頁面 vim /var/www/html/index.html #修改里邊的內容
