rhel6添加本地yum
2024-10-29 20:10:25服务器运维 主机评测网
修改repo文件,访问本地yum库#vi /etc/yum.repos.d/local.repo[local]name=Red Hat Enterprise Linux update6baseurl=file:///yum/gpgcheck=0enabled=1
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 update6baseurl=file:///yum/gpgcheck=0enabled=1
删除或者备份原始repo文件,否则yumlist会报错如下:
#mv /etc/yum.repos.d/packagekit-media.repo /etc/yum.repos.d/packagekit-media.repo.bkrhel6 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 repolistLoaded plugins: refresh-packagekit, rhnpluginThis system is not registered with RHN.RHN support will be disabled.repo id repo name statuslocal Red Hat Enterprise Linux update6 3,391repolist: 3,391
看到上述信息,表示yum库创建成功
赞一个! ()