Linux配置YUM源(2021最新最詳細)


2021最新Linux系統發行版ContOS7演示配置YUM源。

簡介

CentOS,是基於 Red Hat Linux 提供的可自由使用源代碼的企業級 Linux 發行版本;是一個穩定,可預測,可管理和可復制的免費企業級計算平台。將yum源設置為國內 yum,可以提升軟件包安裝和更新的速度,同時避免一些常見軟件版本無法找到。

國內yum:阿里、網易163、中國科技大學、搜狐等。

配置方法

1. 備份

1 mv  /etc/yum.repos.d/CentOS-Base.repo  /home/xsge/downfiles

2. 下載新的 CentOS-Base.repo 到 /etc/yum.repos.d/

 1 CentOS 6
 2 
 3 wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-6.repo
 4 
 5 或者
 6 
 7 curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-6.repo
 8 
 9 CentOS 7
10 
11 wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
12 
13 或者
14 
15 curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
16 
17 CentOS 8
18 
19 wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo
20 
21 或者
22 
23 curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo

3. 運行 yum makecache 生成緩存

1 yum clean all
2 yum makecache

4. 其他

非阿里雲ECS用戶會出現 Couldn't resolve host 'mirrors.cloud.aliyuncs.com' 信息,不影響使用。用戶也可自行修改相關配置: eg:

1 sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM