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
.
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
Log on to an ECS instance that runs Debian 9 or Debian 10.
For more information, see Connect to a Linux instance by using a password or key.
Run the following command to modify the
sources.list
file:sudo vim /etc/apt/sources.list
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.
For instances that reside in VPCs
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 buster main deb http://mirrors.cloud.aliyuncs.com/debian-archive/debian buster-proposed-updates main deb http://mirrors.cloud.aliyuncs.com/debian-archive/debian buster-backports main deb http://mirrors.cloud.aliyuncs.com/debian-security buster/updates main deb-src http://mirrors.cloud.aliyuncs.com/debian-archive/debian buster main deb-src http://mirrors.cloud.aliyuncs.com/debian-archive/debian buster-proposed-updates main deb-src http://mirrors.cloud.aliyuncs.com/debian-archive/debian buster-backports main deb-src http://mirrors.cloud.aliyuncs.com/debian-security buster/updates main
For instances that reside 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 buster main deb http://mirrors.aliyuncs.com/debian-archive/debian buster-proposed-updates main deb http://mirrors.aliyuncs.com/debian-archive/debian buster-backports main deb http://mirrors.aliyuncs.com/debian-security buster/updates main deb-src http://mirrors.aliyuncs.com/debian-archive/debian buster main deb-src http://mirrors.aliyuncs.com/debian-archive/debian buster-proposed-updates main deb-src http://mirrors.aliyuncs.com/debian-archive/debian buster-backports main deb-src http://mirrors.aliyuncs.com/debian-security buster/updates main
After you modify the file, press the Esc key to exit Insert mode and enter
:wq
to save and exit the file.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:
Run the following command to open the /etc/cloud/cloud.cfg file:
sudo vim /etc/cloud/cloud.cfg
Press the I key to enter Insert mode, and use
#
to comment out the- source-address
module undercloud_init_modules:
.The following figure shows the configuration information in the file.
After you modify the file, press the Esc key to exit Insert mode and enter
:wq
to save and exit the file.