How Do I Replace an Image Source with an Official HUAWEI CLOUD Image Source?
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. If the official yum source downloaded from the Internet is used, the update is slow and the package version is out-of-date. In this case, you need to replace the image source with an official HUAWEI CLOUD image source.
Constraints
- This section applies only to the following regions: CN North-Beijing1, CN North-Beijing4, CN East-Shanghai1, CN East-Shanghai2, CN South-Guangzhou, and AP-Hong Kong.
- 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?
For instructions about how to configure a DNS server, see Configuring DNS.
- The operations described in this section apply to x86_64 ECSs.
Procedure
- Log in to the ECS as user root.
- 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/
- Select a proper 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:
- Run the following command to generate a cache:
- After the yum makecache 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.
- After the yum makecache command is executed, if the system displays the message "Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again", run the following command to update the certificate for temporarily disabling the EPEL image source:
yum --disablerepo=epel -y update ca-certificates
- If certain packages are unavailable, this issue may be caused by in-progress data synchronization. In such a case, try again several hours later.
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.