CentOS 的 YUM 与 DNF(qbit)

发布于:2023-03-12 ⋅ 阅读:(113) ⋅ 点赞:(0)

名词解释

  • 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