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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章