配置本机的yum源
Posted lvhongwei
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了配置本机的yum源相关的知识,希望对你有一定的参考价值。
配置本机的yum源
环境:操作系统CentOS6.5
1.挂在安装光盘
[[email protected] ~]# mkdir -p /mnt/cdrom
[[email protected] ~]# mount /dev/cdrom /mnt/cdrom
mount: block device /dev/sr0 is write-protected, mounting read-only
[[email protected] ~]#
2.修改yum配置文件
yum的配置文件在/etc/yum.repos.d/
[[email protected] yum.repos.d]# ls
CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo
查看目录有4个yum的配置文件。可以修改里面的任何一个,这里一修改CentOS-Base.repo为例,
修改之前可以先备份下该文件。
3.修改配置文件
[[email protected] yum.repos.d]# vi CentOS-Base.repo
[[email protected] yum.repos.d]#
会看到里面有很多内容,因为我们配置的,本地yum源,可以只保留上面的部分
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
修改红色标准的一行
baseurl=file:///mnt/cdrom
然后保存退出
4.查下yum源,如果可以看到,好多宝,就说明yum源,配置成功
[[email protected] yum.repos.d]# yum list
5.测试安装vim(如果看到下面内容,正常yum配置成功,可以正常使用。)
[[email protected] yum.repos.d]# yum install vim
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=i386&repo=os error was
14: PYCURL ERROR 6 - "Couldn‘t resolve host ‘mirrorlist.centos.org‘"
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package vim-enhanced.i686 2:7.2.411-1.8.el6 will be installed
以上是关于配置本机的yum源的主要内容,如果未能解决你的问题,请参考以下文章