1.需要一個與本機匹配的安裝鏡像流妻,rhel-server-7.0-x86_64-dvd.iso,這個文件從官方網(wǎng)站下載得
在'/'目錄下執(zhí)行mkdir yum
?????將得到的鏡像放到/home/kiosk
2.mount /home/kiosk/rhel-server-7.0-x86_64-dvd.iso /yum
3.mv /etc/yum.repos.d/* /mnt
4.vim /etc/yum.repos.d/yum.repo
?????[redhatsoftware] ###倉庫名稱
?????name=localsoftware ###倉庫描述
?????baseurl=file:///yum ###倉庫地址
?????gpgcheck=0 ###是否檢測軟件的gpgkey
例子
[redhat]
name=redhat
baseurl=file:///yum
gpgcheck=0
在/yum下執(zhí)行下面命令
5.yum install httpd -y
systemctl stop firewalld
systemctl start httpd
systemctl enable httpd
mkdir -p /var/www/html/yumsource
umount /yum
mount /home/kiosk/rhel-server-7.0-x86_64-dvd.iso /var/www/html/yumsource
<<<yum源地址:http://主機ip/yumsource>##讓系統(tǒng)能夠讀取rhel-server-7.0-x86_64-dvd.iso中的內(nèi)容
vim /etc/fstab
6./xxx/rhel-server-7.0-x86_64-dvd.iso /xxx iso9660 ro,relatime 0 0
鏡像文件 掛在點 類型 掛載參數(shù) 備份 檢測
例子
/home/kiosk/rhel-server-7.0-x86_64-dvd.iso /yum iso9660 defaults 0 0
mount -a
7.編寫軟件倉庫的指定文件
/etc/yum.repos.d
##倉庫指向文件存儲目錄
vim /etc/yum.repos.d/test.repo
###倉庫指向文件
?????[redhatsoftware]
###倉庫名稱
?????name=localsoftware
###倉庫描述
?????baseurl=file:///source
###倉庫地址
?????gpgcheck=1|0
###是否檢測軟件的gpgkey
?????enabled=1
###此倉庫在系統(tǒng)中生效
?????gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
##本機gpgkey文件
例子
[redhat]
name=redhat
baseurl=file:///source
gpgcheck=1|0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release