注意:

使用 Leapp 升級 Oracle Linux

簡介

Leapp 公用程式是更新與升級作業系統以及應用程式的架構。公用程式的元件套件可在設定檔中建立不同的工作流程以更新軟體。

Leapp 作業由兩個階段組成:

Leapp 可以用來升級 Oracle Linux 7 Oracle Cloud Infrastructure 執行處理,以及部署於企業內部的系統 Oracle Linux 7。

這個實驗室會引導您將目前的版本 Oracle Linux 7 Oracle Cloud Infrastructure 執行處理升級成 Oracle Linux 8。

其他作業系統或版本不支援 Leapp。

注意:在生產環境中使用 Leapp 之前,建議熟悉測試環境中的 Leapp 升級程序。這可讓您深入瞭解可能遭遇到的任何安全性或相容性問題之程序、報告和測試。

目標

在本實驗室中,您將瞭解:

必要條件

注意:您可以在使用此文件連結升級為 Leapp 之前,檢視系統和核心先決條件的完整清單和升級前檢查:使用 Leapp 執行系統升級

設定實驗室環境

使用免費實驗室環境時,請使用此連結來 Oracle Linux Lab Basics,瞭解如何建立 SSH 連線及其他使用指示。

下列小節顯示如何從桌面上的 [ 終端機 ] 與執行處理的 SSH 連線。

準備升級

此實驗室中使用的執行處理已預先設定環境特定的設定值,例如代理主機設定值。

部分正常執行的升級前檢查會被略過,因為在此環境中並不需要這些檢查。

注意:您可以觀看示範此實驗室使用之 Leapp 升級程序的免費影片。您將在本實驗室結束後面的詳細資訊區段找到此連結。

  1. 建立實驗室系統執行處理的 SSH 連線。

    請記住 Oracle Linux Lab Basics 的連結會顯示如何建立 SSH 連線和其他使用指示。

  2. 確認系統語言環境設定為 en_US.UTF-8

    cat /etc/locale.conf
    

    如果未正確設定語言環境,請使用指令 sudo localectl set-locale LANG=en_US.UTF-8 來設定此語言環境。

更新至最新套裝軟體

使用 Yum 將所有系統套裝軟體更新至最新版本。

sudo yum update -y

這需要幾分鐘的時間,更新完成後,請重新啟動系統。

sudo reboot

請稍候幾分鐘,重新啟動您的 SSH 連線至執行處理。

如果連線失敗,請稍等一點時間後再試一次。

安裝 Leapp 公用程式

安裝 Leapp 公用程式及其支援儲存庫。

sudo yum install -y leapp --enablerepo=ol7_leapp,ol7_latest

執行升級前檢查

預先升級處理程序會評估系統是否已準備好成功升級。可識別可能影響或防止升級程序的潛在問題。

預先升級檢查可隨時用來評估系統的狀態,並識別可能發生衝突的位置。它不會變更系統,但會建立報告檔案與除錯日誌,其中包含系統的相關資訊、其配置,以及潛在的升級問題。

  1. 執行 leapp preupgrade 指令來啟動升級前程序。

    此實驗室系統是雲端執行處理,因此請使用命令切換 --oci

    sudo leapp preupgrade --oci
    

    如果系統是非雲端系統,則會使用交換器 --oraclelinux

    --oci--oraclelinux 是方便使用的交換器,可用來預設與雲端或非雲端系統相關的儲存區域和組態資訊。

    • 範例輸出:
    ============================================================  
                          UPGRADE INHIBITED                     
    ============================================================  
                                                                    
    Upgrade has been inhibited due to the following problems:  
        1. Inhibitor: Missing required answers in the answer file  
    Consult the pre-upgrade report for details and possible remediation.  
                                                                    
    ============================================================  
                       UPGRADE INHIBITED                        
    ============================================================  
                                                                    
                                                                    
    Debug output written to /var/log/leapp/leapp-preupgrade.log  
                                                                
    ============================================================  
                             REPORT                             
    ============================================================  
                                                                   
    A report has been generated at /var/log/leapp/leapp-report.json
    A report has been generated at /var/log/leapp/leapp-report.txt
                                                                  
    ============================================================
                         END OF REPORT                          
    ============================================================  
                                                                  
    Answerfile has been generated at /var/log/leapp/answerfile  
    

    系統會建立 leapp-report.txt 檔案和 answerfile,除錯資訊儲存在 leapp-preupgrade.log 日誌檔中。

    在此實驗室環境中,螢幕上的結果會識別一個會禁止升級的問題。也可能在檔案中存在其他非禁止的問題。

  2. 檢查 leapp-report.txt 檔案。

    sudo cat /var/log/leapp/leapp-report.txt
    

    識別標示為 Risk Factor: high (inhibitor) 的任何高風險項目。這些將無法完成升級。

    報表提供問題摘要,並提供解決問題的解決方案。

    這份報告是很有用的自我檢查工具,提供良好的系統設定檢視,可能存在哪些潛在衝突,不管您是否要升級 。

  3. 檢查 answerfile

    sudo cat /var/log/leapp/answerfile
    
    • 範例輸出:
    [remove_pam_pkcs11_module_check]  
    # Title:              None  
    # Reason:             Confirmation  
    # =================== remove_pam_pkcs11_module_check.confirm ==================  
    # Label:              Disable pam_pkcs11 module in PAM configuration? If no, the upgrade process will be interrupted.  
    # Description:        PAM module pam_pkcs11 is no longer available in OL-8 since it was replaced by SSSD.  
    # Type:               bool  
    # Default:            None  
    # Available choices: True/False  
    # Unanswered question. Uncomment the following line with your answer  
    # confirm =  
    

    Available Choices: True/False 區段會告知如何修改 answerfile 以解決找到的問題。

    使用 sudo leapp answer 指令將答案 True 提供至 [remove_pam_pkcs11_module_check] PAM 模組項目。

    sudo leapp answer --section remove_pam_pkcs11_module_check.confirm=True
    

    注意:您也可以使用 sudo vi /var/log/leapp/answerfile 指令編輯 answerfile,然後插入 True 設定。

  4. 確認 answerfile 已經修改。

    sudo cat /var/log/leapp/answerfile
    
    • 範例輸出:
    [remove_pam_pkcs11_module_check]  
    confirm = True  
    

    請記住,answerfile 中的所有項目,而且 leapp-report.txt 檔案中的任何高風險 Risk Factor: high (inhibitor) 項目都必須解決。

    您可以隨時執行升級前命令來產生報表檔案,並確保已處理所需項目。

