apt: command not found——ubuntu误删apt的解决方案
·
问题描述:
一、问题原因:换源错误!
我的ubuntu版本和源版本不一致
# 1.查看sources.list
/etc/apt/sources.list
# 2.查看ubuntu版本
sudo lsb_release -a
# 3.
对于 Ubuntu 20.04 (focal):
deb http://mirrors.cqu.edu.cn/ubuntu/ focal main restricted universe multiverse
# deb-src http://mirrors.cqu.edu.cn/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.cqu.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
# deb-src http://mirrors.cqu.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.cqu.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb-src http://mirrors.cqu.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb http://mirrors.cqu.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# deb-src http://mirrors.cqu.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# deb http://mirrors.cqu.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
# deb-src http://mirrors.cqu.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
# 4.换源,将上面源的复制到以下文件中
vim /etc/apt/sources.list
# 5.更新缓存和软件包
sudo apt update
sudo apt upgrade
二、安装apt
# 1. 到镜像站找到对应的apt版本,下载到本地
wget http://mirrors.163.com/ubuntu/pool/main/a/apt/apt_1.0.1ubuntu2.24_amd64.deb
# 2. 安装
sudo dpkg -i apt_1.0.1ubuntu2.24_amd64.deb
# 3. 更新
sudo apt update
sudo apt upgrade
这样就能正常运行了。
更多推荐
已为社区贡献3条内容
所有评论(0)