Help Center/ CodeArts Artifact/ Best Practices/ Uploading/Obtaining an RPM Package Using Linux Commands
Updated on 2026-03-13 GMT+08:00

Uploading/Obtaining an RPM Package Using Linux Commands

Software developers often need to upload custom private packages to an RPM repository so that other team members can easily access and use them. However, without clear guidance, developers may encounter issues when uploading packages using Linux commands, leading to upload or dependency retrieval failures. Ensuring successful upload and access to private packages is therefore a common challenge. This document describes how to upload a private package to an RPM repository and fetch dependencies from the repository using Linux commands.

Prerequisites

  • You have an RPM package available.
  • You have a Linux host that can connect to the Internet.
  • You have created an RPM repository.
  • You have been granted permissions to upload, download, and view packages in the current repository. For details, see Configuring Repository Permissions.

Publishing a Package to an RPM Repository

  1. Use your Huawei Cloud account to access self-hosted repos.
  2. Select an RPM repository. Click Tutorial on the right of the page.

  3. In the displayed dialog box, click Download Configuration File.
  4. On the Linux host, run the following command to upload an RPM package.

    curl -u {{user}}:{{password}} -X PUT https://{{repoUrl}}/{{component}}/{{version}}/ -T {{localFile}}

    In this command, user, password, and repoUrl can be obtained from the RPM upload command in the configuration file downloaded in the previous step.

    • user: string before the colon (:) between curl -u and -X
    • password: string after the colon (:) between curl -u and -X
    • repoUrl: string between https:// and /{{component}}

    component, version, and localFile can be obtained from the RPM package to be uploaded. The hello-0.17.2-54.x86_64.rpm package is used as an example.

    • component: software name, for example, hello.
    • version: software version, for example, 0.17.2.
    • localFile: RPM component, for example, hello-0.17.2-54.x86_64.rpm.

    The following figure shows the complete commands.

  5. After the commands are successfully executed, go to the self-hosted repo page and find the uploaded RPM package.

Obtaining a Dependency from an RPM Repository

  1. Download the configuration file of the RPM repository by referring to Publishing a Package to an RPM Repository.
  2. Open the configuration file, replace all {{component}} in the file with the value of {{component}} (hello in this file) used for uploading the RPM file, delete the RPM upload command, and save the file.

  3. Save the modified configuration file to the /etc/yum.repos.d/ directory on the Linux host.

  4. Run the following command to download the RPM package. Replace hello with the actual value of component.

    yum install hello