Centos 7 配置阿里云yum源
原因:有的时候服务器需要下载一些软件,是本地yum源没有的,这时候需要配置网络yum源(阿里云yum源)
1、通过远程工具Xshell连接Linux

2、进入目录 cd /etc/yum.repos.d/

3、备份原镜像文件,以免出错后可以恢复

4、下载新的CentOS-Base.repo 到/etc/yum.repos.d/
命令:wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

下载成功

打开CentOS-Base.repo,可看到该文件中已经配有阿里云yum源地址

如果该命令报如下错误,说明你还未安装wget,需要安装wget(未报错跳过)

通过命令 yum install wget 下载安装wget(为报错跳过)
如果通过yum安装wget安装失败的话,说明你还未配本地yum,配置本地yum,详细步骤请点击下方链接前去学习配置
配置本地yum源

5、清除原有yum缓存 yum clean all

6、生成缓存yum makecache

成功
本文章最后由
admin 于
2023-02-05 18:08 编辑