根据官方指南,每次建议只升级1个版本,至多每次只能升级2个版本。
查看当前系统版本
$ uname -a
Linux localhost.localdomain 4.1.13-100.fc21.x86_64 #1 SMP Tue Nov 10 13:13:20 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Fedora 27升级Fedora 34
Fedora 27 -> 28 -> 29 -> 30 -> 31 ->33 ->34
建议升级到Fedora Linux 34,它将会被维护到2022年5月。
升级到Fedora Linux 34,您所要做的就是依次执行以下命令,每执行一个命令后按Enter键,等待前一个命令完成后再运行下一个命令。
$ uname -a
Linux localhost.localdomain 4.13.9-300.fc27.x86_64 #1 SMP Mon Oct 23 13:41:58 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
# 升级
sudo dnf upgrade --refresh
sudo dnf install dnf-plugin-system-upgrade
sudo dnf system-upgrade download --releasever=34
sudo dnf system-upgrade reboot
如果你因为没有更新包、错误的依赖,或过时的包在升级时遇到问题,请在输入上面第三步令时添加 -- allowerasing 标志。这将允许 DNF 删除可能阻止系统升级的软件包。
Fedora 21升级Fedora 27
Fedora 21先升级Fedora 22
耗时很长,建议在较好的网络环境下进行
$ sudo dnf upgrade --refresh
$ sudo dnf install dnf-plugin-system-upgrade
$ sudo dnf system-upgrade download --refresh --releasever=22 --allowerasing --setopt=keepcache=1
经常遇到的问题之一:提示GPG-KEY缺失
Install 257 Packages
Upgrade 1646 Packages
Remove 7 Packages
Downgrade 4 Packages
Total download size: 1.4 G
warning: /var/lib/dnf/system-upgrade/geos-3.4.2-3.fc22.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 8e1431d5: NOKEY
Curl error (37): Couldn't read a file:// file for file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-x86_64 [Couldn't open file /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-x86_64]
下载RPM-GPG-KEY,下载links
$ sudo rpm --import '/home/brian/Downloads/RPM-GPG-KEY-rpmfusion-free-fedora-22'
$ sudo rpmkeys --import /etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-free-fedora-22
更名:
$ sudo cp RPM-GPG-KEY-fedora-22-x86_64 RPM-GPG-KEY-fedora-x86_64
重新安装
$ sudo dnf system-upgrade download --refresh --releasever=22 --allowerasing --setopt=keepcache=1
根据提示导入key
warning: /var/lib/dnf/system-upgrade/geos-3.4.2-3.fc22.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 8e1431d5: NOKEY
Importing GPG key 0x8E1431D5:
Userid : "Fedora (22) "
Fingerprint: C527 EA07 A934 9B58 9C35 E1BF 11AD C094 8E14 31D5
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-x86_64
Is this ok [y/N]: y
Key imported successfully
...
启动安装事务,需要很长的时间,请耐心等待。
更新+重启动
$ sudo dnf system-upgrade reboot
Fedora 22再升级Fedora 23
Fedora 22升级Fedora 23,四步即可,等待时间比较长
sudo dnf update --refresh
sudo dnf install dnf-plugin-system-upgrade
sudo dnf system-upgrade download --releasever=23
sudo dnf system-upgrade reboot
Fedora 23再升级Fedora 25
更新key,升级,重新启动:
$ sudo cp RPM-GPG-KEY-fedora-25-x86_64 RPM-GPG-KEY-fedora-x86_64
$ sudo dnf system-upgrade download --refresh --releasever=25 --allowerasing --setopt=keepcache=1
$ sudo dnf system-upgrade reboot
解决错误事务检查错误
Error: Transaction check error:
file /usr/share/man/man1/vim.1.gz from install of vim-minimal-2:8.0.617-1.fc24.x86_64 conflicts with file from package vim-common-2:7.4.1868-1.fc22.x86_64
file /usr/lib64/gstreamer-1.0/libgstopus.so from install of gstreamer1-plugins-base-1.8.3-2.fc24.x86_64 conflicts with file from package gstreamer1-plugins-bad-free-1.6.4-1.fc23.x86_64
删除vim和gstreamer
$ sudo dnf remove vim
# dnf remove gstreamer
解决conflicts with file from错误
# yum -y remove gstreamer1-plugins-bad-free-1.6.4-1.fc23.x86_64
继续下载更新所需库:
$ sudo dnf system-upgrade download --refresh --releasever=25 --allowerasing --setopt=keepcache=1
启动更新:
# dnf system-upgrade reboot
查看当前系统版本:
$ uname -a
Linux localhost.localdomain 4.13.16-100.fc25.x86_64 #1 SMP Mon Nov 27 19:52:46 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
Fedora 25再升级Fedora 27
经测试,支持跨版本更新哦。
$ uname -a
Linux localhost.localdomain 4.15.15-300.fc27.x86_64 #1 SMP Mon Apr 2 23:14:02 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Fedora 29升级Fedora 30
$ cat /etc/fedora-release
Fedora release 29(Twenty Nine)
// 确保在开始升级过程之前拥有Fedora 29的最新软件
$ sudo dnf upgrade --refresh
//安装系统更新的dnf插件
$ sudo dnf install dnf-plugin-system-upgrade
//系统升级到30
$ sudo dnf system-upgrade download --releasever=30
//重启
$ sudo dnf system-upgrade reboot
rpm key报错现象:
警告:/var/cache/dnf/fedora-183ef32f0dcfcf92/packages/python3-pyyaml-4.2-0.1.b4.fc29.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID 429476b4: NOKEY
Curl error (37): Couldn't read a file:// file for file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-x86_64 [Couldn't open file /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-x86_64]
rpm key报错解决方案:
sudo rpmkeys --import /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-29-x86_64