linux真機搭建web服務共享光碟所有內容

俄又不亂來發表於2018-08-20

1.檢測是否安裝httpd 軟體包

rpm -q httpd

httpd-2.4.6-67.el7.centos.x86_64
2.重啟服務,並且設定開機自啟動
# systemctl restart httpd
[root@room9pc01 ~]# systemctl enable httpd
3.建立目錄
# mkdir /var/www/html/rhel7
4.掛載yum映象

mount /iso/rhel-server-7.4-x86_64-dvd.iso /var/www/html/rhel7

5.驗證軟體包是否掛載
]# ls /var/www/html/rhel7/
addons images repodata
EFI isolinux RPM-GPG-KEY-redhat-beta
EULA LiveOS RPM-GPG-KEY-redhat-release
extra_files.json media.repo TRANS.TBL
GPL Packages

  1. 訪問本機是否可以訪問

firefox 192.168.4.254/rhel7

7.設定開機自動掛載

ls -l /iso

lrwxrwxrwx 1 root root 27 1月 23 2018 /iso -> /var/lib/libvirt/images/iso

ls /iso/

CentOS-7-x86_64-DVD-1708.iso rhel-server-7.4-x86_64-dvd.iso
lost+found Win10_Pro_X64_zh_CN.iso
rhel-server-6.7-x86_64-dvd.iso

vim /etc/fstab

/var/lib/libvirt/images/iso/rhel-server-7.4-x86_64-dvd.iso /var/www/html/rhel7 iso9660 defaults 0 0
8.檢測掛載

mount -a

9.檢視掛載
df -h
10.設定為yum源

rm -rf /etc/yum.repos.d/rhel7.repo

vim /etc/yum.repos.d/rhel7.repo

]# cat /etc/yum.repos.d/rhel7.repo
[rhel7]
name=rhel7
baseurl=http://192.168.4.254/rhel7
enabled=1
gpgcheck=0
11.檢測yum源軟體包
[root@room9pc01 yum.repos.d]# yum repolist
已載入外掛:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
源標識 源名稱 狀態
rhel7 rhel7 4,986
repolist: 4,986


相關文章