Ubuntu apt-get change source (solve the problem of E: Unable to locate the software package)

This kind of problem occurs when we are in Ububtu, which means E: Unable to locate the package problem

The reason for this is that the software source has not been updated, and the updated command is sudo apt-get update

But the source that comes with it is many and old, we can change the source

(1) Enter the directory where the source file is located

cd  /etc/apt/

(2) Backup source files

sudo  cp sources.list sources.list.old

(3) Modify the source file inside, use the gedit text editor here, because it can be deleted by ctrl+a

sudo gedit sources.list     

(4) Delete all the files in it and replace them with the following Aliyuan Alibaba open source ubuntu image , here we take 16.04 as an example

deb http://mirrors.aliyun.com/ubuntu/ xenial main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main

deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main

deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates universe

deb http://mirrors.aliyun.com/ubuntu/ xenial-security main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security universe

(5) Update software sources and software

sudo apt-get update 
sudo apt-get  upgrade 

 

Guess you like

Origin blog.csdn.net/Lorrey_/article/details/124952811