设置yum源

vi /etc/sysconfig/network
GATEWAY = 172.19.0.200
vi /etc/resolv.conf
nameserver 114.114.114.114
nameserver 202.117.80.2


将/etc/yum.repos.d/CentOS-Base.repo 备份后删除
新建 /etc/yum.repos.d/CentOS-Base.repo这个文件
使用上海交通大学的centos源作为软件源
将一下文本拷贝至CentOS-Base.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-$releasever - Base
# #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://ftp.sjtu.edu.cn/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
#
# #released updates
[updates]
name=CentOS-$releasever - Updates
# #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
baseurl=http://ftp.sjtu.edu.cn/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
#
# #additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
# #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
baseurl=http://ftp.sjtu.edu.cn/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
#
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
# #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
baseurl=http://ftp.sjtu.edu.cn/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
#
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
# #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
baseurl=http://ftp.sjtu.edu.cn/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

 

复制保存完成后 键入 yum update 看是否能够联通

posted @ 2015-06-17 14:44  淡淡723  阅读(170)  评论(0编辑  收藏  举报