CentOS 8 has reached its end of life (EOL) and is no longer maintained by the Linux community. We recommend that you switch to Anolis or Alibaba Cloud Linux. If you want to continue using specific installation packages of CentOS 8 during the transition period, change CentOS 8 repository addresses as described in this topic.
Background information
CentOS 8 reached its EOL on December 31, 2021. In accordance with Linux community rules, all content has been removed from the following CentOS 8 repository address: http://mirror.centos.org/centos/8/
. All third-party image providers have removed CentOS 8 repositories for their images. Alibaba Cloud repositories at http://mirrors.cloud.aliyuncs.com
and http://mirrors.aliyun.com can no longer be synchronized with CentOS 8 repositories. If you continue to use the default CentOS 8 repository configurations on Alibaba Cloud, an error is reported. The following figure shows a sample error.
You can perform the following steps to change the repository configurations of Elastic Compute Service (ECS) instances that run CentOS 8 based on network environments.
YUM repository for CentOS 8
For ECS instances located in virtual private clouds (VPCs), change the YUM repository address to
http://mirrors.cloud.aliyuncs.com/centos-vault/8.5.2111/
.For ECS instances located in the classic network, change the repository address to
http://mirrors.aliyuncs.com/centos-vault/8.5.2111/
.
Extra Packages for Enterprise Linux (EPEL) repository for CentOS 8
For ECS instances located in VPCs, change the EPEL repository address to
http://mirrors.cloud.aliyuncs.com/epel-archive/8/
.For ECS instances located in the classic network, change the repository address to
http://mirrors.aliyuncs.com/epel-archive/8/
.
This topic describes how to change CentOS 8 repository addresses for ECS instances. If your server is not an ECS instance, replace http://mirrors.cloud.aliyuncs.com
in CentOS 8 repository addresses with http://mirrors.aliyun.com
. For example, you can replace the address of the YUM repository for CentOS 8 with http://mirrors.aliyun.com/centos-vault/8.5.2111/
and replace the address of the EPEL repository for CentOS 8 with http://mirrors.aliyun.com/epel-archive/8/
.
Procedure
Connect to an ECS instance that runs CentOS 8.
For more information, see Connection method overview.
Run the following command to back up the repo files:
rename '.repo' '.repo.bak' /etc/yum.repos.d/*.repo
Run the following commands to download the latest repo files:
wget http://mirrors.cloud.aliyuncs.com/repo/Centos-vault-8.5.2111.repo -O /etc/yum.repos.d/Centos-vault-8.5.2111.repo wget http://mirrors.cloud.aliyuncs.com/repo/epel-archive-8.repo -O /etc/yum.repos.d/epel-archive-8.repo
ImportantIf your server is not an ECS instance, replace
http://mirrors.cloud.aliyuncs.com
in CentOS 8 repository addresses withhttp://mirrors.aliyun.com
.Run the following commands to replace the addresses in the downloaded repo files:
sed -i 's/http:\/\/mirrors.cloud.aliyuncs.com/url_tmp/g' /etc/yum.repos.d/Centos-vault-8.5.2111.repo && sed -i 's/http:\/\/mirrors.aliyun.com/http:\/\/mirrors.cloud.aliyuncs.com/g' /etc/yum.repos.d/Centos-vault-8.5.2111.repo && sed -i 's/url_tmp/http:\/\/mirrors.aliyun.com/g' /etc/yum.repos.d/Centos-vault-8.5.2111.repo sed -i 's/http:\/\/mirrors.aliyun.com/http:\/\/mirrors.cloud.aliyuncs.com/g' /etc/yum.repos.d/epel-archive-8.repo
Run the following command to re-create a cache:
yum clean all && yum makecache
After you change the YUM and EPEL repository addresses for CentOS 8, you can use the yum install command to install the required software packages on the ECS instance.