Help Center> CloudArtifact> Getting Started> Uploading/Obtaining a Debian Component Using Linux Commands
Updated on 2022-09-29 GMT+08:00

Uploading/Obtaining a Debian Component Using Linux Commands

This section describes how to use Linux commands to upload a component to a self-hosted Debian repo and obtain a dependency from the repository.

Prerequisites

  1. A Debian component is available.
  2. A Linux host that can connect to the public network is available.
  3. You have created a self-hosted Debian repo.

Releasing a Component to a Self-Hosted Debian Repo

  1. Log in to the DevCloud homepage and access the self-hosted Debian repo. Click Operation Guide in the upper right corner.

  2. In the dialog box that is displayed, click Download Configuration File.

  3. On the Linux host, run the following command to upload a Debian component:

    curl -u <USERNAME>:<PASSWORD> -X PUT "https:// <repoUrl>/<DEBIAN_PACKAGE_NAME>;deb.distribution=<DISTRIBUTION>;deb.component=<COMPONENT>;deb.architecture=<ARCHITECTURE>" -T <PATH_TO_FILE>

    In this command, USERNAME, PASSWORD, and repoUrl can be obtained from the Debian upload command in the configuration file downloaded in the previous step.

    • USERNAME: username used for uploading files, which can be obtained from the Debian configuration file. For details, see the example figure.
    • PASSWORD: password used for uploading files, which can be obtained from the Debian configuration file. For details, see the example figure.
    • repoUrl: URL used for uploading files, which can be obtained from the Debian configuration file. For details, see the example figure.

      DEBIAN_PACKAGE_NAME, DISTRIBUTION, COMPONENT, and ARCHITECTURE can be obtained from the Debian component.

      The a2jmidid_8_dfsg0-1_amd64.deb component is used as an example.

    • DEBIAN_PACKAGE_NAME: software package name, for example, a2jmidid_8_dfsg0-1_amd64.deb.
    • DISTRIBUTION: release version, for example, trusty.
    • COMPONENT: component name, for example, main.
    • ARCHITECTURE: system architecture, for example, amd64.
    • PATH_TO_FILE: local storage path of the Debian component, for example, /root/a2jmidid_8_dfsg0-1_amd64.deb.

      The following figure shows the complete command.

  4. After the command is successfully executed, go to the self-hosted repo and find the uploaded Debian component.

Obtaining a Dependency from a Self-Hosted Debian Repo

The following procedure uses the Debian component released in Releasing a Component to a Self-Hosted Debian Repo as an example to describe how to obtain a dependency from a self-hosted Debian repo.

  1. Download the public key file of the self-hosted Debian repo by referring to Releasing a Component to a Self-Hosted Debian Repo.

  2. Import the gpg public key.

    gpg --import <PUBLIC_KEY_PATH>

    PUBLIC_KEY_PATH: local path for storing the Debian public key, for example, artifactory.gpg.public.

  3. Add the public key to the list of keys used by apt to authenticate packages.

    gpg --export --armor <SIG_ID> | apt-key add -

  4. Add the apt repository source.

    Open the configuration file (for details about how to obtain the file, see Releasing a Component to a Self-Hosted Debian Repo), replace all DISTRIBUTION fields with the value of COMPONENT (for example, main) used for uploading the Debian file, and add the repository source based on the downloaded configuration file sources.list.

  5. After the repository source is added, run the following command to update the repository source:

    apt-get update

  6. Run the following command to download the Debian package: Replace a2jmidid with the actual value of PACKAGE.

    apt download a2jmidid

    Method for obtaining packages:

    • Download the Packages source data of the Debian component. The following uses the a2jmidid package as an example: