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/
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
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
(图片可放大查看)
(图片可放大查看)
(图片可放大查看)
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
(图片可放大查看)
(图片可放大查看)
(图片可放大查看)
本文分享自 WalkingCloud 微信公众号,前往查看
如有侵权,请联系 cloudcommunity@tencent.com 删除。
本文参与 腾讯云自媒体同步曝光计划 ,欢迎热爱写作的你一起参与!