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.
- Open the terminal and use the command below to edit the software source list file:
- Open the /etc/apt/sources.list file using the nano text editor with superuser privileges.
- In the opened file, locate and comment out the existing software source, then add a new software source. For example, add the following content:
- 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 - Save the file and exit the editor (press Ctrl + X, then press Y to confirm saving, press Enter to confirm file name).
- Update the software package list for changes to take effect.
- 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.