Linux 新机配置yum源

备份原来的镜像

# cd /etc/yum.repos.d/
# ls | xargs -i mv {} ./{}.bak

在CentOS6上配置阿里云的Base源

# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
或者
# curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
# yum clean all
# yum makecache
# yum repolist

在CentOS7上配置阿里云的Base源

# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
或者
# curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
# yum clean all
# yum makecache
# yum repolist

配置epel源

  • CentOS6
    # wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
  • CentOS7
    # wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
  • 或者直接使用yum安装
    # yum -y install epel-release

Couldn't resolve host 'mirrorlist.centos.org' 错误

# echo "nameserver 8.8.8.8" >>/etc/resolv.conf

手动配置yum源

你可能感兴趣的:(Linux 新机配置yum源)