1.查看系統版本號(官方語言系統代碼)
lsb_release -c
得到本系統的系統代碼
類似其他版本的
Ubuntu 12.04 (LTS)代號為precise。
Ubuntu 14.04 (LTS)代號為trusty。
Ubuntu 15.04 代號為vivid。
Ubuntu 15.10 代號為wily。
Ubuntu 16.04 (LTS)代號為xenial
這是一個阿里的是我的系統就應該要將上面的trusty改為bionic
2.首先找到配置文件,將系統配置文件備份
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
3.打開文件
使用vim和geidt都行
vi /etc/apt/sources.list
sudo gedit /etc/apt/sources.list
二者選其一
4.注釋或者刪除里面的文件內容(我自己選擇的是刪除比較快)然后將下面的這些復制進去保存
一般我們選擇下面的阿里源:
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
下面還有其他官方源自行試驗
官方源: deb http://archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu/ trusty-proposed main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse deb-src http://archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse deb-src http://archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse deb-src http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse deb-src http://archive.ubuntu.com/ubuntu/ trusty-proposed main restricted universe multiverse deb-src http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse 163源: deb http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse 阿里源: deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse centos源(放心使用): deb http://centos.bitcomm.cn/ubuntu trusty main restricted universe multiverse deb http://centos.bitcomm.cn/ubuntu trusty-security main restricted universe multiverse deb http://centos.bitcomm.cn/ubuntu trusty-updates main restricted universe multiverse deb http://centos.bitcomm.cn/ubuntu trusty-backports main restricted universe multiverse deb http://centos.bitcomm.cn/ubuntu trusty-proposed main restricted universe multiverse deb-src http://centos.bitcomm.cn/ubuntu trusty main restricted universe multiverse deb-src http://centos.bitcomm.cn/ubuntu trusty-security main restricted universe multiverse deb-src http://centos.bitcomm.cn/ubuntu trusty-updates main restricted universe multiverse deb-src http://centos.bitcomm.cn/ubuntu trusty-backports main restricted universe multiverse deb-src http://centos.bitcomm.cn/ubuntu trusty-proposed main restricted universe multiverse 搜狐源: deb http://mirrors.sohu.com/ubuntu/ trusty main restricted universe multiverse deb http://mirrors.sohu.com/ubuntu/ trusty-security main restricted universe multiverse deb http://mirrors.sohu.com/ubuntu/ trusty-updates main restricted universe multiverse deb http://mirrors.sohu.com/ubuntu/ trusty-proposed main restricted universe multiverse deb http://mirrors.sohu.com/ubuntu/ trusty-backports main restricted universe multiverse deb-src http://mirrors.sohu.com/ubuntu/ trusty main restricted universe multiverse deb-src http://mirrors.sohu.com/ubuntu/ trusty-security main restricted universe multiverse deb-src http://mirrors.sohu.com/ubuntu/ trusty-updates main restricted universe multiverse deb-src http://mirrors.sohu.com/ubuntu/ trusty-proposed main restricted universe multiverse deb-src http://mirrors.sohu.com/ubuntu/ trusty-backports main restricted universe multiverse
4.保存退出
如果用gedit打開就直接點擊上面的保存
如果用vim打開就用 ESC :wq
5.更新源
sudo apt-get update
6.更新軟件
sudo apt-get dist-upgrade
sudo apte-get upgrade