虽然目前的linux已经能自动选择最快的源,但是官方提供的镜像列表仍然较少,速度虽有所提升但是整体依然较慢,阿里的源作为国内最快的源却没有被纳入官方提供的源中
国内常使用的源有阿里,中科大,清华,网易源,其中阿里的速度最快,中科大的收录软件最多,其他基本没有什么区别,所以只用这俩个国内源就可以了,没有必要添加太多的源
一 配置阿里源
1 首先备份官方自带的源
cd /etc/yum.repos.d
sudo mv fedora.repo fedora.repo.backup
sudo mv fedora-updates.repo fedora-updates.repo.backup
2 下载阿里源
sudo wget http://mirrors.aliyun.com/repo/fedora.repo
sudo wget http://mirrors.aliyun.com/repo/fedora-updates.repo
3 更新缓存
sudo dnf makecache
到此即可使用阿里源
二 配置科大源
科大的源的配置在官网上有很详细的介绍http://mirrors.ustc.edu.cn/help/
这里就简单搬运一下
将下面的内容复制保存为fedora-ustc.repo并移动到/etc/yum.repos.d/
[fedora-ustc] name=Fedora $releasever - $basearch - ustc failovermethod=priority baseurl=https://mirrors.ustc.edu.cn/fedora/releases/$releasever/Everything/$basearch/os/ #metalink=https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch enabled=1 metadata_expire=7d repo_gpgcheck=0 type=rpm gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch skip_if_unavailable=False [fedora-ustc-debuginfo] name=Fedora $releasever - $basearch - Debug - ustc failovermethod=priority baseurl=https://mirrors.ustc.edu.cn/fedora/releases/$releasever/Everything/$basearch/debug/tree/ #metalink=https://mirrors.fedoraproject.org/metalink?repo=fedora-debug-$releasever&arch=$basearch enabled=0 metadata_expire=7d repo_gpgcheck=0 type=rpm gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch skip_if_unavailable=False [fedora-ustc-csource] name=Fedora $releasever - Source - ustc failovermethod=priority baseurl=https://mirrors.ustc.edu.cn/fedora/releases/$releasever/Everything/source/tree/ #metalink=https://mirrors.fedoraproject.org/metalink?repo=fedora-source-$releasever&arch=$basearch enabled=0 metadata_expire=7d repo_gpgcheck=0 type=rpm gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch skip_if_unavailable=False
将下面内容复制保存为fedora-ustc-updates.repo并移动到/etc/yum.repos.d/
[updates-ustc] name=Fedora $releasever - $basearch - Updates - ustc failovermethod=priority baseurl=https://mirrors.ustc.edu.cn/fedora/updates/$releasever/$basearch/ #metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-released-f$releasever&arch=$basearch enabled=1 repo_gpgcheck=0 type=rpm gpgcheck=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch skip_if_unavailable=False [updates-ustc-debuginfo] name=Fedora $releasever - $basearch - Updates - Debug - ustc failovermethod=priority baseurl=https://mirrors.ustc.edu.cn/fedora/updates/$releasever/Everything/$basearch/debug/tree/ #metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-released-debug-f$releasever&arch=$basearch enabled=0 repo_gpgcheck=0 type=rpm gpgcheck=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch skip_if_unavailable=False [updates-ustc-source] name=Fedora $releasever - Updates Source - ustc failovermethod=priority baseurl=https://mirrors.ustc.edu.cn/fedora/updates/$releasever/Everything/source/tree/ #metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-released-source-f$releasever&arch=$basearch enabled=0 repo_gpgcheck=0 type=rpm gpgcheck=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch skip_if_unavailable=False
最后执行一下
sudo dnf makecache
到此即可使用中科大源
三 使用rpmfusion(第三方仓库)
sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
更新一下就可以使用红帽系最大的第三方软件仓库
sudo dnf update