1. 程式人生 > >ubuntu 更新軟體源

ubuntu 更新軟體源

首先編輯軟體源配置檔案sources.list

nano命令
nano 檔名:開啟或新建檔案
儲存: ^O = Ctrl + O
離開 : ^X = Ctrl + X

sudo nano /etc/apt/sources.list

用#註釋掉原先的內容,然後新增清華 TUNA 的軟體源映象

根據ubuntu版本選擇對應映象源,獲取ubuntu版本:

[email protected]:~$ cat /etc/issue```

ubuntu 18.04 LTS

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse

然後Ctrl+X,Y,確認

更新軟體源:

sudo apt-get update
[email protected]:~$ sudo apt-get update
命中:1 http://mirrors.shu.edu.cn/ubuntu bionic InRelease
獲取:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic InRelease [242 kB]
獲取:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates InRelease [88.7 kB]
獲取:4 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-backports InRelease [74.6 kB]
獲取:5 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-security InRelease [83.2 kB]
......
獲取:71 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-security/multiverse i386 Packages [1,608 B]
獲取:72 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-security/multiverse Translation-en [996 B]
已下載 45.4 MB,耗時 7秒 (6,865 kB/s)                             
正在讀取軟體包列表... 完成

此步驟之前我還把sources.list.d資料夾內的檔案(PPA)刪除了,不知道有沒有用

sudo rm 檔名