Ubuntu configures domestic sources

Configure domestic sources

Due to well-known reasons, many foreign websites cannot be accessed or are accessed extremely slowly in China, including the official source of Ubuntu.

Therefore, if you want to use apt to install applications smoothly, you need to configure a domestic source image.

There are many domestic image sources for Ubuntu on the market. The more representative ones include Tsinghua Source, University of Science and Technology of China, Alibaba Source, and NetEase Source. The following are their URLs:

Here we take Tsinghuayuan as an example

  1. Back up the original source files.

    cp /etc/apt/sources.list /etc/apt/sources.list.bak
    
  2. Visit the Tsinghua source mirror address: https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/

    Select the image of your own operating system version and copy its contents.

  3. Edit the source file and replace it with the copied content.

    vim /etc/apt/sources.list
    
    

  4. Update the software list and complete the source change.

    apt update
    

    update is the index of the source listed in synchronization /etc/apt/sources.listand so that the latest software package can be obtained./etc/apt/sources.list.d

  5. Repair the broken package, try to uninstall the erroneous package, and reinstall the correct version.

    apt-get install  -f
    
  6. Update software.

    apt-get upgrade
    

upgrade is to upgrade all installed software packages, and the upgraded version is in the local index.

Therefore, you must perform update before performing upgrade to ensure that all software packages are up to date.


  • environment

    Ubuntu 22.04.2

Guess you like

Origin blog.csdn.net/qq_37770674/article/details/132397238