1. 程式人生 > 實用技巧 >fedora版本如何升級

fedora版本如何升級

自動升級

sudo dnf update --refresh  # 更新系統包
sudo dnf install dnf-plugin-system-upgrade  # 安裝系統更新外掛
sudo dnf system-upgrade download --refresh --releasever [32|33|rawhide]  # 下載包
sudo dnf system-upgrade reboot  # 重啟執行升級操作

如果某些依賴不滿足,升級將終止,可新增--allowerasing選項刪除依賴損壞的包。這可能是第三方源還未進行更新。建議解除安裝這些依賴不滿足的包。新增--best

選項,可檢視依賴問題的詳細資訊。

升級後操作

更新系統配置檔案:
更新後,RPM將備份配置檔案。搜尋.rpmnew(新配置).rpmsave(舊配置),根據需要進行修改。或使用rpmconf工具進行處理。

sudo rpmconf -a

清理舊軟體包:

sudo dnf repoquery --unsatisfied  # 列出依賴問題的包,可以酌情刪除這些包
sudo dnf repoquery --duplicated   # 列出重複的包,一般的包不會有重複存在
sudo dnf list extras  # 列出已從源中刪除的包,可能包含第三方源的包$ 
sudo dnf autoremove   # 刪除不需要的包

注意:DNF 不需要一個包,是根據您是否明確要求安裝它來決定的。這不意味著這個包是無用的。您需要刪除您確實不需要的包。注意,PackageKit有個已知的 Bug,它並不標記包是使用者安裝。如果您使用PackageKit(或GNOME Software,Apper等)安裝包,則這些包可能會列出,甚至會包含重要的應用程式和系統軟體包,務必要十分小心。

解決升級後遇到的問題

如果您升級後,系統有問題,可能需要以下步驟。

重建RPM資料庫:

如果您使用RPM/DNF工具時出現警告,可能需要重建RPM資料庫。

sudo rpm --rebuilddb

使用distro-sync解決依賴問題:
system upgrade

工具預設使用distro-sync升級系統。如果您的系統有些未升級的包有依賴問題,可手動執行distro-sync。這會同步源的軟體包(某些包會降級)。

sudo dnf distro-sync
sudo dnf distro-sync --allowerasing  # 允許刪除依賴損壞的包,務必進行確認

重新標記 SELinux 標籤:

如果某些行為被禁止並收到 SELinux 警告,可能有些檔案標籤不正確。

sudo touch /.autorelabel
reboot

手動升級

升級至 fc30

sudo systemctl isolate multi-user.target  # 切換至 TUI$ sudo dnf upgrade
sudo dnf clean all
sudo dnf distro-sync --releasever=30 --setopt=deltarpm=false   --disablerepo=\* --enablerepo=fedora --enablerepo=updates --nogpgcheck
sudo touch /.autorelabel

建議清理/var/cache/yum,/var/cache/dnf,/var/cache/mock,/var/lib/mock等目錄。

升級至 Rawhide

sudo dnf upgrade
sudo dnf install dnf-plugins-core fedora-repos-rawhide
sudo dnf config-manager --set-disabled fedora updates updates-testing
sudo dnf config-manager --set-enabled rawhide
sudo dnf clean -q dbcache plugins metadata
sudo dnf distro-sync --releasever=rawhide --setopt=deltarpm=false --nogpgcheck
sudo touch /.autorelabel

參考:

Fedora升級操作,輕易不要升級,如果升級請規範操作 (mamicode.com)