Switching CentOS 6 Source to YUM Repository

Last updated: 2021-03-04 15:38:05

    Background

    CentOS 6 reached end-of-life (EOL) on November 30, 2020, and is no longer maintained by the Linux community. Therefore, the CentOS 6 source is unavailable in http://mirror.centos.org/centos-6/ and third-party image sites. Tencent Cloud sites, http://mirrors.cloud.tencent.com/ and http://mirrors.tencentyun.com/, cannot obtain CentOS 6 source. If you continue to use the default CentOS 6 source configured in Tencent Cloud, an error may occur.

    Note:

    Upgrading your operating system to CentOS 7 or a later version is recommended. If you still need to use the CentOS 6 dependencies, switch the CentOS 6 source as instructed below.

    Directions

    1. Log in to a Linux instance using Web Shell (See documentation. You can also use other login methods that you are more comfortable with:
    2. Run the following command to check the CentOS version of the current operating system.
      cat /etc/centos-release
      As shown in the following figure, the operating system version is CentOS 6.9.
    3. Run the following command to edit the CentOS-Base.repo file.
      vim /etc/yum.repos.d/CentOS-Base.repo 
    4. Press i to enter edit mode and modify baseurl according to the CentOS version and network environment.

      Note:


      Determine the source required for your instance as instructed in Private Network Access and Internet Access

      • Source for private network access: http://mirrors.tencentyun.com/centos-vault/6.x/
      • Source for public network access: https://mirrors.cloud.tencent.com/centos-vault/6.x/

    This document uses a CentOS 6.9-based instance that requires private network access as an example. The modified CentOS-Base.repo file is as follows:

    5. Press ESC, enter :wq, and press Enter to save the modification.
    6. Run the following command to modify the CentOS-Epel.repo file.

    vim /etc/yum.repos.d/CentOS-Epel.repo 
    1. Press i to enter edit mode and modify baseurl based on the network environment.
      In this example, change baseurl=http://mirrors.tencentyun.com/epel/$releasever/$basearch/ to baseurl=http://mirrors.tencentyun.com/epel-archive/6/$basearch/. The result should be as follows:
    2. Press ESC, enter :wq, and press Enter to save the modification.
    3. Now you can use the yum install command to install the required software.