Help Center/ CodeArts Artifact/ Getting Started/ Uploading/Obtaining a Debian Component Using Linux Commands
Updated on 2024-11-11 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 Debian repository and obtain a dependency from the repository.

Prerequisites

  • A Debian component is available.
  • A Linux host that can connect to the public network is available.
  • You have created a Debian repository.
  • You have permissions for the current repository. For details, see Managing Repository Permissions

Releasing a Component to a Debian Repository

  1. Log in to CodeArts Artifact and access the Debian repository. Click Tutorial on the right of the page.
  2. In the displayed dialog box, 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 Debian Repository as an example to describe how to obtain a dependency from a Debian repository.

  1. Download the public key file of the Debian repository by referring to Releasing a Component to a Debian Repository.

  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 Debian Repository), 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: