Este conteúdo foi traduzido por máquina para sua conveniência e a Huawei Cloud não pode garantir que o conteúdo foi traduzido com precisão. Para exibir o conteúdo original, use o link no canto superior direito para mudar para a página em inglês.
Central de ajuda/ Elastic Cloud Server/ Perguntas frequentes/ Image Source Management/ How Can I Use a CentOS Image Source (x86_64) Provided by HUAWEI CLOUD?
Atualizado em 2025-01-23 GMT+08:00

How Can I Use a CentOS Image Source (x86_64) Provided by HUAWEI CLOUD?

Scenarios

When updating the OS or software of an ECS, you can access the Internet through the ECS and use an external CentOS image source. However, if your ECS cannot access the Internet, or the external CentOS image source cannot provide services stably, you can use the CentOS image source provided by HUAWEI CLOUD.

Constraints

  • Esta seção aplica-se apenas às seguintes regiões: CN North-Beijing1, CN North-Beijing4, CN East-Shanghai1, CN East-Shanghai2, CN South-Guangzhou e CN-Hong Kong.
  • Você configurou o servidor DNS da intranet fornecido pela HUAWEI CLOUD.

    Para obter o endereço do servidor DNS da intranet, consulte Quais são os endereços de servidor DNS privados fornecidos pela Huawei Cloud?

    Para obter instruções sobre como configurar um servidor DNS, consulte Configuração do DNS.

  • The operations described in this section apply to x86_64 ECSs.

Procedure

  1. Log in to the ECS as user root.
  2. Run the following commands to back up the CentOS-Base.repo file:

    mkdir -p /etc/yum.repos.d/repo_bak/

    mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/repo_bak/

  3. Select a suitable cURL command according to the CentOS image source version, run the command to download the CentOS-Base.repo file, and save the file into /etc/yum.repos.d/:
    The cURL commands for the CentOS image sources supported by HUAWEI CLOUD are as follows:
    • CentOS 8

      CentOS 8 reached End Of Life (EOL) on December 31, 2021. You can refer to the following command for configuration:

      curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.myhuaweicloud.com/repo/CentOS-Base-8.repo

    • CentOS 7

      curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.myhuaweicloud.com/repo/CentOS-Base-7.repo

    • CentOS 6

      CentOS 6 reached End Of Life (EOL) on November 30, 2020. You can refer to the following command for configuration:

      curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.myhuaweicloud.com/repo/CentOS-Base-6.repo

  4. Run the following command to generate a cache:

    yum makecache

    • After you execute the command, if the system displays the message "Another app is currently holding the yum lock", run the rm -rf /var/run/yum.pid command to delete the yum.pid file. Then, run the yum makecache command again to generate the cache.
    • If the system displays the message "Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again" after you run the yum makecache command, you must run the yum --disablerepo=epel -y update ca-certificates command to update the certificate and temporarily disable the EPEL source.
    • If certain packages are unavailable, this issue may be caused by in-progress data synchronization. In this case, try again after a few hours.