Uploading and Downloading a Debian Package via the Client
CodeArts Artifact can connect to local Debian clients. You may upload your private packages from your local Debian client to self-hosted repos and share them with others, who can download these Debian packages through their clients.
Debian Package
Debian packages are packages released through the package management system, such as Advanced Package Tool (APT), for the Debian GNU/Linux distribution. These packages contain all files required to install, configure, and use the software.
Constraints
The repository password for a self-hosted repo is account-specific. If you are prompted for a password while using a different account, download the configuration file from the repository's Tutorial tab to obtain it.
Prerequisites
- The client tool is apt. Ensure that the Ubuntu or Debian system has been installed. The apt repository source configuration file is sources.list in /etc/apt/ of the user root directory.
- You have created a Debian repository.
- You have the Download/View permission on the current repository. For details about how to obtain this permission, see Configuring Repository Permissions.
Debian Configuration
The Debian repository provides the apt configuration, which can be added to the /etc/apt/sources.list file of the OS.
- Access self-hosted repos using your Huawei Cloud account.
- Select the target Debian repository on the self-hosted repo page.
- Click Tutorial in the upper right corner of the repository page.
- In the displayed dialog box, click Download Configuration File.
- Run the commands in the configuration file.
The configuration file provides two methods for adding the Debian repository to the apt configuration. The first method is used as an example.
sudo sh -c "echo 'deb <REPO_URL> <DISTRIBUTION> <COMPONENT>' >> /etc/apt/sources.list"
sudo sh -c "echo 'machine <HOST> login <USERNAME> password <PASSWORD>' >> /etc/apt/auth.conf"
Table 1 Parameters Item
Description
REPO_URL
Repository address, which can be obtained from the configuration file.
HOST
Domain name in the repository address.
DISTRIBUTION
Release version name, which is the name of the first-level directory under dists, as shown in the following figure.

COMPONENT
Component name, which is the name of the second-level directory under dists, as shown in the following figure.

USERNAME
Username, which can be obtained from the configuration file.
PASSWORD
User password, which can be obtained from the configuration file.
Downloading GPG public keys
- Access self-hosted repos using your Huawei Cloud account.
- Select the target Debian repository on the self-hosted repo page.
- Click Tutorial in the upper right corner of the repository page.
- In the displayed dialog box, set Select purpose to Download and click Downloading the Public Key, as shown in the following figure:

- Add the GPG public key. Run the following three commands to add the GPG public key.
gpg --import <PUBLIC_KEY> gpg --list-signatures gpg --export --armor <SIG_ID> | apt-key add -
Parameter description:
- [PUBLIC_KEY]: path of the downloaded GPG public key.
- [SIG_ID]: obtained after running gpg --import <PUBLIC_KEY>. For details, see the following figure:

- Refresh the local cache.
apt-get update
Publishing a Debian Package Using the Client
You can publish a Debian package to self-hosted repos on your local client by using the REST API. For example:
curl -k -u "<USERNAME>:<PASSWORD>" -X PUT " <REPO_URL>/<DEBIAN_PACKAGE_NAME>;deb.distribution=<DISTRIBUTION>;deb.component=<COMPONENT>;deb.architecture=<ARCHITECTURE>" -T <PATH_TO_FILE>
The table below describes the parameters.
| Item | Description |
|---|---|
| REPO_URL | Repository address, which can be obtained from the configuration file. |
| DISTRIBUTION | Release version name, which is the name of the first-level directory under dists, as shown in the following figure.
|
| COMPONENT | Component name, which is the name of the second-level directory under dists, as shown in the following figure.
|
| USERNAME | Username, which can be obtained from the configuration file. For details, see Debian Configuration. |
| PASSWORD | User password, which can be obtained from the configuration file. For details, see Debian Configuration. |
| PATH_TO_FILE | Local file path. |
Downloading a Debian Package via the Client
- Configure the current Debian repository as the apt source and add the GPG public key by referring to Debian Configuration.
- Download the package.
apt download <PACKAGE>
<PACKAGE> specifies the package name.
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

