Solve the problem that E: cannot be located when installing the software package

Case 1: After confirming that the network connection and quality are OK, any software cannot be installed, and E: Unable to locate XXX appears.
Solution: Change the source
Specific steps:

1. Back up the /etc/apt/sources.list file
and execute the command

sudo cp /etc/apt/sources.list /etc/apt/sources.list.old

2. Open the file sudo vim /etc/apt/sources.list (gedit is also available)
and delete or comment out the contents of the original file. Paste
the selected source:
Alibaba Cloud source:

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

Tsinghua source:

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty main universe restricted multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty main universe restricted multiverse

3.sudo apt-get update

The second case: You can install other software, but you can’t install ros-<distro>-xxx (personal version is melodic) software packages, and changing the source is not easy, you can try the following methods (premise: key and When the ros source is complete) (in my case)

1.echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/ros-latest.list
2.sudo apt update
然后安装ros-melodic-xxx类的软件包就好使了。

Guess you like

Origin blog.csdn.net/m0_45805756/article/details/126310136