This topic describes the cause of and solution to the issue that a yum
command cannot be run on an Elastic Compute Service (ECS) instance that runs the Alibaba Cloud Linux 2 operating system and resides in the classic network.
Problem description
An error message indicating that the repository (repo
) addresses are invalid appears when you run the yum update
command on an ECS instance that meets the following requirements:
Image:
aliyun-2.1903-x64-20G-alibase-20190327.vhd
or laterKernel:
4.19.24-9.al7
or laterNetwork type: classic network
Cause
Alibaba Cloud does not support Alibaba Cloud Linux 2 instances that reside in the classic network. Alibaba Cloud Linux 2 instances that reside in the classic network may be unable to connect to the addresses that are specified in the YUM repository files.
Solution
Log on to the ECS instance.
Modify the
/etc/yum.repos.d/aliyun-base.repo
configuration file. The following sample code provides an example of the modified file content.NoteIf the configuration file does not exist, create the file.
[base] name=AliYun-$releasever - Base - mirrors.aliyun.com baseurl=http://mirrors.aliyun.com/alinux/$releasever/os/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/alinux/RPM-GPG-KEY-ALIYUN #released updates [updates] name=AliYun-$releasever - Updates - mirrors.aliyun.com baseurl=http://mirrors.aliyun.com/alinux/$releasever/updates/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/alinux/RPM-GPG-KEY-ALIYUN #additional packages that may be useful [extras] name=AliYun-$releasever - Extras - mirrors.aliyun.com baseurl=http://mirrors.aliyun.com/alinux/$releasever/extras/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/alinux/RPM-GPG-KEY-ALIYUN # plus packages provided by Aliyun Linux dev team [plus] name=AliYun-$releasever - Plus - mirrors.aliyun.com baseurl=http://mirrors.aliyun.com/alinux/$releasever/plus/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/alinux/RPM-GPG-KEY-ALIYUN
Delete all
.repo
configuration files except for the /etc/yum.repos.d/aliyun-base.repo configuration file from the/etc/yum.repos.d/
directory. Example:/etc/yum.repos.d/epel.repo
.(Optional) To permanently resolve the issue, change the network type of the instance from the classic network to Virtual Private Cloud (VPC). For information about how to change the network type of an instance from the classic network to VPC, see Overview of the migration solution.