rhel6添加本地yum

tonyty163 Linuxrhel6添加本地yum已关闭评论7,5561字数 699阅读2分19秒阅读模式

1、准备工作

关闭selinux

#setenforce 0

创建yum目录文章源自运维生存时间-https://www.ttlsa.com/linux/rhel6-local-yum-repository/

#mkdir /yum

挂载光盘文章源自运维生存时间-https://www.ttlsa.com/linux/rhel6-local-yum-repository/

#mount -o loop /dev/cdrom /mnt

拷贝光盘内所有文件到本地目录文章源自运维生存时间-https://www.ttlsa.com/linux/rhel6-local-yum-repository/

#cp -ar /mnt/* /yum

2、添加配置文件

修改repo文件,访问本地yum库文章源自运维生存时间-https://www.ttlsa.com/linux/rhel6-local-yum-repository/

#vi /etc/yum.repos.d/local.repo
[local]
name=Red Hat Enterprise Linux update6
baseurl=file:///yum/
gpgcheck=0
enabled=1

删除或者备份原始repo文件,否则yumlist会报错如下:文章源自运维生存时间-https://www.ttlsa.com/linux/rhel6-local-yum-repository/

#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缓存文章源自运维生存时间-https://www.ttlsa.com/linux/rhel6-local-yum-repository/

#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库创建成功文章源自运维生存时间-https://www.ttlsa.com/linux/rhel6-local-yum-repository/ 文章源自运维生存时间-https://www.ttlsa.com/linux/rhel6-local-yum-repository/

weinxin
我的微信
微信公众号
扫一扫关注运维生存时间公众号,获取最新技术文章~
tonyty163
  • 本文由 发表于 04/09/2015 08:04:20
  • 转载请务必保留本文链接:https://www.ttlsa.com/linux/rhel6-local-yum-repository/
  • rhel6
  • yum库
  • 创建
  • 搭建
  • 本地
  • 添加