升級系統

若要與升級後進行比較,請確認系統目前的作業系統和核心版本。

  1. 檢查系統上執行的 Oracle Linux 版本。

    sudo cat /etc/oracle-release
    
  2. 檢查使用的核心版本。

    uname -r
    
  3. 執行升級處理程序。

    sudo leapp upgrade --oci
    

    注意:實驗室系統是一個雲端執行處理,因此再次使用命令切換 --oci

    升級處理作業大約需要 10 分鐘,完成時請回到命令提示字元。

    • 範例輸出:
    The downloaded packages were saved in cache until the next successful  
    transaction.  
    You can remove cached packages by executing 'dnf clean packages'.  
    ==> Processing phase 'InterimPreparation'  
    ====> * efi_interim_fix  
           Adjust EFI boot entry for first reboot  
    ====> * initram_disk_generator  
           Creates the upgrade initram disk  
    ====> * add_upgrade_boot_entry  
           Add new boot entry for Leapp provided initramfs.  
    A reboot is required to continue. Please reboot your system.  
      
    Debug output written to /var/log/leapp/leapp-upgrade.log  
      
    ============================================================  
                              REPORT
    ============================================================  
      
    A report has been generated at /var/log/leapp/leapp-report.json  
    A report has been generated at /var/log/leapp/leapp-report.txt  
      
    ============================================================  
                          END OF REPORT  
    ============================================================  
      
    Answerfile has been generated at /var/log/leapp/answerfile  
    

    升級程序也會更新 answerfileleapp-report.txt,以及建立 leapp-upgrade.log 日誌檔。

    注意:如果您尚未處理 leapp-report.txt 檔案中的 answerfile 項目和 Risk Factor: high (inhibitor) 項目,則程序會終止命令列並通知所遇到的問題。

  4. 升級完成後,請重新啟動系統。

    sudo reboot
    

    重新開機將會中斷 SSH 連線連線。在開機程序期間,Leapp 處理作業會自動升級套裝軟體。

    升級作業也包含多個自動重新啟動。重新開機完成後,您才能重新連線 SSH 階段作業。

    請等待大約 15 分鐘,然後重新將 SSH 階段作業連線至系統。如果連線失敗,請稍候幾分鐘後再試一次。

驗證升級

比對系統現已使用的作業系統版本和核心與升級前版本。

  1. 檢查執行中的 Oracle Linux 版本。

    sudo cat /etc/oracle-release
    
  2. 檢查使用的核心版本。

    uname -r
    

    升級會在您現在看到系統正在執行 Oracle Linux 8.5 時完成,且使用的核心顯示 el8

其他相關資訊

請參閱其他相關資源:

其他學習資源

探索 docs.oracle.com/learn 上的其他實驗室,或前往 Oracle Learning YouTube 通道存取更多免費學習內容。此外,請造訪 education.oracle.com/learning-explorer 以成為 Oracle Learning Explorer。

如需產品文件,請瀏覽 Oracle Help Center