为CentOS添加源

本文内容过于古老而缺少价值, CentOS repo 相关信息, 请移步此处.

新安装CentOS 6.2 1 添加上海交大源1 yum 的.repo文件如下:

[CentOS-ftp.sjtu.edu.cn]
name=CentOS 6
baseurl=http://ftp.sjtu.edu.cn/centos/6/os/$basearch/
enabled=1
gpgcheck=0
gpgkey=http://ftp.sjtu.edu.cn/centos/6/os/$basearch/RPM-GPG-KEY-CentOS-6

[updates-ftp.sjtu.edu.cn]
name=CentOS updates
#baseurl=http://ftp.sjtu.edu.cn/centos/6/updates/$basearch/
baseurl=http://ftp.sjtu.edu.cn/centos/6/updates/$basearch/
enabled=1
gpgcheck=0
gpgkey=http://ftp.sjtu.edu.cn/centos/RPM-GPG-KEY-CentOS-6

[extras-ftp.sjtu.edu.cn]
name=CentOS-6-Extras
baseurl=http://ftp.sjtu.edu.cn/centos/6/extras/$basearch/
gpgcheck=0
gpgkey=http://ftp.sjtu.edu.cn/centos/RPM-GPG-KEY-CentOS-6

[centosplus-ftp.sjtu.edu.cn]
name=CentOS-6-Plus
baseurl=http://ftp.sjtu.edu.cn/centos/6/centosplus/$basearch/
gpgcheck=0
enabled=0
gpgkey=http://ftp.sjtu.edu.cn/centos/RPM-GPG-KEY-CentOS-6

[contrib-ftp.sjtu.edu.cn]
name=CentOS-6-Contrib
baseurl=http://ftp.sjtu.edu.cn/centos/6/contrib/$basearch/
gpgcheck=0
enabled=0
gpgkey=http://ftp.sjtu.edu.cn/centos/RPM-GPG-KEY-CentOS-6

[fasttrack-ftp.sjtu.edu.cn]
name=CentOS-6-fasttrack
baseurl=http://ftp.sjtu.edu.cn/centos/6/fasttrack/$basearch/
gpgcheck=0
enabled=0
gpgkey=http://ftp.sjtu.edu.cn/centos/RPM-GPG-KEY-CentOS-6

用法: 保存为 sjtu.repo (或者 xxxx.repo) terminal进入repo文件所在文件夹

sudo cp *.repo /etc/yum.repos.d/

有了上交的东西,可以删掉它自带的源了

su
cd /etc/yum.repos.d/
ls -al

按自己要求删吧

完了之后记得重新生成cache

yum makecache

有时候需要清空重来

yum clean all
yum makecache

这东西挺简单的,毕竟工具嘛随意发挥好了