CentOS 的 YUM 與 DNF(qbit)

名詞解釋

  • Yum
Yellow dog Updater, Modified
  • DNF
DaNdiFied Yum

CentOS7 更換 Yum 源

  • 備份
mkdir /etc/yum.repos.d/backup
mv /etc/yum.repos.d/*.* /etc/yum.repos.d/backup
  • 下載(阿里雲 Yum 源)
curl -o /etc/yum.repos.d/CentOS7-Aliyun.repo http://mirrors.aliyun.com/repo/Centos-7.repo
curl -o /etc/yum.repos.d/epel-7-Aliyun.repo http://mirrors.aliyun.com/repo/epel-7.repo
  • 更新緩存
yum clean all && yum makecache

CentOS8 更換 Yum 源

  • 備份
mkdir /etc/yum.repos.d/backup
mv /etc/yum.repos.d/*.* /etc/yum.repos.d/backup
  • 下載(阿里雲 Yum 源)
curl -o /etc/yum.repos.d/CentOS8-Aliyun.repo http://mirrors.aliyun.com/repo/Centos-8.repo
  • 更新緩存
yum clean all && yum makecache
  • 安裝 epel
yum install epel-release -y
  • 替換 epel 文件中的 url(可選)
sed -i 's|^#baseurl=https://download.fedoraproject.org/pub|baseurl=https://mirrors.aliyun.com|' /etc/yum.repos.d/epel*
sed -i 's|^metalink|#metalink|' /etc/yum.repos.d/epel*
  • 查看 epel
$ sudo yum repolist epel
Repository AppStream is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository PowerTools is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
repo id    repo name                                         status
epel       Extra Packages for Enterprise Linux 8 - x86_64    enabled
  • 安裝 htop 測試(htop 在 epel 裏面)
sudo yum install htop
本文出自 qbit snap
相關文章
相關標籤/搜索