一、為啥要更改yum源
1、Centos 8官方已于2021年12月31日以后停止Centos 8支持、轉(zhuǎn)至Centos 8 Stream項目支持2021年12月31日以后,CentOS Linux 8的使用者將無法獲得包括問題修復(fù)和功能更新在內(nèi)的任何軟件維護(hù)和支持。
2、Centos Stream 是一個面向開發(fā)者的滾動發(fā)布的 Linux 發(fā)行版,CentOS Streams 可以當(dāng)成是用來體驗最新紅帽系 Linux 特性的一個版本。
3、因此,你追求穩(wěn)定性,或者個人日常使用,都更推薦使用傳統(tǒng)的 CentOS Linux 這個版本。
4、官方渠道已經(jīng)停止了CentOS8的下載,只有CentOS8-stream,我們可以去清華大學(xué)開源軟件鏡像站下載centos-vault版本
https://mirrors.tuna.tsinghua.edu.cn/centos-vault/
?
?
?
?二、系統(tǒng)安裝完成后,準(zhǔn)備修改yum源
1、確保網(wǎng)絡(luò)可以連接外網(wǎng)
ping -c 4 baidu.com
?2、更改yum源為清華源
[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 8.4.2105
[root@localhost ~]#
[root@localhost ~]# minorver=8.4.2105
[root@localhost ~]#
[root@localhost ~]# sudo sed -e "s|^mirrorlist=|#mirrorlist=|g" -e "s|^#baseurl=http://mirror.centos.org/\$contentdir/\$releasever|baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/$minorver|g" -i.bak /etc/yum.repos.d/CentOS-*.repo
[root@localhost ~]#
查看系統(tǒng)版本號?8.4.2105
minorver=8.4.2105 將系統(tǒng)版本號作為下條命令的變量值
修改yum源地址
sudo sed -e "s|^mirrorlist=|#mirrorlist=|g" -e "s|^#baseurl=http://mirror.centos.org/\$contentdir/\$releasever|baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/$minorver|g" -i.bak /etc/yum.repos.d/CentOS-*.repo
3、測試yum源是否可用文章來源:http://www.zghlxwxcb.cn/news/detail-529479.html
[root@localhost ~]# yum clean all
18 文件已刪除
[root@localhost ~]# yum makecache
CentOS Linux 8 - AppStream 6.0 MB/s | 9.6 MB 00:01
CentOS Linux 8 - BaseOS 7.2 MB/s | 8.5 MB 00:01
CentOS Linux 8 - Extras 23 kB/s | 10 kB 00:00
元數(shù)據(jù)緩存已建立。
[root@localhost ~]#
[root@localhost ~]# yum repolist
倉庫 id 倉庫名稱
appstream CentOS Linux 8 - AppStream
baseos CentOS Linux 8 - BaseOS
extras CentOS Linux 8 - Extras
[root@localhost ~]#
元數(shù)據(jù)緩存已建立。證明yum源配置正確,顯示的倉庫id表示yum源可正常使用文章來源地址http://www.zghlxwxcb.cn/news/detail-529479.html
到了這里,關(guān)于CentOS-8.4系統(tǒng)配置國內(nèi)清華鏡像站yum源的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!