鏡像下載
http://mirrors.aliyun.com/centos-vault/7.6.1810/isos/x86_64/
配置本地yum源
1、安裝Centos后默認(rèn)的Yum源如下
[root@localhost ~]# ll /etc/yum.repos.d/
#查看當(dāng)前yum源
2、備份YUM源文件(可選)
[root@localhost ~]# mkdir /opt/backup
#創(chuàng)建backup目錄
[root@localhost ~]# mv /etc/yum.repos.d/* /opt/backup/
#備份yum源到opt下的backup文件夾
3、將iso鏡像上傳到服務(wù)器上的/mnt/iso文件夾里,記得先創(chuàng)建目錄,然后上傳。
[root@localhost /]# mkdir /mnt/iso
#鏡像放到該目錄下
[root@localhost /]# mkdir /opt/centos
#創(chuàng)建掛載目錄
4、掛載CentOS鏡像文件
[root@localhost /]# mount -t iso9660 /mnt/iso/CentOS-7-x86_64-DVD-1810.iso /opt/centos
#掛載格式為ISO,把CentOS-7.6掛載到/opt/centos目錄
[root@localhost centos]# df -h
輸入df-h查看,可以看到最下面一個,已經(jīng)掛載成功
5、編寫repo文件并指向鏡像的掛載目錄
[root@localhost /]# vi /etc/yum.repos.d/local.repo
添加下面的內(nèi)容:
[local]
name=local
baseurl=file:///opt/centos
enabled=1
gpgcheck=0
6、清除緩存
[root@localhost /]# yum clean all
#清除所有yum緩存
[root@localhost /]# yum makecache
把Yum源緩存到本地,加快軟件的搜索和安裝速度
7、查看yum倉庫列表
[root@localhost /]# yum repolist
8、開機(jī)自動掛載
在/etc/fstab表中,添加最后的一行,將iso文件永久掛載到系統(tǒng)中
[root@localhost /]# vi /etc/fstab
/mnt/iso/CentOS-7-x86_64-DVD-1810.iso /opt/centos iso9660 loop 0 0
9、取消掛載(需要的時候再執(zhí)行):
[root@localhost /]# umount /opt/centos
卸載掛載目錄文章來源:http://www.zghlxwxcb.cn/news/detail-420215.html
文章轉(zhuǎn)載:https://www.cnblogs.com/niway/p/15165684.html文章來源地址http://www.zghlxwxcb.cn/news/detail-420215.html
到了這里,關(guān)于centos7.6 掛載鏡像配置本地yum源的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!