Ubuntu服务器使用apt-get安装包时出现E: Unable to locate package

Ubuntu服务器使用apt-get安装包时出现E: Unable to locate package解决方法

首先根据网络情况换源:

cat > /etc/apt/sources.list << "EOF"
deb https://mirrors.shanhe.com/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.shanhe.com/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.shanhe.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.shanhe.com/ubuntu/ bionic-security main restricted universe multiverse

deb https://mirrors.shanhe.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.shanhe.com/ubuntu/ bionic-updates main restricted universe multiverse

deb https://mirrors.shanhe.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.shanhe.com/ubuntu/ bionic-backports main restricted universe multiverse

## Not recommended
# deb http://mirrors.shanhe.com/ubuntu/ bionic-proposed main restricted universe multiverse
# deb-src http://mirrors.shanhe.com/ubuntu/ bionic-proposed main restricted universe multiverse
EOF

然后执行以下命令:

apt-get clean all
apt-get update

接着再次使用apt-get安装对应的包即可解决问题:

apt-get install 包名
posted @ 2024-03-02 19:56  一蓑烟雨度平生  阅读(309)  评论(0编辑  收藏  举报