linux通过挂载系统光盘搭建本地yum仓库,使用yum命令加上list参数就可以查看仓库了。
1.挂载光盘
[root@localhost ~]# mount /dev/cdrom /media/cdrom/
mount: /dev/sr0 写保护,将以只读方式挂载/dev下的cdrom目录是事先创建好的
2.修改yum配置文件(文件位置:/etc/yum.repos.d)
[root@localhost /]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# mkdir bak#创建一个文件夹来存放多余的配置文件
[root@localhost yum.repos.d]# mv *.* bak/
[root@localhost yum.repos.d]# cd bak/
[root@localhost bak]# ls
centos-base.repo centos-debuginfo.repo centos-media.repo centos-vault.repo
centos-cr.repo centos-fasttrack.repo centos-sources.repo
[root@localhost bak]# mv centos-media.repo ../
[root@localhost bak]# cd ../
[root@localhost yum.repos.d]# vi centos-media.repo
# centos-media.repo
#
# this repo can be used with mounted dvd media, verify the mount point for
# centos-7. you can use this repo and yum to install items directly off the
# dvd iso that we release.
#
# to use this repo, put in your dvd and use it with the other repos too:
# yum --enablerepo=c7-media [command]
#
# or for only the media repo, do this:
#
# yum --disablerepo=\* --enablerepo=c7-media [command]
[c7-media]
name=centos-$releasever - media
baseurl=file:///media/centos/
file:///media/cdrom/#本地yum源所在路径
file:///media/cdrecorder/
gpgcheck=0 #这里为0不进行检查
enabled=1 #这里为1启动
gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-7
~保存退出
3.验证
我们使用 yum 命令加上 list 参数就可以查看仓库
[root@localhost /]# yum list #后面东西太多了。。。以上所述是小编给大家介绍的linux通过挂载系统光盘搭建本地yum仓库的方法,希望对大家有所帮助
租王者号哪个平台好 王者租号平台推荐什么是域名转移 域名由个人转自己公司需要再花钱吗蓝鸽云课堂服务器价格台湾服务器和港澳服务区云主机哪个好办理cdn资质材料阿里云服务器配置清单怎么列出内容东北弹性云服务器多少钱5种常见的服务器种类是哪些