Debian 9:设置网络源,更换镜像源,配置apt-get源,解决下载软件慢

前言

Debian使用国外镜像源,在国内使用会造成更新软件慢或者找不到等问题,装完系统,应对软件源进行设置,改为国内源,下载速度就变快。

阿里源:

  1. 打开站点 https://opsx.alibaba.com/mirror
  2. 找到debian相关内容,点开右边debian使用帮助页面
  3. 复制源地址到剪切板
# debian 7.x (wheezy)
deb http://mirrors.aliyun.com/debian/ wheezy main non-free contrib
deb http://mirrors.aliyun.com/debian/ wheezy-proposed-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ wheezy main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ wheezy-proposed-updates main non-free contrib

# debian 8.x (jessie)
deb http://mirrors.aliyun.com/debian/ jessie main non-free contrib
deb http://mirrors.aliyun.com/debian/ jessie-proposed-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ jessie main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ jessie-proposed-updates main non-free contrib

# debian 9.x (stretch)
deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb http://mirrors.aliyun.com/debian-security stretch/updates main
deb-src http://mirrors.aliyun.com/debian-security stretch/updates main
deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib

163源:

  1. 打开站点 http://mirrors.163.com/.help/debian.html
  2. 复制源地址到剪切板
# 以Jessie为例
deb http://mirrors.163.com/debian/ jessie main non-free contrib
deb http://mirrors.163.com/debian/ jessie-updates main non-free contrib
deb http://mirrors.163.com/debian/ jessie-backports main non-free contrib
deb-src http://mirrors.163.com/debian/ jessie main non-free contrib
deb-src http://mirrors.163.com/debian/ jessie-updates main non-free contrib
deb-src http://mirrors.163.com/debian/ jessie-backports main non-free contrib
deb http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib
deb-src http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib
  • debian 6.x (squeeze)
  • debian 7.x (wheezy)
  • debian 8.x (jessie)
  • debian 9.x (stretch)
    需要哪个系统的则自行替换对应版本

操作步骤

以阿里源为例子,自行替换所属源

  • 设置源
# 切换到root权限下
cp /etc/apt/sources.list /etc/apt/sources.list.bak # 备份原有文件
# 打开文件编辑
vi /etc/apt/sources.list

# 替换内容为刚才复制的内容
deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb http://mirrors.aliyun.com/debian-security stretch/updates main
deb-src http://mirrors.aliyun.com/debian-security stretch/updates main
deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
# 保存并退出
  • 更新操作
# 配置好之后更新软件包列表
apt-get update
# 升级系统所有软件
apt-get upgrade
# 升级系统版本
apt-get dist-upgrade

忠告

不要同时配置多个源,同一仓库的源启用一个即可,否则容易引起混乱。

附: Debian 全球镜像站 https://www.debian.org/mirror/list

你可能感兴趣的:(Linux)