学习linux的时候,没有光盘,想安装软件,只能更改网上的yum源来安装了。
这里提供一个网易的yum源。
1、到http://mirrors.163.com的 centos帮助文档中下载CentOS6-Base-163.repo文件,存放到/etc/yum.repo.d中。
Centos 7 : wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
Centos 6 : wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
Centos 5 : wget http://mirrors.163.com/.help/CentOS5-Base-163.repo
将下载的文件复制到/etc/yum.repos.d
目录下。
2、首先备份/etc/yum.repos.d/CentOS-Base-163.repo
cp CentOS6-Base-163.repo CentOS6-Base-163.repo.bak
3、编辑CentOS6-Base-163.repo文件,将其中的$releasever更改为centos的版本号,这里以redhat6.0 32位版本为例。
[root@Node2 yum.repos.d]# vi CentOS6-Base-163.repo
# 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-6 - Base - 163.com
baseurl=http://mirrors.163.com/centos/6/os/i386/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#released updates
[updates]
name=CentOS-6 - Updates - 163.com
baseurl=http://mirrors.163.com/centos/6/updates/i386/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras]
name=CentOS-6 - Extras - 163.com
baseurl=http://mirrors.163.com/centos/6/extras/i386/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6 - Plus - 163.com
baseurl=http://mirrors.163.com/centos/6/centosplus/i386/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#contrib - packages by Centos Users
[contrib]
name=CentOS-6 - Contrib - 163.com
baseurl=http://mirrors.163.com/centos/6/contrib/i386/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
4、编辑完后保存,检验是否更新成功:
yum clean all 清除原有缓存
yum makecache 获取yum列表
yum install vim*
===================================
整理自
http://www.linuxidc.com/Linux/2013-07/87383.htm