What is the method for changing sources in ubuntu using apt-get?

To change the software sources in Ubuntu, you can edit the software source list file. Below are the steps to change the apt-get software sources.

  1. Open the terminal and use the command below to edit the software source list file:
  2. Open the /etc/apt/sources.list file using the nano text editor with superuser privileges.
  3. In the opened file, locate and comment out the existing software source, then add a new software source. For example, add the following content:
  4. Add the following lines to your sources.list file:
    deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
  5. Save the file and exit the editor (press Ctrl + X, then press Y to confirm saving, press Enter to confirm file name).
  6. Update the software package list for changes to take effect.
  7. Update the package list using sudo apt-get.

You have now successfully changed the apt-get software source. You can use the apt-get command to install, update, and uninstall packages.

bannerAds