几种常用Linux系统的软件镜像源配置
1、CentOS6系统的软件镜像源配置
CentOS 6操作系统版本结束了生命周期(EOL),Linux社区已不再维护该操作系统版本。
2020年11月30日CentOS 6 EOL 按照社区规则,CentOS 6的源地址http://mirror.centos.org/centos-6/内容已移除,目前第三方的镜像站中均已移除CentOS 6的源。
不过目前测试可以继续使用腾讯云软件镜像站中CentOS6的软件镜像源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos6_base.repo wget -O /etc/yum.repos.d/epel.repo http://mirrors.cloud.tencent.com/repo/epel-6.repo
如果要用aliyun镜像站,可以参考如下文档 https://help.aliyun.com/document_detail/193569.html
阿里云的源http://mirrors.cloud.aliyuncs.com和http://mirrors.aliyun.com也无法同步到CentOS 6的源。当在阿里云上继续使用默认配置的CentOS 6的源会发生报错。
建议升级操作系统至CentOS 7及以上,如果业务过渡期仍需要使用CentOS 6系统中的一些安装包,可以通过以下步骤,在CentOS 6操作系统中将源配置按照网络环境不同进行切换。
1)专有网络VPC类型实例需切换为http://mirrors.cloud.aliyuncs.com/centos-vault/6.10/源。
2)经典网络类型实例需切换为http://mirrors.aliyuncs.com/centos-vault/6.10/源
3)EPEL源可以切换到http://mirrors.aliyun.com/epel-archive/6/
2、CentOS7系统的软件镜像源配置
CentOS7为目前主流的服务器操作系统
可以使用腾讯云软件镜像站中CentOS7的软件镜像源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos7_base.repo wget -O /etc/yum.repos.d/epel.repo http://mirrors.cloud.tencent.com/repo/epel-7.repo
当然你也可以使用阿里云镜像站中CentOS7的软件镜像源
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
3、Debian10系统的软件镜像源配置
Debian源的使用需要以root权限修改/etc/apt/sources.list配置文件,修改之前,请做好备份
debian10.x(buster)为例
vi /etc/apt/sources.list 其它行都注释掉,最下行新增如下行 deb https://mirrors.cloud.tencent.com/debian/ buster main contrib non-free deb https://mirrors.cloud.tencent.com/debian/ buster-updates main contrib non-free deb https://mirrors.cloud.tencent.com/debian/ buster-backports main contrib non-free deb https://mirrors.cloud.tencent.com/debian-security buster/updates main contrib non-free deb-src https://mirrors.cloud.tencent.com/debian/ buster main contrib non-free deb-src https://mirrors.cloud.tencent.com/debian/ buster-updates main contrib non-free deb-src https://mirrors.cloud.tencent.com/debian/ buster-backports main contrib non-free deb-src https://mirrors.cloud.tencent.com/debian-security buster/updates main contrib non-free
apt-get clean all apt-get update
4、Fedora33系统的软件镜像源配置
Fedora 33
cd /etc/yum.repos.d/ mkdir /etc/yum_repo_default_bak mv *.repo /etc/yum_repo_default_bak/
#Fedora 仓库
cat > /etc/yum.repos.d/fedora.repo << \EOF [fedora] name=Fedora $releasever - $basearch 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 EOF
#updates 仓库
cat > /etc/yum.repos.d/fedora-updates.repo << \EOF [updates] name=Fedora $releasever - $basearch - Updates 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 EOF
#fedora-modular 仓库
cat > /etc/yum.repos.d/fedora-modular.repo<< \EOF [fedora-modular] name=Fedora Modular $releasever - $basearch failovermethod=priority baseurl=https://mirrors.tuna.tsinghua.edu.cn/fedora/releases/$releasever/Modular/$basearch/os/ enabled=1 metadata_expire=7d gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch skip_if_unavailable=False EOF
#updates-modular 仓库 cat > /etc/yum.repos.d/fedora-updates-modular.repo << \EOF [updates-modular] name=Fedora Modular $releasever - $basearch - Updates failovermethod=priority baseurl=https://mirrors.tuna.tsinghua.edu.cn/fedora/updates/$releasever/Modular/$basearch/ enabled=1 gpgcheck=1 metadata_expire=6h gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch skip_if_unavailable=False EOF
dnf clean all dnf makecache