Detailed process of changing apt source to Alibaba Cloud source in Ubuntu 18.04

Detailed process of changing apt source to Alibaba Cloud source in Ubuntu 18.04

Preface:

I saw that Ubuntu's new version 18.04 was good, so I installed it for fun. Although there are many tutorials to refer to, I will also give a slightly different solution and try to explain it in as much detail as possible.

In order to download more conveniently and faster, we often modify the apt source to a domestic source when using the Linux series system. Generally, we choose Alibaba Cloud, Douban, etc. The following briefly describes how to change to Alibaba Cloud source.

Ubuntu 18.04 changes apt source to Alibaba Cloud source

1. Copy the source file as a backup, just in case

The file we want to modify is sources.list, which is in the directory /etc/apt/. sources.list is a configuration file used by the package management tool apt to record the location of the software package repository. There are also various files of the same type with the .list suffix under the sources.list.d file in the same directory.

The command is as follows:

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

2. Edit the source list file

The command is as follows:

sudo vim /etc/apt/sources.list

If an error message appears: sudo:vim:command not found, it means that the vim editor is not installed.

Use command:

sudo apt-get install vim to install

3. View new version information

In fact, there is a method for changing the apt source to the domestic source in any version before Ubuntu 18.04. The content is similar, and we should master its rules. In fact, the difference between each version is the version number (or the official one: system code), so let's first understand the system code of the new version:

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 Ubuntu system is codenamed bionic

Similarly, we can also get the system code of any previous version:

Ubuntu 12.04 (LTS) is codenamed 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.

So this also explains why the contents of so many solutions we found on Baidu are not exactly the same, because they use different systems when changing the apt installation source.

4. Comment out the original content and add the following content (or you can modify the content to the following, but there cannot be any 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 formatted (as you can see from the above content), generally in the following form

deb http://site.example.com/debian distribution component1 component2 component3
deb-src http://site.example.com/debian distribution component1 component2 component3

So the following parameters are the classification of software packages (main, restricted, universe, multiverse in Ubuntu)

So you write the content

deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted

deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed universe multiverse

I had this question before, so I would like to share it with my friends who have the same question as me.

5. Update software list

Run the following command:

sudo apt-get update

6. Update software packages

Run the following command:

sudo apt-get upgrade

7. Final words

The function and difference between ubuntu sudo update and upgrade

Each LINUX distribution, such as UBUNTU, maintains its own software repository, which contains almost all the software we commonly use. The software here is absolutely safe and can be installed normally.

Under UBUNTU, we maintain a source list, which contains some URL information. Each URL is a source, and the data pointed to by this address identifies which software can be installed and used on this source server.

Edit source command:

sudo gedit /etc/apt/sources.list

Add or comment out (add #) some sources in this file and save it. At this time, the software pointed to in our source list will increase or decrease.

Get a list of recent packages: (The list contains some package information, such as whether the package has been updated)

sudo apt-get update

This command will access each URL in the source list, read the software list, and save it on the local computer. The software lists seen in the package manager are all updated through the update command.

After updating, you may need to upgrade.

sudo apt-get upgrade

This command will compare the locally installed software with the corresponding software in the software list just downloaded. If it is found that the installed software version is too low, you will be prompted to update it. If your software is the latest version, you will be prompted:

0 packages upgraded, 0 packages newly installed, 0 packages to be uninstalled, and 0 packages not upgraded.

In short, update is to update the software list, and upgrade is to update the software.

Note: Generally, you need to execute sudo apt-get update before executing the sudo apt-get upgrade command. In fact, it is the same as the software update detection under Windows. The software that needs to be updated will be automatically updated and installed for you.

Online direct installation command

sudo apt-get install software name

The apt-get update command will synchronize the RPM index list (package list) of the client and the APT server. The RPM index list of the APT server is placed in the base folder. After the client computer obtains the bz2 RPM index list compressed file in the base folder, it will decompress it and place it in /var/state/apt/lists/. When the user uses the apt-get install or apt-get dist-upgrade command, the data in this folder will be compared with the RPM database in the client computer. In this way, it can be determined which RPMs are installed, not installed, or can be upgraded.

At the same time, I borrowed a few blog posts from blogger gong_xucheng, the address is as follows

https://blog.csdn.net/gong_xucheng/article/details/53886271

I would like to express my gratitude here.

Summarize

This is the end of this article about changing the apt source to Alibaba Cloud source in Ubuntu 18.04. For more information about changing the apt source in Ubuntu 18.04, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • How to change the domestic source of Ubuntu 20.04 apt
  • How to change apt-get source in Ubuntu 18.04
  • Detailed explanation of several domestic update sources for Ubuntu 16.04
  • How to change Alibaba source in Ubuntu 14.04 and Ubuntu 16.04
  • How to configure Ubuntu 17.04 to change the domestic source
  • How to change the Ali source in Ubuntu 20.04
  • Example of how to change the domestic source in Ubuntu 18.04

<<:  Detailed explanation of lazy loading and preloading of webpack

>>:  In-depth understanding of MySQL various locks

Recommend

How to choose between MySQL CHAR and VARCHAR

Table of contents VARCHAR and CHAR Types Conclusi...

How to realize vertical arrangement of text using CSS3

In a recent project, I wanted to align text verti...

Detailed explanation of HTML form elements (Part 2)

HTML Input Attributes The value attribute The val...

Detailed explanation of Vue life cycle

Table of contents Why understand the life cycle W...

Vue event's $event parameter = event value case

template <el-table :data="dataList"&...

Solution to installing vim in docker container

Table of contents The beginning of the story Inst...

Summary of how to use bootstrap Table

This article shares with you how to use bootstrap...

Nginx defines domain name access method

I'm building Nginx recently, but I can't ...

The correct way to migrate MySQL data to Oracle

There is a table student in the mysql database, i...

Use of docker system command set

Table of contents docker system df docker system ...

Detailed explanation of JavaScript to monitor route changes

Table of contents history pushState() Method push...