CentOS管理软件仓库可使用以下方法:
yum-config-manager --add-repo <仓库URL>
命令,如yum-config-manager --add-repo http://mirrors.aliyun.com/repo/Centos-8.repo
。也可将仓库的.repo
文件放到/etc/yum.repos.d/
目录下。/etc/yum.repos.d/
下的.repo
文件,设置baseurl
为本地路径。dnf repolist
(CentOS 8)或yum repolist
(CentOS 7)查看已启用的仓库。yum-config-manager --enable <仓库名>
或yum-config-manager --disable <仓库名>
。dnf clean all
或yum clean all
清理所有缓存。dnf makecache
或yum makecache
生成缓存,加快软件包安装和更新速度。