Centos系统配置虚拟机网络yum源
1、这是中科大的源
cd /etc/yum.repos.d
mv CentOS-Base.repo CentOS-Base.repo.save //先重命名Centos自带的yum源。
wget http://mirrors.ustc.edu.cn/centos/CentOS-Base.5.mirrors.repo O /etc/yum.repos.d/CentOS-Base.repo
yum makecache
2、这是sohu的源
cd /etc/yum.repos.d
mv CentOS-Base.repo CentOS-Base.repo.save //先重命名Centos自带的yum源。
wget http://mirrors.sohu.com/help/CentOS-Base-sohu.repo
yum makecache
3、阿里云Linux安装镜像源地址:http://mirrors.aliyun.com/
第一步:备份原镜像文件,以免出错后可以恢复。
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
第二步:下载新的CentOS-Base.repo 到/etc/yum.repos.d/
CentOS 5
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
CentOS 6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
第三步:运行yum makecache生成缓存
yum makecache
更改后
[root@xinsz63 yum.repos.d]# ls
CentOS-Base.repo
有时候会出现错误,现象:
Loading "installonlyn" plugin
Existing lock /var/run/yum.pid: another copy is running. Aborting.
这是因为yum在更新, 此时是kill不掉的该进程的, 正确的解决方法是让它停止更新即可。
可以直接输入 rm -f /var/run/yum.pid
也可以/etc/init.d/yum-updatesd stop