All Products
Search
Document Center

Elastic Compute Service:How do I change Debian 9 or Debian 10 repository addresses

Last Updated:May 13, 2024

Debian 9 and Debian 10 have reached their end of life (EOL) and are no longer maintained by the Linux community. We recommend that you upgrade your operating system to Debian 11 or later. If you want to continue using specific installation packages of Debian 9 or Debian 10 during the transition period, perform the operations that are described in this topic to change Debian 9 or Debian 10 repository addresses.

Background information

You can perform the following steps to change the repository configurations of Elastic Compute Service (ECS) instances that run Debian 9 or Debian 10 based on network environments.

  • For ECS instances that reside in virtual private clouds (VPCs), change the repository address to http://mirrors.cloud.aliyuncs.com/debian-archive/debian.

  • For ECS instances that reside in the classic network, change the repository address to http://mirrors.aliyuncs.com/debian-archive/debian.

Important

This topic describes how to change Debian 9 or Debian 10 repository addresses for ECS instances. If your server is not an ECS instance, make sure that the server can access the Internet, and then replace http://mirrors.cloud.aliyuncs.com in the preceding repository address with http://mirrors.aliyun.com.

Procedure

  1. Log on to an ECS instance that runs Debian 9 or Debian 10.

  2. Run the following command to modify the sources.list file:

    sudo vim /etc/apt/sources.list
  3. Press the I key to enter Insert mode, and change the repository addresses.

    Change the repository addresses based on the network type of the instance.

    Modified content that includes the new repository address for the instance located in a VPC

    • 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

    Modified content that includes the new repository address for the instance located in the classic network

    • 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. After you modify the file, press the Esc key to exit Insert mode and enter :wq to save and exit the file.

  5. Run the following command to update the repository cache:

    sudo apt update

After you change the repository addresses, you can run the sudo apt install command to install the software packages that you need on the instance.

What to do next

After you create an instance from a custom image, cloud-init initializes the repository configurations of the instance on instance startup. If you want to create a custom image based on the instance for which the repository addresses are changed and retain the new repository configurations, perform the following steps to modify the cloud-init configuration file /etc/cloud/cloud.cfg on the instance before you create the custom image:

  1. Run the following command to open the /etc/cloud/cloud.cfg file:

    sudo vim /etc/cloud/cloud.cfg
  2. Press the I key to enter Insert mode, and use # to comment out the - source-address module under cloud_init_modules:.

    The following figure shows the configuration information in the file.cloudinit

  3. After you modify the file, press the Esc key to exit Insert mode and enter :wq to save and exit the file.

References

Maintenance support for operating systems