Fedora添加国内源

  • 1. 下载配置文件
// 阿里源
root# curl -o /etc/yum.repos.d/fedora.repo http://mirrors.aliyun.com/repo/fedora.repo/repo/fedora.repo
root# curl -o /etc/yum.repos.d/fedora-updates.repo http://mirrors.aliyun.com/repo/fedora-updates.repo
// 清华源
root# curl -o /etc/yum.repos.d/fedora-tuna.repo https://mirrors.tuna.tsinghua.edu.cn/repo/fedora.repo
root# curl -o /etc/yum.repos.d/fedora-updates-tuna.repo https://mirrors.tuna.tsinghua.edu.cn/repo/fedora-updates.repo
  • 2. 修改配置
/*
源的名字不能重名不然只会显示一个,列如[fedora],[fedora]俩个源只显示一个要修改其中一个名字
*/
/*
  阿里云官方配置文档 https://opsx.alibaba.com/mirror 找到Fedora 后面的帮助
*/
// 在后面加上-opsx
root# vi fedora-opsx.repo
[fedora-opsx]
name=Fedora $releasever - $basearch - aliyun
failovermethod=priority
baseurl=http://mirrors.aliyun.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-opsx]
name=Fedora $releasever - $basearch - Debug - aliyun
failovermethod=priority
baseurl=http://mirrors.aliyun.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-opsx]
name=Fedora $releasever - Source - aliyun
failovermethod=priority
baseurl=http://mirrors.aliyun.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

// 修改updates 官方的update有问题,需要加上/Everything
root# vi fedora-updates-opsx.repo
[updates-opsx]
name=Fedora $releasever - $basearch - Updates - aliyun
failovermethod=priority
baseurl=http://mirrors.aliyun.com/fedora/updates/$releasever/Everything/$basearch/
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-released-f$releasever&arch=$basearch
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch

[updates-debuginfo-opsx]
name=Fedora $releasever - $basearch - Updates - Debug -aliyun
failovermethod=priority
baseurl=http://mirrors.aliyun.com/fedora/updates/$releasever/Everything/$basearch/debug/
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-released-debug-f$releasever&arch=$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch

[updates-source-opsx]
name=Fedora $releasever - Updates Source - aliyun
failovermethod=priority
baseurl=http://mirrors.aliyun.com/fedora/updates/$releasever/Everything/SRPMS/
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-released-source-f$releasever&arch=$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch


/*
清华配置有官方文档,地址 https://mirrors.tuna.tsinghua.edu.cn/help/fedora/
*/
// 给清华源添加名字
root# vi fedora-tuna.repo
[fedora-tuna]
name=Fedora $releasever - $basearch - thu
failovermethod=priority
baseurl=https://mirrors.tuna.tsinghua.edu.cn/fedora/releases/$releasever/Everything/$basearch/os/
metadata_expire=28d
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=False

// 修改updates
root# vi fedora-updates-tuna.repo
[updates-tuna]
name=Fedora $releasever - $basearch - Updates - thu
failovermethod=priority
baseurl=https://mirrors.tuna.tsinghua.edu.cn/fedora/updates/$releasever/Everything/$basearch/
enabled=1
gpgcheck=1
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=False
  • 3. 更新配置
/*
上面看到你源名字,就代表添加成功,但是有的会显示禁用状态(网上说是源没有这个版本的包)
*/
root# dnf repolist all

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值