LINUX 国内源以及镜像源更换方法(linux更改镜像源)
qiyuwang 2025-05-08 20:56 1 浏览 0 评论
一、LINUX镜像源网站
在国内使用 Linux 系统的用户,通常会选择国内的镜像源以提高软件包下载速度和更新速度。以下是一些常用的国内 Linux 发行版镜像源,覆盖了 Ubuntu、Debian、CentOS、Fedora 等流行发行版。
1. Ubuntu 镜像源
清华大学开源软件镜像站
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
阿里云
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
2. Debian 镜像源
清华大学开源软件镜像站
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ stable main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ stable-updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ stable-backports main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security stable-security main contrib non-free
阿里云
deb http://mirrors.aliyun.com/debian/ stable main contrib non-free
deb http://mirrors.aliyun.com/debian/ stable-updates main contrib non-free
deb http://mirrors.aliyun.com/debian/ stable-backports main contrib non-free
deb http://mirrors.aliyun.com/debian-security stable-security main contrib non-free
3. CentOS 镜像源
清华大学开源软件镜像站
[base]
name=CentOS-$releasever - Base
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[updates]
name=CentOS-$releasever - Updates
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
阿里云
[base]
name=CentOS-$releasever - Base
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[updates]
name=CentOS-$releasever - Updates
baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
4. Fedora 镜像源
清华大学开源软件镜像站
[fedora]
name=Fedora $releasever - $basearch
baseurl=https://mirrors.tuna.tsinghua.edu.cn/fedora/releases/$releasever/Everything/$basearch/os/
enabled=1
gpgcheck=1
gpgkey=https://mirrors.tuna.tsinghua.edu.cn/fedora/releases/$releasever/Everything/$basearch/os/RPM-GPG-KEY-fedora-$releasever-$basearch
阿里云
[fedora]
name=Fedora $releasever - $basearch
baseurl=http://mirrors.aliyun.com/fedora/releases/$releasever/Everything/$basearch/os/
enabled=1
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/fedora/releases/$releasever/Everything/$basearch/os/RPM-GPG-KEY-fedora-$releasever-$basearch
小结
在选择镜像源时,建议根据地理位置和网络状况选择距离最近、速度最快的镜像源。此外,定期检查和更新软件源非常重要,以确保系统的安全性和稳定性。通过使用国内的镜像源,用户可以显著提升软件更新和安装的速度。 替换 Linux 系统的镜像源可以优化软件包管理的速度和效率。下面将介绍如何在几个流行的 Linux 发行版中替换镜像源。
二、镜像源替换方法
1. Ubuntu 源替换
步骤
- 备份原有源列表 在终端中输入以下命令,将原有的 sources.list 文件进行备份:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
- 编辑源列表 使用文本编辑器打开 sources.list 文件:
sudo nano /etc/apt/sources.list
- 替换源地址 删除文件中原有的内容,然后将选择好的国内源(如清华源或阿里云源)粘贴到文件中。
- 更新软件包索引 保存并关闭文件后,更新软件包索引:
sudo apt update
2. Debian 源替换
步骤
- 备份原有源列表
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
- 编辑源列表
sudo nano /etc/apt/sources.list
- 替换源地址 将选择好的国内源地址复制粘贴到文件中。
- 更新软件包索引
sudo apt update
3. CentOS 源替换
步骤
- 备份原有源文件 CentOS 的源文件通常位于 /etc/yum.repos.d/ 目录下,建议备份整个目录:
sudo cp -r /etc/yum.repos.d/ /etc/yum.repos.d.backup/
- 下载新的 repo 文件 用 curl 或 wget 下载新的 repo 文件。例如,使用清华源:
sudo curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.tuna.tsinghua.edu.cn/repo/Centos-Base.repo
- 更新软件包索引
sudo yum makecache
4. Fedora 源替换
步骤
- 备份原有源文件
sudo cp -r /etc/yum.repos.d/ /etc/yum.repos.d.backup/
- 编辑或替换 repo 文件 可以通过下载新的 repo 文件或手动编辑 .repo 文件。例如:
sudo nano /etc/yum.repos.d/fedora.repo
- 替换源地址 将新的源地址粘贴到 repo 文件中。
- 更新软件包索引
sudo dnf makecache
注意事项
- 网络环境:确保在网络环境稳定的情况下进行源替换,以免中途失败导致源文件损坏。
- 备份:始终做好备份,以便在出现问题时可以快速恢复。
- 使用合适的编辑器:针对不同的终端,可以选择适合的文本编辑器,如 nano、vim、gedit 等。
通过以上步骤,用户可以顺利地将系统的源替换为国内的镜像源,提升包管理的速度和效率。
相关推荐
- centos7使用yum安装nginx+php7+mysql5.6
-
本文主要介绍安装在centos7下如何安装nginx+php+mysql的环境,centos7的版本自带安装源的版本无法实现PHP5.4以上的版本,数据库默认用的是mariadb,文章介绍的安装是如何...
- Linux基础入门(VMWare中CentOS7配置yum)
-
上一章节,介绍了《Linux基础入门(CentOS7下通过命令行配置网络)》,本章将介绍如何配置yum源,方便后续在学习和使用的过程中,对所需工具的安装;...
- CentOS 7搭建Nextcloud私有云(centos搭建云盘)
-
Nextcloud简介:对于私人网盘,其中最出名的就是seafile、owncloud和nextcloud。seafile是国人开发的,有免费和企业版,免费的功能有限;nextcloud是owncl...
- 分享一个docker镜像源地址,解决docker不能拉取的问题
-
自己搭建的代理,centos7只需要修改/etc/docker/daemon.json并输入以下内容:{"registry-mirrors":["https://next...
- 源支付5.18版全套开源源码客户端+云端+监控+协议三网免挂免输入
-
源支付5.18最新版协议去授权全套三端开源源码_客户端+云端+监控+协议三网免挂免输入(全套版)推荐系统为:CentOS7.6Linux系统环境:Nginx1.20.1+MySQL5.6....
- centos7飞速搭建zabbix5.0并添加windows、linux监控
-
一、环境zabbix所在服务器系统为centos7,监控的服务器为windows2016和centos7。二、安装zabbix官方安装帮助页面...
- CentOS上配置 Docker 使用代理服务器
-
hub.docker最近总被墙,国内大厂搞的docker镜像源代理被封被停,对于一个严重依赖一些海外项目的软件开发人员,简直没法干活了。docker要在CentOS上配置Docker使用代理服...
- CentOS 7 (阿里云虚拟机) 安装 Docker
-
一、安装Docker1.使用root权限登录CentOS。确保yum包更新到最新sudoyumupdate...
- Centos离线静默安装 oracle11g,步骤细验证成功
-
一、环境要求1.1.涉及工具及环境1)CentOS764位系统2)oracle安装包文件a)linux.x64_11gR2_database_1of2.zip...
- Linux运维之制作指定软件包的YUM源
-
#挑战30天在头条写日记#关注我,不迷路,大家好,我是大王。--记录运维中遇到的故障及排查方法...
- 在CentOS 9 安装Nvidia显卡驱动详细操作步骤
-
今天给粉丝网友演示CentOS9系统下如何安装nvidia显卡驱动。·将下载好的显卡驱动放到文件夹中,这里以download为例,放入文件夹中开始对系统软件升级,是为了防止在安装显卡驱动时显示报错...
- 基于Linux系统的本地Yum源搭建与配置(ISO方式、RPM方式)
-
前言:由于公司业务服务器大部分都在内网环境下运行,内网环境无法直接使用yum安装升级更新软件,所以需要自建Yum源来满足目前日常工作需要。...
- 最新zabbix一键安装脚本(基于centos8)
-
一、环境准备注意:操作系统必须是centos8及以上的,因为我配的安装源是centos8的。并且必须连接互联网,脚本是基于yum安装的!!!...
- CentOS7中使用yum安装Nginx的方法
-
1、添加源 默认情况Centos7中无Nginx的源,最近发现Nginx官网提供了Centos的源地址。因此可以如下执行命令添加源(...
- Centos8出现Failed to download metadata for repo 'AppStream'解决
-
大家都知道Centos8于2021年年底停止了服务,大家再在使用yum源安装时候,出现下面错误“错误:Failedtodownloadmetadataforrepo'AppStre...
你 发表评论:
欢迎- 一周热门
- 最近发表
-
- centos7使用yum安装nginx+php7+mysql5.6
- Linux基础入门(VMWare中CentOS7配置yum)
- CentOS 7搭建Nextcloud私有云(centos搭建云盘)
- 分享一个docker镜像源地址,解决docker不能拉取的问题
- 源支付5.18版全套开源源码客户端+云端+监控+协议三网免挂免输入
- centos7飞速搭建zabbix5.0并添加windows、linux监控
- CentOS上配置 Docker 使用代理服务器
- CentOS 7 (阿里云虚拟机) 安装 Docker
- Centos离线静默安装 oracle11g,步骤细验证成功
- Linux运维之制作指定软件包的YUM源
- 标签列表
-
- navicat无法连接mysql服务器 (65)
- 下横线怎么打 (71)
- flash插件怎么安装 (60)
- lol体验服怎么进 (66)
- ae插件怎么安装 (62)
- yum卸载 (75)
- .key文件 (63)
- cad一打开就致命错误是怎么回事 (61)
- rpm文件怎么安装 (66)
- linux取消挂载 (81)
- ie代理配置错误 (61)
- ajax error (67)
- centos7 重启网络 (67)
- centos6下载 (58)
- mysql 外网访问权限 (69)
- centos查看内核版本 (61)
- ps错误16 (66)
- nodejs读取json文件 (64)
- centos7 1810 (59)
- 加载com加载项时运行错误 (67)
- php打乱数组顺序 (68)
- cad安装失败怎么解决 (58)
- 因文件头错误而不能打开怎么解决 (68)
- js判断字符串为空 (62)
- centos查看端口 (64)