yum怎么使用本地源的

2023-05-14 综合 27阅读
每次用rpm包安装软件是总有依赖包的出现,今天我搭建了运庆本地yum仓库,旁租握使型稿用yum从光盘安装软件可以解决包的依赖关系,具体操作如下:

1.挂载光盘镜像
[root@centos ~]# mkdir /mnt/cdrom
[root@centos ~]# mount /dev/cdrom /mnt/cdrom/
mount: block device /dev/sr0 is write-protected, mounting read-only
[root@centos ~]# vim /etc/yum.repos.d/CentOS-Media.repo
[c6-media]
name=CentOS-$releasever - Media --仓库名
baseurl=file:///mnt/cdrom --软件包路径
gpgcheck=1 --启用包检查
enabled=1 --启用这个仓库
gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-CentOS-6

2.测试仓库
[root@centos ~]# yum clean all --清除所有包
Loaded plugins: fastestmirror, refresh-packagekit
Cleaning repos: c6-media
Cleaning up Everything
Cleaning up list of fastest mirrors
[root@centos ~]# yum repolist --查找有几个仓库
Loaded plugins: fastestmirror, refresh-packagekit
Determining fastest mirrors
c6-media | 4.0 kB 00:00 ...
c6-media/primary_db | 3.5 MB 00:00 ...
repo id repo name status
c6-media CentOS-6 - Media 4,802
repolist: 4,802
[root@centos ~]#

3.安装软件
[root@centos ~]# yum install gpm --安装软件
Loaded plugins: fastestmirror, refresh-packagekit
Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package gpm.i686 0:1.20.6-12.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
声明:你问我答网所有作品(图文、音视频)均由用户自行上传分享,仅供网友学习交流。若您的权利被侵害,请联系fangmu6661024@163.com