Ubuntu 18 replacement source
1. Copy the source file backup just in case
The sources.list is a configuration file used by the package management tool apt to record the location of the software package warehouse. The same type includes various files with .list suffixes located in the sources.list.d file in the same directory.
The file we want to modify is sources.list, which is in the directory /etc/apt/,
The command is as follows:
1、进入对应目录
cd /etc/apt/
2、先进行文件的拷贝,以访万一
sudo cp sources.list sources.list.bak
2. View version information
The method of changing the apt source to the domestic source in any version before Ubuntu 18.04 has long existed, and the content is much the same, mainly because different versions of the system code lead to different additions, so we need to check the version information, and then directly set The law can be
:
Use the following command:
lsb_release -c
Get the system code of this system, as shown in the figure below:
We can see that the new version of the Ubuntu system code is bionic
The system codes of different versions of Ubuntu are as follows:
Ubuntu 12.04 (LTS) is code-named precise.
Ubuntu 14.04 (LTS) is codenamed trusty.
Ubuntu 15.04 is codenamed vivid.
Ubuntu 15.10 is codenamed wily.
Ubuntu 16.04 (LTS) is codenamed xenial.
3. Change content
1. Edit the file
sudo vim source.list
2. If there is no vim, just install it
sudo apt-get install vim
3. Comment out the original content and add the following content (or you can modify the content to the following, but there can be no valid content other than the following content)
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
It is worth noting that the entries in the sources.list file are all formatted (you can see from the content above), generally in the following format
deb http://site.example.com/debian distribution component1 component2 component3
deb-src http://site.example.com/debian distribution component1 component2 component3
One parameter is the code of the system, and the next few parameters are the classification of the software package (the four are main, restricted, universe, and multiverse under Ubuntu)