栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

Linux---配置国内yum源

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Linux---配置国内yum源

常见两种方式

网络yum源一般是指163、搜狐、阿里、中国科技大学等公共的网络yum源,或者是自建的局域网yum仓库。配置网络yum源有2种方式:

  • 一种是直接下载官方的yum配置文件替换到本地
  • 另一种是修改本地的yum配置文件中的baseurl地址
一、 下载公共网络yum源文件
  1. 下载前要确定自己系统版本:
cat /etc/system-release

  1. 这里我们将原yum配置文件移动到自定义的目录下进行一个简单的备份,如果出现意外后也可以及时回滚
mv /etc/yum.repos.d/CentOS-base.repo /home/chihai/backup/yum/
  1. 下载镜像文件
wget http://mirrors.aliyun.com/repo/Centos-8.repo


4.清除yum缓存、刷新yum缓存

yum clean all
yum makecache

二、手动配置yum源文件

vim /etc/yum.repos.d/CentOS8.repo
切记依然需要清除喝刷新缓存

```bash
1 [baseOS]
 2 name=baseOS
 3 baseurl=https://mirrors.aliyun.com/centos/8/baseOS/x86_64/os/
 4         https://mirrors.huaweicloud.com/centos/8/baseOS/x86_64/os/
 5         https://mirrors.163.com/centos/8/baseOS/x86_64/os/
 6 gpgcheck=1
 7 gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official
 8 
 9 [AppStream]
10 name=AppStream
11 baseurl=https://mirrors.aliyun.com/centos/8/AppStream/x86_64/os/
12         https://mirrors.huaweicloud.com/centos/8/AppStream/x86_64/os/
13         https://mirrors.163.com/centos/8/AppStream/x86_64/os/
14 gpgcheck=1
15 gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official
16 
17 
18 [epel]
19 name=epel
20 baseurl=https://mirrors.aliyun.com/epel/8/Everything/x86_64/
21 gpgcheck=1
22 gpgkey=https://mirrors.aliyun.com/epel/RPM-GPG-KEY-EPEL-8
23 
24 [extras]
25 name=extras
26 baseurl=https://mirrors.aliyun.com/centos/8/extras/x86_64/os/
27 gpgcheck=1
28 gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/510722.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号