Linux中配置yum源
1.掛載光碟
參考鏈接https://blog.csdn.net/m0_53521757/article/details/112536969
命令:mount -r /dev/sr0 /c1

2. yum源配置目錄為“/etc/yum.repos.d/”,在網路不可用時,可先備份至其他目錄然后洗掉(如下配置),或者使用mv重命名非".repo”結尾的檔案,
cd /etc/yum.repos.d/
cp * /root
rm -f *
3.創建新檔案tsu.repo, yum源組態檔都是以repo結尾
[tsu] //yum源的名稱,起標記作用
name=erniu //對yum源的描述,使用戶讀懂檔案
baseurl=file:///c1 //指定查找依賴關系的路徑﹔網路路徑或本地路徑"file://"表使用本地yum的檔案協議
enabled=1 //使能夠;0表baseurl定義不可用,1表可用
gpgcheck=0 //表進行gpg檢測;0表不進行,1表進行

4.重繪repos生成快取
yum clean all
yum makecache

完整代碼:
[root@localhost ~]# mkdir /c1
[root@localhost ~]# mount -r /dev/sr0 /c1
[root@localhost ~]# mount -a
[root@localhost ~]# df
檔案系統 1K-塊 已用 可用 已用% 掛載點
devtmpfs 480796 0 480796 0% /dev
tmpfs 497852 12820 485032 3% /dev/shm
tmpfs 497852 8712 489140 2% /run
tmpfs 497852 0 497852 0% /sys/fs/cgroup
/dev/mapper/centos-root 17811456 5460580 12350876 31% /
/dev/sda1 1038336 175208 863128 17% /boot
tmpfs 99572 36 99536 1% /run/user/0
/dev/sr0 4669162 4669162 0 100% /c1
[root@localhost ~]# cd /etc/yum.repos.d/ //進入yum源主目錄
[root@localhost yum.repos.d]# cp * /root //將所有默認yum源備份至root家目錄
[root@localhost yum.repos.d]# rm -f * //洗掉所有默認yum源
[root@localhost yum.repos.d]# vim tsu.repo //寫入內容!!!保存并退出
[root@localhost yum.repos.d]# yum clean all
[root@localhost yum.repos.d]# yum makecache
到這里就完成了yum源的配置了,有什么不懂的私信和評論都可以,博主肯定會回復的,我們共同交流,如果有什么不足和錯誤多多指點,
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/248061.html
標籤:其他
