原文: Fedora 21 中添加及更新源的命令
fedora的软件源信息文件(*.repo)都是放在 /etc/yum.repos.d 目录下的。可以通过# ls -l /etc/yum.repos.d 查看,因为默认的软件源都是国外的,可能网速不是很快,我们可以自己添加国内软件源和本地软件源。
cd /etc/yum.repos.d sudo wget http://mirrors.163.com/.help/fedora-163.repo sudo wget http://mirrors.163.com/.help/fedora-updates-163.repo
sudo wget http://mirrors.sohu.com/help/fedora-sohu.repo sudo wget http://mirrors.sohu.com/help/fedora-updates-sohu.repo
sudo wget http://lug.ustc.edu.cn/wiki/_export/code/mirrors/help/fedora?codeblock=0 sudo wget http://lug.ustc.edu.cn/wiki/_export/code/mirrors/help/fedora?codeblock=1
刷新缓存
sudo yum makecache
有插件可以自动选择最快的源
sudo yum install yum-fastestmirror
sudo yum install yum-axelget #是Yum的一个插件,主要用axel来加速下载
以上分别是网易、搜狐、中国科大的镜像源,wget是下载命令,也可以图形化界面下进入镜像站点(例如mirrors.sohu.com点fedora后面的help)按说明下载repo文件放到那个文件夹下。
如果yum时出现类似Repository fedora is listed more than once in the configuration的警告, 已163源为例, 重命名红色字
vim /etc/yum.repos.d/fedora-163.repo
[fedora-163] name=Fedora $releasever - $basearch - 163.com failovermethod=priority baseurl=http://mirrors.163.com/fedora/releases/$releasever/Everything/$basearch/os/ mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch enabled=1 metadata_expire=7d gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch [fedora-debuginfo-163] name=Fedora $releasever - $basearch - Debug - 163.com failovermethod=priority baseurl=http://mirrors.163.com/fedora/releases/$releasever/Everything/$basearch/debug/ mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-debug-$releasever&arch=$basearch enabled=0 metadata_expire=7d gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch [fedora-source-163] name=Fedora $releasever - Source - 163.com failovermethod=priority baseurl=http://mirrors.163.com/fedora/releases/$releasever/Everything/source/SRPMS/ mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-source-$releasever&arch=$basearch enabled=0 metadata_expire=7d gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch