CentOS7 将阿里云的镜像源设置为yum源

1、实验环境

[root@localhost ~]# cat /etc/redhat-release 
CentOS Linux release 7.4.1708 (Core) 

2、测试网络环境
服务器必须能够访问互联网,这里用ping www.baidu.com来测试,使用域名不但可以测试网络的连通性,也可以测试域名解析的功能。

[root@localhost ~]# ping www.baidu.com
PING www.a.shifen.com (14.215.177.39) 56(84) bytes of data.
64 bytes from 14.215.177.39 (14.215.177.39): icmp_seq=1 ttl=55 time=21.0 ms

3、安装wget
若Linux系统中未安装wget,需要安装wget。wget是一个非交互的下载工具,参数 y 的作用是当安装过程中需要用户输入yes或no的时候,默认为yes。

yum -y install wget

4、下载阿里云repo文件。
进入repo目录,删除系统自带的repo文件。下载阿里云的repo文件,作为服务器的yum仓库配置文件。

[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# rm -rf *
[root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/aliyun.repo http://mirrors.aliyun.com/repo/Centos-7.repo
--2020-05-31 00:00:52--  http://mirrors.aliyun.com/repo/Centos-7.repo
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 218.67.61.95, 218.67.61.32, 61.131.39.13, ...
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|218.67.61.95|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2523 (2.5K) [application/octet-stream]
Saving to:/etc/yum.repos.d/aliyun.repo’

100%[====================================================================================
  • 8
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值