源,可以認為是軟件庫,使用apt-get install安裝的時候,會在源保存的庫中進行搜索,因此源會影響下載速度和資源數量。
源會保存在/etc/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
進行更新
update是下載源里面的metadata的. 包括這個源有什么包, 每個包什么版本之類的.
upgrade是根據update命令下載的metadata決定要更新什么包(同時獲取每個包的位置).
PPA,表示 Personal Package Archives,也就是個人軟件包集。有很多軟件因為種種原因,不能進入官方的 Ubuntu 軟件倉庫。 為了方便 Ubuntu 用戶使用,launchpad.net 提供了 ppa,允許用戶建立自己的軟件倉庫, 自由的上傳軟件。PPA 也被用來對一些打算進入 Ubuntu 官方倉庫的軟件,或者某些軟件的新版本進行測試。
使用
sudo add-apt-repository ppa:ubuntu-wine/ppa
sudo apt-get update sudo apt-get upgrade
添加ppa的源
有時一些舊的源會失效,因此可以使用以下的命令查出就的源,然后對其進行刪除。
sudo apt-get update | grep "Failed" # 先對源進行更新,然后在流中查出Failed的內容
sudo add-apt-repository --remove ppa:finalterm/daily