全部產品
Search
文件中心

Elastic Compute Service:Debian 9/10 EOL如何切換源?

更新時間:Jun 19, 2024

Debian 9/10作業系統版本結束生命週期(EOL)後,Linux社區不再維護該作業系統版本。建議您升級作業系統至Debian 11及以上,如果您的業務過渡期仍需要使用Debian 9/10系統中的一些安裝包,請先根據本文操作切換源地址。

背景資訊

您可以通過下文的操作步驟,在Debian 9/10作業系統的ECS執行個體中將源配置按照網路環境不同進行切換。

  • Virtual Private Cloud類型執行個體需切換為http://mirrors.cloud.aliyuncs.com/debian-archive/debian源。

  • 傳統網路類型執行個體需切換為http://mirrors.aliyuncs.com/debian-archive/debian源。

重要

本文主要說明ECS執行個體中的相關操作與配置,如果您的伺服器不是ECS執行個體,需保證伺服器具有公網訪問能力,請將源地址http://mirrors.cloud.aliyuncs.com替換為http://mirrors.aliyun.com

操作步驟

  1. 登入Debian 9/10系統的ECS執行個體。

  2. 運行以下命令編輯sources.list檔案。

    sudo vim /etc/apt/sources.list
  3. i鍵進入編輯模式,修改以下內容切換源。

    請根據執行個體不同的網路類型進行修改,具體內容如下:

    Virtual Private Cloud類型執行個體

    • Debian 9

      deb http://mirrors.cloud.aliyuncs.com/debian-archive/debian stretch main contrib non-free
      deb http://mirrors.cloud.aliyuncs.com/debian-archive/debian stretch-proposed-updates main non-free contrib
      deb http://mirrors.cloud.aliyuncs.com/debian-archive/debian stretch-backports main non-free contrib
      deb http://mirrors.cloud.aliyuncs.com/debian-archive/debian-security stretch/updates main contrib non-free
      deb-src http://mirrors.cloud.aliyuncs.com/debian-archive/debian stretch main contrib non-free
      deb-src http://mirrors.cloud.aliyuncs.com/debian-archive/debian stretch-proposed-updates main contrib non-free
      deb-src http://mirrors.cloud.aliyuncs.com/debian-archive/debian stretch-backports main contrib non-free
      deb-src http://mirrors.cloud.aliyuncs.com/debian-archive/debian-security stretch/updates main contrib non-free
    • Debian 10

      deb http://mirrors.cloud.aliyuncs.com/debian-archive/debian stretch main
      deb http://mirrors.cloud.aliyuncs.com/debian-archive/debian stretch-proposed-updates main
      deb http://mirrors.cloud.aliyuncs.com/debian-archive/debian stretch-backports main
      deb http://mirrors.cloud.aliyuncs.com/debian-archive/debian-security stretch/updates main
      deb-src http://mirrors.cloud.aliyuncs.com/debian-archive/debian stretch main
      deb-src http://mirrors.cloud.aliyuncs.com/debian-archive/debian stretch-proposed-updates main
      deb-src http://mirrors.cloud.aliyuncs.com/debian-archive/debian stretch-backports main
      deb-src http://mirrors.cloud.aliyuncs.com/debian-archive/debian-security stretch/updates main

    傳統網路類型執行個體

    • Debian 9

      deb http://mirrors.aliyuncs.com/debian-archive/debian stretch main contrib non-free
      deb http://mirrors.aliyuncs.com/debian-archive/debian stretch-proposed-updates main non-free contrib
      deb http://mirrors.aliyuncs.com/debian-archive/debian stretch-backports main non-free contrib
      deb http://mirrors.aliyuncs.com/debian-archive/debian-security stretch/updates main contrib non-free
      deb-src http://mirrors.aliyuncs.com/debian-archive/debian stretch main contrib non-free
      deb-src http://mirrors.aliyuncs.com/debian-archive/debian stretch-proposed-updates main contrib non-free
      deb-src http://mirrors.aliyuncs.com/debian-archive/debian stretch-backports main contrib non-free
      deb-src http://mirrors.aliyuncs.com/debian-archive/debian-security stretch/updates main contrib non-free
    • Debian 10

      deb http://mirrors.aliyuncs.com/debian-archive/debian stretch main
      deb http://mirrors.aliyuncs.com/debian-archive/debian stretch-proposed-updates main
      deb http://mirrors.aliyuncs.com/debian-archive/debian stretch-backports main
      deb http://mirrors.aliyuncs.com/debian-archive/debian-security stretch/updates main
      deb-src http://mirrors.aliyuncs.com/debian-archive/debian stretch main
      deb-src http://mirrors.aliyuncs.com/debian-archive/debian stretch-proposed-updates main
      deb-src http://mirrors.aliyuncs.com/debian-archive/debian stretch-backports main
      deb-src http://mirrors.aliyuncs.com/debian-archive/debian-security stretch/updates main
  4. 編輯完成後,按Esc鍵,並輸入:wq儲存退出檔案。

  5. 運行以下命令更新源緩衝。

    sudo apt update

源切換完成後,即可使用sudo apt install命令在執行個體上安裝您所需要的軟體包。

相關操作

使用自訂鏡像建立新的ECS執行個體,在啟動執行個體時cloud-init會自動初始化系統的源配置。如果您後續需要通過已切換源的ECS執行個體建立自訂鏡像,並且需要保留已切換的源配置,需要您在建立自訂鏡像前,按照以下操作在已切換源的ECS執行個體中修改cloud-init的設定檔/etc/cloud/cloud.cfg

  1. 運行以下命令編輯/etc/cloud/cloud.cfg檔案。

    sudo vim /etc/cloud/cloud.cfg
  2. i進入編輯模式,使用#注釋掉cloud_init_modules:下的- source-address模組。

    注釋後,檔案內的配置資訊如下所示:cloudinit

  3. 編輯完成後,按Esc鍵,並輸入:wq儲存退出檔案。

相關文檔

Debian作業系統生命週期資訊,請參見作業系統維護周期