How Can I Use a CentOS Image Source (x86_64) Provided by HUAWEI CLOUD?
When updating the OS or software of an ECS, you can access the ECS to the Internet 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.
- Make sure that the intranet DNS server provided by HUAWEI CLOUD has been configured. For instructions about how to obtain an intranet DNS server, see What Are the Private DNS Server Addresses Provided by the DNS Service?
- The operations described in this section apply to ECSs deployed on x86_64 servers.
- Log in to the ECS as user root.
- Run the following command 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/
- 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 6
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.myhuaweicloud.com/repo/CentOS-Base-6.repo
- CentOS 7
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.myhuaweicloud.com/repo/CentOS-Base-7.repo
- CentOS 6
- Run the following command to generate a cache:
- After the command is executed, 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 for temporarily disabling the epel source.