千家信息网

Linux系统配置本地yum源的方法

发表于:2025-12-03 作者:千家信息网编辑
千家信息网最后更新 2025年12月03日,本篇内容主要讲解"Linux系统配置本地yum源的方法",感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习"Linux系统配置本地yum源的方法"吧!准备:系统:
千家信息网最后更新 2025年12月03日Linux系统配置本地yum源的方法

本篇内容主要讲解"Linux系统配置本地yum源的方法",感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习"Linux系统配置本地yum源的方法"吧!

准备:
系统:Centos 6.5
工具:Centos 6.5的系统镜像文件

一、将系统镜像文件拷贝至Linux系统中,放到指定位置,本次放到了 /root目录下。

[root@local ~]# lsCentOS-6.5-x86_64-bin-DVD1.iso

二、创建挂载点,并将系统镜像文件挂载。

[root@local ~]# mkdir /media/cd[root@local ~]# mount -o loop /root/CentOS-6.5-x86_64-bin-DVD1.iso /media/cd[root@local ~]# df -hFilesystem      Size  Used Avail Use% Mounted on/dev/sda3        41G  4.8G   35G  13% /tmpfs           932M  228K  932M   1% /dev/shm/dev/sda1       504M   45M  434M  10% /boot/dev/sr0        4.2G  4.2G     0 100% /media/cd

三、修改配置文件,配置文件位置和内容如下

ps :centos系统在此目录下有多个yum的配置文件,本地yum配置只留下一个即可。

[root@local ~]# cd /etc/yum.repos.d/[root@local yum.repos.d]# ls  CentOS-Media.repo[root@local yum.repos.d]# cat CentOS-Media.repo# CentOS-Media.repo##  This repo can be used with mounted DVD media, verify the mount point for#  CentOS-6.  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=c6-media [command]#  # or for ONLY the media repo, do this:##  yum --disablerepo=\* --enablerepo=c6-media [command] [c6-media]name=CentOS-$releasever - Mediabaseurl=file:///media/CentOS_6.5_Final/gpgcheck=0enabled=1

四、清空原始yum缓存,并重新缓存配置的本地yum源。

[root@local yum.repos.d]# yum clean allLoaded plugins: fastestmirror, refresh-packagekit, securityCleaning repos: c6-mediaCleaning up EverythingCleaning up list of fastest mirrors[root@local yum.repos.d]# yum repolistLoaded plugins: fastestmirror, refresh-packagekit, securityDetermining fastest mirrorsc6-media                                                 | 4.0 kB     00:00 ... c6-media/primary_db                                      | 4.4 MB     00:00 ... repo id                          repo name                                statusc6-media                         CentOS-6 - Media                         6,367repolist: 6,367

至此,本地yum源配置完成!

到此,相信大家对"Linux系统配置本地yum源的方法"有了更深的了解,不妨来实际操作一番吧!这里是网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!

0