CentOS 7 国内软件源替换
CentOS 自带的软件源在国内安装或更新软件是经常出现速度很慢的情况,这时候就需要将YUM源设置为国内镜像站点。
下面的命令可以替换为国内镜像软件源:
# CentOS-Base.repo cp -n /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.mybak curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo # epel-7.repo cp -n /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.mybak curl -o /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo # mariadb.repo (10.4版本) curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash /dev/stdin --mariadb-server-version mariadb-10.4 cp -n /etc/yum.repos.d/mariadb.repo /etc/yum.repos.d/mariadb.repo.mybak sed -i 's|https://downloads.mariadb.com/MariaDB/mariadb-.*$|http://mirrors.aliyun.com/mariadb/yum/10.4/centos7-amd64/|g' /etc/yum.repos.d/mariadb.repo
如果需要将之前修改的国内镜像软件源还原为原始的软件源,使用以下命令即可:
# CentOS-Base.repo \cp /etc/yum.repos.d/CentOS-Base.repo.mybak /etc/yum.repos.d/CentOS-Base.repo # epel-7.repo \cp /etc/yum.repos.d/epel.repo.mybak /etc/yum.repos.d/epel.repo # mariadb.repo \cp /etc/yum.repos.d/mariadb.repo.mybak /etc/yum.repos.d/mariadb.repo
原文链接地址:https://blog.exsvc.cn/article/centos7-yum-repo-replace.html
转载请注明:转载自 易科博客 ,谢谢!