我們一般通過(guò)apt install或apt-get install安裝軟件葬项,有朋友說(shuō)在國(guó)內(nèi)可能有些軟件找不到民珍,連接不到美國(guó)的Ubuntu源。
解決辦法是添加國(guó)內(nèi)源嚷量,國(guó)內(nèi)有Ubuntu源的地方挺多,比如一些教育網(wǎng)嗜历,阿里等抖所。阿里挺快的田轧,下面以添加阿里源為例。
首先備份源文件每窖,以免出錯(cuò)弦悉,/etc/apt/sources.list文件
axing@axing-rock:/etc/apt$ sudo cp sources.list sources.list.backup
axing@axing-rock:/etc/apt$ ls
apt.conf.d sources.list sources.list.d
preferences.d sources.list.backup trusted.gpg.d
查看版本號(hào)
axing@axing-rock:/etc/apt$ lsb_release -c
Codename: bionic
訪問(wèn)阿里網(wǎng)站:https://opsx.alibaba.com/mirror
找到對(duì)應(yīng)版本 For ubuntu 18.04(bionic) configuration
點(diǎn)右邊的help
拷貝下來(lái)警绩,sudo vim /etc/apt/sources.list 用這些替換原有的源鏈接,然后更新
axing@axing-rock:/etc/apt$ sudo apt update
Get:1 http://mirrors.aliyun.com/ubuntu bionic InRelease [242 kB]
Get:2 http://mirrors.aliyun.com/ubuntu bionic-security InRelease [83.2 kB]
Get:3 http://mirrors.aliyun.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:4 http://mirrors.aliyun.com/ubuntu bionic-proposed InRelease [242 kB]
Get:5 http://mirrors.aliyun.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:6 http://mirrors.aliyun.com/ubuntu bionic/multiverse Sources [181 kB]
...中間略過(guò)
Fetched 66.2 MB in 3min 34s (309 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
88 packages can be upgraded. Run 'apt list --upgradable' to see them.
由于我在國(guó)外后室,連阿里源比較慢混狠,才309kB/s,這里就演示一下将饺,待會(huì)再改回去:)痛黎。
如果要更新軟件刮吧,接著 sudo apt upgrade就可以了。