Configuring the Repositories and Installing Software for HCE
HCE uses RPM packages to manage software and provides the official repository matching the OS to release software packages and update packages. You can run the dnf/yum commands for common software management functions, such as installation, upgrade, and uninstallation.
Configuring the Official Repository
By default, the official repository is configured in the /etc/yum.repos.d/hce.repo file of the default HCE image purchased together with the ECS. Take HCE 2.0 as an example. The file content is as follows:
[base] name=HCE $releasever base baseurl=https://repo.huaweicloud.com/hce/$releasever/os/$basearch/ enabled=1 gpgcheck=1 gpgkey=https://repo.huaweicloud.com/hce/$releasever/os/RPM-GPG-KEY-HCE-2 [updates] name=HCE $releasever updates baseurl=https://repo.huaweicloud.com/hce/$releasever/updates/$basearch/ enabled=1 gpgcheck=1 gpgkey=https://repo.huaweicloud.com/hce/$releasever/updates/RPM-GPG-KEY-HCE-2 [debuginfo] name=HCE $releasever debuginfo baseurl=https://repo.huaweicloud.com/hce/$releasever/ debuginfo/$basearch/ enabled=0 gpgcheck=1 gpgkey=https://repo.huaweicloud.com/hce/$releasever/ debuginfo/RPM-GPG-KEY-HCE-2
The fields are described as follows:
- name: name of the repository.
- baseurl: address of the server where the software repository is located. The value can be in the format of http://, ftp://, or file://.
- enabled: whether to enable the software repository. The value 1 indicates that the software repository is enabled, and the value 0 indicates that the software repository is disabled.
- gpgcheck: whether to perform GNU Privacy Guard (GPG) verification. The value 1 indicates that GPG verification is enabled, and the value 0 indicates that GPG verification is disabled.
- gpgkey: address for storing the public key that is used for GPG verification.
Modifying this file may affect the software installation and upgrade of the OS. You are advised not to modify this file.
Configuring a Third-Party Repository
To add a third-party repository, perform the following steps (the image source from the OpenEuler community is used as an example):
- Add the openEuler.repo file to the /etc/yum.repos.d/ directory. The file name can be customized, but the file name extension must be .repo. Run the vim /etc/yum.repo.d/openEuler.repo command to edit the file.
- Set the repository name, for example, [openEuler]. The repository name must be unique and can be changed based on site requirements.
- Configure the name field. For example, set it to openEuler repository, which is the detailed description of the repository. You can change the description based on site requirements.
- Set baseurl to https://repo.openeuler.org/openEuler-22.03-LTS/OS/x86_64/, which is the link where the software package is obtained. For details, see the product documentation of OpenEuler or the repo provider.
- Configure the gpgcheck field. The value 1 indicates that GPG verification is performed on the installed software package.
- Configure the enabled field. The value 1 indicates that the repository is enabled.
- Set gpgkey to https://repo.openeuler.org/openEuler-22.03-LTS/OS/x86_64/RPM-GPG-KEY-openEuler, which is the link where the public key used for GPG verification is obtained.
[openEuler] name=openEuler repository baseurl=https://repo.openeuler.org/openEuler-22.03-LTS/OS/x86_64/ gpgcheck=1 enabled=1 gpgkey=https://repo.openeuler.org/openEuler-22.03-LTS/OS/x86_64/RPM-GPG-KEY-openEuler
You can set the priority field to specify the priority of each repository. If the HCE official source is preferentially used, add priority=1 to the hce.repo configuration (a smaller value indicates a higher priority), and then add priority=2 to the third-party source configuration. You can adjust the value based on site requirements. For details about the complete openEuler repository configuration, see Obtaining the openEuler Extended Software Packages.
To upgrade the software package, refer to Upgrading Huawei Cloud EulerOS and RPM Packages.
Common yum and dnf Commands
In Huawei Cloud EulerOS 1.1, you can only perform software management operations by running the yum commands. In HCE 2.0, both the yum and dnf commands are supported. The following are common commands for software management.
Function |
yum Command |
dnf Command |
Example Command |
---|---|---|---|
Installing software packages |
yum install <Software package> |
dnf install <Software package> |
yum install gcc: installs GCC. |
Uninstalling software packages |
yum remove <Software package> |
dnf remove <Software package> |
yum remove gcc: uninstalls GCC. |
Listing installed software packages |
yum list installed |
dnf list installed |
yum list installed: lists all software packages in the system. |
Searching for software packages |
yum search <Software package> |
dnf search <Software package> |
yum search gcc: searches for the GCC package in the repository. |
Querying information about software packages |
yum info <Software package> |
dnf info <Software package> |
yum info gcc: queries GCC software package information. |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot