码迷,mamicode.com
首页 > 其他好文 > 详细

配置本机的yum源

时间:2018-07-21 11:56:07      阅读:906      评论:0      收藏:0      [点我收藏+]

标签:protect   geo   nsa   ice   标准   proc   can   update   load   

配置本机的yum源

环境:操作系统CentOS6.5

1.挂在安装光盘

[root@CentOS40 ~]# mkdir -p /mnt/cdrom
[root@CentOS40 ~]# mount /dev/cdrom /mnt/cdrom
mount: block device /dev/sr0 is write-protected, mounting read-only
[root@CentOS40 ~]#

2.修改yum配置文件

yum的配置文件在/etc/yum.repos.d/

[root@CentOS40 yum.repos.d]# ls
CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo

查看目录有4个yum的配置文件。可以修改里面的任何一个,这里一修改CentOS-Base.repo为例,

修改之前可以先备份下该文件。

3.修改配置文件

[root@CentOS40 yum.repos.d]# vi CentOS-Base.repo
[root@CentOS40 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源,配置成功

[root@CentOS40 yum.repos.d]# yum list

 

5.测试安装vim(如果看到下面内容,正常yum配置成功,可以正常使用。)

[root@CentOS40 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源

标签:protect   geo   nsa   ice   标准   proc   can   update   load   

原文地址:https://www.cnblogs.com/lvhongwei/p/9345522.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!