CentOS配置网络yum源

    centOS自带的yum源,一般软件包的版本比较低,在需要编译安装一些服务和软件时,会发生缺包少包的问题。可以通过配置网络yum源来升级本地的软件包。

  CentOS6:

# rm -rf etc/yum.repos.d/*                             #删除原先的yum配置文件

# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

# sed -i 's/$releasever/6.8/g' /etc/yum.repos.d/CentOS-Base.repo

# yum clean all             #清除yum缓存

# yum list                     #生成新的yum缓存(升级软件包)

CentOS7:

[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

[root@localhost ~]# sed -i 's/$releasever/7.2.1511/g' /etc/yum.repos.d/CentOS-Base.repo(定位到镜像站的CentOS7.2)

[root@localhost ~]# sed -i 's/$releasever/7/g' /etc/yum.repos.d/CentOS-Base.repo(定位到镜像站的CentOS7.0)

[root@localhost ~]# yum clean all

[root@localhost ~]# yum list

你可能感兴趣的:(CentOS配置网络yum源)