介紹
yum-config-manager命令是對資源庫(/etc/yum.repos.d/下的文件)進行增刪改查
系統默認沒有安裝這個命令,這個命令在yum-utils包里,可以通過yum install -y yum-utils安裝
查詢倉庫內容
查詢所有資源庫
# yum repolist all
查詢已啟用的資源庫
# yum repolist enabled
查詢禁用的資源庫
# yum repolist disabled
添加資源庫
# yum-config-manager --add-repo repository_url
# yum-config-manager --add-repo https://mirrors.tuna.tsinghua.edu.cn/centos/8/BaseOS/x86_64/os/
啟用資源庫
# yum-config-manager --enable itemName
禁用資源庫
# yum-config-manager --disable itemName
或者直接編輯/etc/yum.repos.d/下對應資源庫文件
enabled=0
刪除資源庫
在/etc/yum.repos.d/下手動刪除對應repo文件即可,這會使得該庫中所有信息被刪除