Ubuntu 18 replace software source

Keywords: Ubuntu yum sudo CentOS

In Centos/RHEL system, the file to configure the yum warehouse is the. Repo file under the directory / etc/yum.repo.d /. In Ubuntu system, it is the / etc/apt/sources.list file

The first element of configuring system files is to back up files. Generally, system files are kb level files, which don't occupy a lot of storage space, so it's unnecessary to use Rm-rf command to save that space. This is also a way for myself. When I was learning Linux, I preferred Rm-rf command, which is very enjoyable. Once I made an error, I would destroy the sky and the earth Fortunately, in a system debugging, the dynamic link library of the server was successfully broken, which led to the direct crash of the environment where others had worked hard for two or three hours. That is because they were not used to backing up files. Their virtual machines were often broken, and then they could only copy relevant files from another normal virtual machine, but physical machines did not So convenient.

Switch to root first

  • Backup file

    cat /etc/apt/sources.list > /etc/apt/sources.list.bak
    
  • Overwrite the / etc/apt/sources.list file
    Replace the contents of the / etc/apt/sources.list file with ALI source, Tsinghua source, or CUHK source. This method will replace all Ubuntu sources with third-party sources

  • Append to / etc/apt/sources.list file
    Some software sources may not exist in the third-party source, but you may use them. At this time, you can't use the method of overwrite. You should use the method of appending to copy and paste the third-party source to the end of the / etc/apt/sources.list file.

  • Update

    sudo apt-get update
    

If the execution result of sudo apt get update command is wrong, the configuration is not successful. You should consider replacing a tutorial. After all, this thing will change. At this time, you need to restore the original backup content, execute cat / etc / apt / sources. List. Bak > / etc / apt / sources. List & & apt get update command, and then replace other effective tutorials.

Ali source

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

Tsinghua source

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

Zhongke Dayuan

deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
83 original articles published, 12 praised and 10 thousand visited+
Private letter follow

Posted by iPixel on Tue, 11 Feb 2020 07:46:19 -0800