查看: 44|回覆: 0

[运维] rhel6添加本地yum

[複製鏈接]

4

主題

0

回帖

0

積分

热心网友

金币
0
閲讀權限
220
精華
0
威望
0
贡献
0
在線時間
0 小時
註冊時間
2011-3-20
發表於 2023-7-1 00:00:00 | 顯示全部樓層 |閲讀模式

1、准备工作

关闭selinux

#setenforce 0

创建yum目录

#mkdir /yum

挂载光盘

#mount -o loop /dev/cdrom /mnt

拷贝光盘内所有文件到本地目录

#cp -ar /mnt/* /yum

2、添加配置文件

修改repo文件,访问本地yum库

#vi /etc/yum.repos.d/local.repo

[local]
name=Red Hat Enterprise Linux update6
baseurl=file:///yum/
gpgcheck=0
enabled=1

删除或者备份原始repo文件,否则yumlist会报错如下:

#mv /etc/yum.repos.d/packagekit-media.repo /etc/yum.repos.d/packagekit-media.repo.bk
rhel6 Error: Cannot retrieve repository metadata (repomd.xml) for repository: InstallMedia. Please verify its path and try again

清除yum缓存

#yum clean all

3、测试

[root@rhel6 ~]# yum repolist
Loaded plugins: refresh-packagekit, rhnplugin
This system is not registered with RHN.
RHN support will be disabled.
repo id repo name status
local Red Hat Enterprise Linux update6 3,391
repolist: 3,391

看到上述信息,表示yum库创建成功

回覆

使用道具 舉報

您需要登錄後才可以回帖 登錄 | 立即注册

本版積分規則

相关侵权、举报、投诉及建议等,请发 E-mail:qiongdian@foxmail.com

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部