Linux - 配置yum源

配置Yum源

1.切换到yum目录

cd /etc/yum.repos.d/

2.创建1个备份文件夹

mkdir backup

3.把原配置都放进备份的文件夹

mv CentOS-* backup

4.下载阿里云YUM源配置文件

方式1 - 用curl

curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

方式2 - 用wget

安装wget
yum install wget -y
wget安装
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

5.如果出现了用yum install xxxxxx报错

sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
然后重启网卡
systemctl restart network
posted @ 2020-11-28 21:49  轻描丨淡写  阅读(131)  评论(0编辑  收藏  举报