The ubuntu version I am currently using is 17.04, which is a non-LTS version (not a long-term support version). After installing the operating system, I can update the software normally. However, recently, when apt-get install or apt-get update is executed, it prompts that the installation/update fails, and the software cannot be downloaded. Even if other domestic data sources are replaced, it cannot be updated. After some exploration, the solution is as follows:
1. Backup source files
Open a terminal and enter
sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup
2. Create source files
Open a terminal and enter
sudo vi /etc/apt/sources.list
Edit the source list file and use old-releases.ubuntu.com as the mirror source service. Someone specially registered the domain name old-releases.ubuntu.com to provide installation packages of older versions. Therefore, for non-LTS versions Software updates are also supported. (Note, if you need the latest version of the software, please manually go to the official website or github to download)
First clear the contents of sources.list, and then copy the following contents into the file.
deb http://old-releases.ubuntu.com/ubuntu zesty main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu zesty-security main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu zesty-updates main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu zesty-proposed main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu zesty-backports main restricted universe multiverse
deb-src http://old-releases.ubuntu.com/ubuntu zesty main restricted universe multiverse
deb-src http://old-releases.ubuntu.com/ubuntu zesty-security main restricted universe multiverse
deb-src http://old-releases.ubuntu.com/ubuntu zesty-updates main restricted universe multiverse
deb-src http://old-releases.ubuntu.com/ubuntu zesty-proposed main restricted universe multiverse
deb-src http://old-releases.ubuntu.com/ubuntu zesty-backports main restricted universe multiverse
The zesty in the above list is the name of the ubuntu system version, corresponding to version 17.04. If you don't know the version name, you can run the lsb_release -a command to get it
root@rogerlinux:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 17.04
Release: 17.04
Codename: zesty
The Codename is the version name of the system.
3. Update the mirror
After saving the source list file, enter the following command to update the mirror source
sudo apt-get update