源,可以认为是软件库,使用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