#本地yum源
#添加镜像文件
#挂载镜像文件
#配置repo文件
#清缓存
#加载缓存
#挂载到自己创建或其他空文件夹
mount /dev/cdrom /media
#mount: /dev/sr0 写保护,将以只读方式挂载
cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
# redhat.repo
#创建配置文件
[root@localhost yum.repos.d]#touch XXX.repo
#写入
[rhel]
name=rhel
baseurl=file:///media
enabled=1
gpgcheck=0
#缓存
[root@localhost yum.repos.d]# yum clean all
已加载插件:langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
正在清理软件源: rhel
Cleaning up everything
#检索
[root@localhost yum.repos.d]# yum repolist
已加载插件:langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
rhel | 4.1 kB 00:00:00
(1/2): rhel/group_gz | 136 kB 00:00:00
(2/2): rhel/primary_db | 3.9 MB 00:00:00
源标识 源名称 状态
rhel rhel 4,751
repolist: 4,751
------------------------------
#重建缓存
[root@localhost yum.repos.d]# yum makecache
已加载插件:langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
rhel | 4.1 kB 00:00:00
(1/3): rhel/other_db | 1.5 MB 00:00:00
(2/3): rhel/productid | 1.6 kB 00:00:00
(3/3): rhel/filelists_db | 3.3 MB 00:00:00
元数据缓存已建立
#查询
yum search all |grep XXX list