- sudo apt update報錯
- sudo apt update
- 命中:1 http://packages.microsoft.com/repos/vscode stable InRelease
- 命中:2 http://ppa.launchpad.net/elementary-os/stable/ubuntu bionic InRelease
- 獲取:3 http://packages.elementary.io/appcenter bionic InRelease [5,894 B]
- 命中:4 http://ppa.launchpad.net/elementary-os/os-patches/ubuntu bionic InRelease
- 獲取:5 http://packages.elementary.io/appcenter bionic/main amd64 DEP-11 Metadata [93.6 kB]
- 命中:6 http://security.ubuntu.com/ubuntu bionic-security InRelease
- 錯誤:7 http://cn.archive.ubuntu.com/ubuntu bionic InRelease
- 無法發起與 cn.archive.ubuntu.com:80 (2001:67c:1562::19) 的連接 - connect (101: 網絡不可達)
- 無法發起與 cn.archive.ubuntu.com:80 (2001:67c:1562::16) 的連接 - connect (101: 網絡不可達)
- 無法連接上 cn.archive.ubuntu.com:80 (91.189.91.26),連接超時 無法連接上 cn.archive.ubuntu.com:80 (91.189.91.23),連接超時 [IP: 91.189.91.23 80]
- 錯誤:8 http://cn.archive.ubuntu.com/ubuntu bionic-updates InRelease
- 無法發起與 cn.archive.ubuntu.com:80 (2001:67c:1562::19) 的連接 - connect (101: 網絡不可達)
- 無法發起與 cn.archive.ubuntu.com:80 (2001:67c:1562::16) 的連接 - connect (101: 網絡不可達) [IP: 91.189.91.23 80]
- 錯誤:9 http://cn.archive.ubuntu.com/ubuntu bionic-backports InRelease
- 無法發起與 cn.archive.ubuntu.com:80 (2001:67c:1562::19) 的連接 - connect (101: 網絡不可達)
- 無法發起與 cn.archive.ubuntu.com:80 (2001:67c:1562::16) 的連接 - connect (101: 網絡不可達) [IP: 91.189.91.23 80] 已下載 99.5 kB,耗時 1分 4秒 (1,552 B/s)
- 正在讀取軟件包列表... 完成 正在分析軟件包的依賴關系樹
- 正在讀取狀態信息... 完成
- 有 3 個軟件包可以升級。請執行 ‘apt list --upgradable’ 來查看它們。
- W: 無法下載 http://cn.archive.ubuntu.com/ubuntu/dists/bionic/InRelease 無法發起與 cn.archive.ubuntu.com:80 (2001:67c:1562::19) 的連接 - connect (101: 網絡不可達)
- 無法發起與 cn.archive.ubuntu.com:80 (2001:67c:1562::16) 的連接 - connect (101: 網絡不可達)
- 無法連接上 cn.archive.ubuntu.com:80 (91.189.91.26),連接超時 無法連接上 cn.archive.ubuntu.com:80 (91.189.91.23),連接超時 [IP: 91.189.91.23 80]
- W: 無法下載 http://cn.archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease
- 無法發起與 cn.archive.ubuntu.com:80 (2001:67c:1562::19) 的連接 - connect (101: 網絡不可達)
- 無法發起與 cn.archive.ubuntu.com:80 (2001:67c:1562::16) 的連接 - connect (101: 網絡不可達) [IP: 91.189.91.23 80]
- W: 無法下載 http://cn.archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease
- 無法發起與 cn.archive.ubuntu.com:80 (2001:67c:1562::19) 的連接 - connect (101: 網絡不可達)
- 無法發起與 cn.archive.ubuntu.com:80 (2001:67c:1562::16) 的連接 - connect (101: 網絡不可達) [IP: 91.189.91.23 80]
- W: 部分索引文件下載失敗。如果忽略它們,那將轉而使用舊的索引文件。
- 這是因為cn.archive.ubuntu.com被牆了,無法連接,
- 需要切換到國內源.
- 首先備份源列表:
- sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup
- 而后用gedit或其他編輯器打開:
- sudo gedit /etc/apt/sources.list
- #添加阿里源
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse -
最后執行如下命令更新源
##更新
sudo apt-get update
sudo apt-get upgrade另外其他幾個國內源如下:
中科大源
##中科大源
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse163源
##163源
deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse清華源
##清華源
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
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse - 將cn.archive.ubuntu.com替換為阿里源mirrors.aliyun.com
- 然后,刷新列表:
- sudo apt-get update
- 幾個國內源
- //阿里源http://mirrors.aliyun.com
- //中科大源http://mirrors.ustc.edu.cn
- //163源http://mirrors.163.com
- //清華源http://mirrors.tuna.tsinghua.edu.cn
- Ubuntu下gcc安裝及使用
- 一、安裝
- 方法一:
- sudo apt-get build-dep gcc
- 方法二:
- sudo apt-get install build-essential
- 安裝完了可以執行如下的命令來查看版本,
- gcc --version
- 輸出如下:
- gcc(GCC)4.2.3(Ubuntu4.2.3-2ubuntu7)
- Copyright(C)2007FreeSoftwareFoundation,Inc.
