今天給電腦換源了,雖然本來的源大部分好像也都連的上(不知道是不是錯覺)換的這個:
先進入存放源的目錄:` cd /etc/apt
里面有這些文件:
sources.list是要修改的,先給它創建一個備份: ` sudo cp sources.list source.list.backup
然后` sudo vim sources.list
在最前面加上(我的電腦Codename是focal,見后文):
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
再保存並退出。
最后` sudo apt update 更新一下。
關於加上的東西是什么意思:
-
deb是通過.deb方式安裝 deb-src是源文件安裝
-
中間是網址
-
后面的bionic或(focal)對應阿里雲里面的目錄
-
再后面是目錄里面的幾個目錄
關於bionic和focal:
這個是電腦對應的Codename,我一開始弄錯了這個,把源改的bionic的
應該通過命令 ` lsb_release -a來查看
可見我的電腦是focal的。我一開始就弄錯了這個。然后復制[這個]:(https://developer.aliyun.com/mirror/ubuntu?spm=a2c6h.13651102.0.0.6ef01b11zm76Jf)focal的。