Linux换源


安装完成Linux后经常需要用到yum安装一些软件或者插件,因此大部分需要给yum换下源,去下载,类似Maven切换镜像,之前经常用到,不过每次换完后,又忘了具体

的地址,因此记录一下相关的代码,以便后续用到时候快速查找!


以Centos为例:

1、 修改/etc/yum.repos.d/CentOS-Base.repo为:


[base]
name=CentOS-$releasever - Base
baseurl=http://mirrors.163.com/centos/6/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6


#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=http://mirrors.163.com/centos/6/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6


#packages used/produced in the build but not released
#[addons]
#name=CentOS-$releasever - Addons
#baseurl=http://mirrors.163.com/centos/$releasever/addons/$basearch/
#gpgcheck=1
#gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=http://mirrors.163.com/centos/6/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://mirrors.163.com/centos/6/centosplus/$basearch/
gpgcheck=1
enabled=0







配置保存后,运行,
2、更新

yum clean all 
or
 yum -y update


过程需要一些时间.....等待中...




测试:
3、yum install vim #测试一下可不可以用
















你可能感兴趣的:(系统运维)