ubuntu18.04升级到ubuntu20.04

发布于:2024-12-22 ⋅ 阅读:(17) ⋅ 点赞:(0)

为了使用qt6,在ubuntu18.04上各种折腾失败,无奈只能升级到ubuntu20.04, 按照网上的教程没成功。自己摸索了

lsb_release -a
df -h
sudo apt update
sudo apt upgrade -y
sudo apt dist-upgrade -y
sudo apt autoremove -y
sudo apt clean
sudo apt install update-manager-core
vi sudo nano /etc/update-manager/release-upgrades
sudo vi /etc/update-manager/release-upgrades
sudo do-release-upgrade
sudo do-release-upgrade -m desktop -d
sudo apt install --reinstall update-manager-core
sudo apt install --reinstall python3
sudo apt install --reinstall python3-distupgrade
grep Prompt /etc/update-manager/release-upgrades
sudo apt-mark showhold
sudo apt dist-upgrade
sudo do-release-upgrade -m desktop -d
sudo apt update
sudo apt upgrade
sudo apt full-upgrade
sudo apt autoremove
sudo systemctl reboot
sudo update-manager
cd /usr/bin
ls -l | grep python
sudo do-release-upgrade -d -f DistUpgradeViewGtk3
sudo apt-get install ubuntu-release-upgrader-core
sudo vi /etc/apt/sources.list
sudo apt update
sudo apt dist-upgrade -y
sudo dpkg --configure -a
dpkg -l | grep -E '^iF'
sudo apt-get install --reinstall apparmor udev
sudo apt --fix-broken install
lsb_release
lsb_release --version
lsb --version
ls -ld /etc/apparmor.d/cache/e10c1cf9.0
sudo rm -rf /etc/apparmor.d/cache/e10c1cf9.0
sudo rm -rf /etc/apparmor.d/cache/*
sudo apt-get install --reinstall apparmor
sudo apt --fix-broken install
sudo apt-get update && sudo apt-get upgrade
ls /usr/lib/x86_64-linux-gnu/libapt-pkg.so.5.0
sudo apt-get download libapt-pkg5.0
sudo dpkg -i libapt-pkg5.0_*.deb
apt-cache policy libapt-pkg5.0
sudo vi /etc/apt/sources.list
sudo apt-get update
ls /var/cache/apt/archives/ -l
cd ~
wget https://security.ubuntu.com/ubuntu/pool/main/a/apt/libapt-pkg5.0_1.6.17_amd64.deb
dpkg -i libapt-pkg5.0_1.6.17_amd64.deb
sudo dpkg -i libapt-pkg5.0_1.6.17_amd64.deb
wget https://security.ubuntu.com/ubuntu/pool/main/a/apt/libapt-pkg5.0_1.6.17_amd64.deb
sudo dpkg -i libapt-pkg5.0_1.6.17_amd64.deb
wget https://launchpad.net/ubuntu/focal/amd64/libapt-pkg6.0/2.0.2
ls
sudo apt-get update
sudo apt-get upgrade
sudo apt --fix-broken install
lsb_release -a
sudo apt dist-upgrade -y
lsb_release -a

关键的一步,要修改sudo vi /etc/apt/sources.list 将其中的源替换成ubuntu20.04

即将将 bionic 替换为 focal.

具体为:

1、编辑 sources.list 文件

1)使用 vi 打开 sources.list 文件:

sudo vi /etc/apt/sources.list

2)

  1. 查找和替换:bionic 替换为 focal。在 vi 中,您可以使用以下命令:

    • 进入命令模式(按下 ESC)。
    • 输入以下命令替换所有出现的 bionicfocal

      :%s/bionic/focal/g

  2. 保存并退出:

    • 按下 ESC 键。
    • 输入以下命令保存并退出

更新系统并升级

完成源替换后,更新并升级系统:

sudo apt update sudo apt dist-upgrade -y