几种常用Linux系统的软件镜像源配置

简介: 几种常用Linux系统的软件镜像源配置

image.jpeg

几种常用Linux系统的软件镜像源配置


1、CentOS6系统的软件镜像源配置


CentOS 6操作系统版本结束了生命周期(EOL),Linux社区已不再维护该操作系统版本。


image.png



2020年11月30日CentOS 6 EOL 按照社区规则,CentOS 6的源地址http://mirror.centos.org/centos-6/内容已移除,目前第三方的镜像站中均已移除CentOS 6的源。

640.png


不过目前测试可以继续使用腾讯云软件镜像站中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


640.jpg

640.jpg


640.jpg

640.jpg

如果要用aliyun镜像站,可以参考如下文档 https://help.aliyun.com/document_detail/193569.html  

阿里云的源http://mirrors.cloud.aliyuncs.comhttp://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/


640.png


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


640.jpg

640.jpg

当然你也可以使用阿里云镜像站中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


640.jpg

apt-get clean all
apt-get update

image.jpeg


640.jpg


640.jpg


4、Fedora33系统的软件镜像源配置


Fedora 33


cd /etc/yum.repos.d/
mkdir /etc/yum_repo_default_bak
mv *.repo /etc/yum_repo_default_bak/


640.jpg

#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

640.jpg

dnf clean all 
dnf makecache

640.jpg640.jpg640.jpg

相关文章
|
3天前
|
Ubuntu Linux 编译器
【Linux】详解动静态库的制作和使用&&动静态库在系统中的配置步骤
【Linux】详解动静态库的制作和使用&&动静态库在系统中的配置步骤
|
4天前
|
Linux Windows
虚拟机添加新硬盘之linux系统篇
虚拟机添加新硬盘之linux系统篇
11 1
|
5天前
|
负载均衡 Linux 应用服务中间件
Linux系统中前后端分离项目部署指南
Linux系统中前后端分离项目部署指南
|
1天前
|
Linux Perl
Linux系统的文本处理
Linux系统的文本处理
|
2天前
|
IDE Linux 开发工具
Linux 系统上安装
在Linux和Mac上安装Lua 5.3.0只需下载源码,解压,编译和安装。Windows用户可选择SciTE IDE或通过LuaForWindows在Github或Google Code下载安装。创建 HelloWorld.lua,使用`lua HelloWorld.lua`运行显示&quot;Hello World!&quot;。另可参考LuaDist官方推荐方式安装。
|
2天前
|
Linux API
Linux系统编程之文件编程常用API回顾和文件编程一般步骤
Linux系统编程之文件编程常用API回顾和文件编程一般步骤
Linux系统编程之文件编程常用API回顾和文件编程一般步骤
|
2天前
|
编解码 Ubuntu Linux
|
3天前
|
Linux
|
3天前
|
Linux
请问如何在Linux系统中删除一个磁盘分区
请问如何在Linux系统中删除一个磁盘分区
|
3天前
|
Linux
Linux系统的磁盘管理
Linux系统的磁盘管理