Linux默认的源安装和更新速度很慢,使用apt安装/跟新软件时,速度特别慢,或者无法安装,为了提速可以换一些国内的源。
- 备份默认的apt源(备份很重要!!!万一修改后没有办法使用,可以替换回来)
1 $ cd /etc/apt
2 $ sudo cp sources.list sources.list.bak
- 编辑
$ sudo vi sources.list
将下面使用下面链接替换源文件(阿里源)
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
- 每次修改完apt源,一定要执行一下更新,
$ sudo apt-get update
第一修改的时候,没有进行更新,安装其他软软件报了下面这个错误
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
openssh-server : Depends: openssh-client (= 1:7.2p2-4ubuntu2.8)
Depends: openssh-sftp-server but it is not going to be installed
Recommends: ssh-import-id but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
PS:还可以使用其他源,例如163源,清华源。