萬盛學電腦網

您现在的位置: 萬盛學電腦網 >> 作業系統 >  >> Linux 教學

Gentoo 手動升級系統與核心完整流程 (emerge --sync、genkernel、dispatch-conf)

Gentoo 以原始碼滾動更新著稱。本文記錄手動升級核心 (gentoo-sources) 與整個系統 (world) 的標準流程:同步 Portage、升級核心來源、配置編譯核心、更新 GRUB、升級 Portage/Python/系統套件、清理孤立套件、修復反向相依、更新設定檔、閱讀新聞。

一、核心升級

emerge --sync                          # 同步 Portage 樹
emerge -avq gentoo-sources               # 安裝新核心來源 (如 3.10.4)
cd /usr/src/linux-3.10.4-gentoo
make -j5 menuconfig                      # 配置核心選項
make -j5 && make install modules_install # 編譯安裝核心與模組

更新 GRUB /boot/grub/grub.conf 新增啟動項:

title Gentoo 3.10.4
root (hd0,0)
kernel /boot/vmlinuz-3.10.4-gentoo ro root=/dev/sda1 rootfstype=ext4 quiet

二、系統整體升級

emerge -avq portage          # 升級 Portage 工具
emerge -avq python           # 升級 Python
/usr/sbin/update-python      # 或 python-updater 更新 Python 設定
emerge -avquDN world         # 依 /var/lib/portage/world 重建整個系統
# 參數:-u 更新 -D 深度 -N 新 USE 旗標 -q 安靜 -a 詢問確認

三、善後清理與配置更新

emerge -av --depclean        # 清除孤立套件
revdep-rebuild               # 檢查並修復反向相依 (需 gentoolkit)
perl-cleaner --all -- -avq   # 重建 Perl 模組
dispatch-conf                # 互動式更新 /etc 設定檔
eselect news read all        # 閱讀重要新聞

可選:完整重建

emerge -e world  # 本地重新編譯所有套件,耗時極長,通常不必要

小結

Gentoo 升級核心與系統需嚴格遵循順序:同步 → 核心 → 工具鏈 → world → 清理 → 設定檔。切勿盲目追新,穩定版分支配合 GLSA 安全公告更新最為稠妥。

copyright © 萬盛學電腦網 all rights reserved