站长视角
用户至上

国内小众云主机Debian系统更换软件源镜像以优化下载速度

国内如腾讯云、阿里云、华为云这些大型的云主机商家一般不存在此问题,但是一些比较小众的国内云主机经常会遇到的问题,如下载更新软件速度慢。如果预装系统没有根据位置选择合适软件源镜像,建议手动修改 Debian 软件源镜像以加快速度。本文将指导新手用户更换软件源,希望对用户有所帮助。

国内小众云主机Debian系统更换软件源镜像以优化下载速度

国内 Debian 软件源镜像

列出几个常用国内 Debian 软件源镜像。点此可查看完整镜像节点。

镜像节点 镜像地址
Debian http://ftp.cn.debian.org/debian/
阿里云 http://mirrors.aliyun.com/debian/
华为云 http://mirrors.aliyun.com/debian/
网易 http://mirrors.163.com/debian/
清华大学 http://mirrors.tuna.tsinghua.edu.cn/debian/
中国科大 http://mirrors.ustc.edu.cn/debian/
兰州大学 http://mirror.lzu.edu.cn/debian/

更换 Debian 软件源镜像

在操作前,先重命名备份软件源配置文件,以便在需要时可以还原。

mv /etc/apt/sources.list /etc/apt/sources.list.bak

创建新的配置文件。

vi /etc/apt/sources.list

内容如下(通常只需按需修改其中发行版代号和镜像地址,详细查看后面备注介绍)。

deb http://ftp.cn.debian.org/debian/ buster main contrib non-free
deb-src http://ftp.cn.debian.org/debian/ buster main contrib non-free

deb http://ftp.cn.debian.org/debian-security/ buster/updates main contrib non-free
deb-src http://ftp.cn.debian.org/debian-security/ buster/updates main contrib non-free

deb http://ftp.cn.debian.org/debian/ buster-updates main contrib non-free
deb-src http://ftp.cn.debian.org/debian/ buster-updates main contrib non-free

deb http://ftp.cn.debian.org/debian/ buster-backports main contrib non-free
deb-src http://ftp.cn.debian.org/debian/ buster-backports main contrib non-free

逐个介绍配置内容里的参数含义:

  • deb:二进制软件包;
  • deb-src:源代码软件包;
  • 网址:软件包镜像地址;
  • 发行版代号:适用对应发行版的软件包,可用 lsb_release -c 命令查询代号名称;
  • 发行版代号跟随参数:软件包类型(xxxxx/updates 安全错误更新,xxxxx-updates 普通维护更新,xxxxx-backports 向后移植软件包,将较新软件补丁移植到旧版软件上);
  • main:遵循 DFSG 标准的自由软件;
  • contrib:遵循 DFSG 标准的自由软件,但存在 non-free 依赖;
  • non-free:不符合 DFSG 标准的软件;

更新配置文件后重建软件包索引生效。

apt-get update

如果你用的是 https 软件源镜像地址,那么需要确保已安装下面两个软件。

apt-get install apt-transport-https ca-certificates
赞(0)
版权声明:本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权, 转载请注明出处。
文章名称:《国内小众云主机Debian系统更换软件源镜像以优化下载速度》
文章链接:https://www.sshce.com/19450.html
【声明】:国外主机测评仅分享信息,不参与任何交易,也非中介,所有内容仅代表个人观点,均不作直接、间接、法定、约定的保证,读者购买风险自担。一旦您访问国外主机测评,即表示您已经知晓并接受了此声明通告。
【关于安全】:任何 IDC商家都有倒闭和跑路的可能,备份永远是最佳选择,服务器也是机器,不勤备份是对自己极不负责的表现,请保持良好的备份习惯。
香港110M(含10M CN2)大带宽独服限量促销,香港E3-8G-1T硬盘-3IP,月付仅799!

登录

找回密码

注册