Yandex Cloud
Search
Discuss with expertTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
    • Cloud Interconnect
    • Cloud Backup
    • Cloud Registry
    • Yandex AI Studio
    • Compute Cloud
    • Object Storage
    • Managed Service for Kubernetes®
    • Yandex BareMetal
    • Smart Web Security
    • Security Deck
    • Managed Service for PostgreSQL
    • Managed Service for ClickHouse®
    • Monium
    • Cloud CDN
    • Network Load Balancer
    • Virtual Private Cloud
    • Cloud DNS
    • Application Load Balancer
    • Yandex Cloud Video
    • Stackland
    • Yandex Cloud Router
    • Yandex Managed Service for Trino
    • Managed Service for MySQL®
    • Managed Service for Valkey™
    • Managed Service for Apache Spark™
    • Yandex StoreDoc
    • Managed Service for OpenSearch
    • Managed Service for Apache Kafka®
    • Data Transfer
    • Yandex MPP Analytics Engine for PostgreSQL
    • Yandex Managed Service for Apache Airflow®
    • Data Processing
    • Yandex MetaData Hub
    • Managed Service for YDB
    • Managed Service for Sharded PostgreSQL
    • Managed Service for YTsaurus
    • Yandex WebSQL
    • DataLens
    • Yandex Search API
    • SpeechSense
    • SpeechKit
    • DataSphere
    • Vision OCR
    • Translate
    • Yandex Identity Hub
    • Key Management Service
    • Certificate Manager
    • Yandex Lockbox
    • Audit Trails
    • SmartCaptcha
    • Cloud Desktop
    • Yandex SIEM
    • SourceCraft Code Assistant
    • Container Registry
    • Managed Service for GitLab
    • Managed Service for Prometheus®
    • Cloud Functions
    • API Gateway
    • Yandex Cloud Postbox
    • Message Queue
    • Serverless Integrations
    • IoT Core
    • Data Streams
    • Serverless Containers
    • Cloud Notification Service
    • Yandex Query
    • Identity and Access Management
    • Yandex Cloud Console
    • Resource Manager
    • Yandex Cloud Billing
    • Yandex Cloud Quota Manager
    • Cloud Apps
  • System Status
  • Marketplace
    • Featured
    • Infrastructure & Network
    • Data Platform
    • AI for business
    • Security
    • DevOps tools
    • Serverless
    • Monitoring & Resources
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
    • Price calculator
    • Pricing plans
  • Customer Stories
  • Documentation
  • Blog
© 2026 Direct Cursus Technology L.L.C.
Yandex Cloud Registry
  • Getting started
    • All guides
        • Configuring APT
        • Pushing a Debian package to a registry
        • Pulling a Debian package from a registry
      • Deleting an artifact from a registry
    • Creating a lifecycle policy
  • Access management
  • Pricing policy
  • Terraform reference
  • Audit Trails events

In this article:

  • Preparing a GPG key
  • Configuring APT
  • Adding a registry to the APT sources list
  • Adding authentication credentials
  1. Step-by-step guides
  2. Managing artifacts
  3. Debian artifact
  4. Configuring APT

Configuring the APT package manager

Written by
Yandex Cloud
Updated at August 4, 2026
View in Markdown
  • Preparing a GPG key
  • Configuring APT
    • Adding a registry to the APT sources list
    • Adding authentication credentials

This guide describes how to configure the APT package manager (Advanced Package Tool) to work with the Debian registry in Yandex Cloud Registry.

Preparing a GPG keyPreparing a GPG key

A GPG key is required for a registry with signed metadata. The signature allows clients to verify the authenticity of packages using the GPG key.

  1. Generate a GPG key using the GnuPG utility:

    gpg --full-generate-key
    

    When prompting for passphrase, leave this field empty.

  2. Find the ID of the created GPG key:

    gpg --list-secret-keys --keyid-format=long
    

    Result:

    /home/user/.gnupg/secring.gpg
    ------------------------------
    sec   4096R/<GPG_key_ID> 2024-01-01 [expires: 2026-01-01]
    uid                          User Name <user@example.com>
    ssb   4096R/XXXXXXXXXXXXXXXX 2024-01-01
    
  3. Export the secret part of the GPG key:

    gpg --armor --export-secret-keys <GPG_key_ID>
    
  4. Save the secret part of the GPG key in a Yandex Lockbox secret under the gpg_secret_key_value key:

    yc lockbox secret create \
      --name <secret_name> \
      --payload "[{'key': 'gpg_secret_key_value', 'text_value': '$(gpg --armor --export-secret-keys <GPG_key_ID>)'}]"
    
  5. Grant access to the contents of the secret to the Cloud Registry service agent by assigning it the lockbox.payloadViewer role for this secret:

    yc lockbox secret add-access-binding \
      --id <secret_ID> \
      --role lockbox.payloadViewer \
      --agent cloud-registry:control-plane \
      --cloud-id <cloud_ID>
    
  6. Save the public part of the GPG key; the registry users will need it:

    gpg --armor --export <GPG_key_ID> > public-key.asc
    

Configuring APTConfiguring APT

To configure APT, add:

  • Registry to the APT sources list.
  • Authentication data to the /etc/apt/auth.conf file.

Your method of adding a registry to the APT sources list will vary depending on registry format and source type.

Adding a registry to the APT sources listAdding a registry to the APT sources list

Local registryLocal registry

With metadata signing
Without metadata signing
  1. Copy the public GPG key to the APT trusted keys directory:

    cp /path/to/public-key.asc /usr/share/keyrings/ycr-pub.asc
    

    Where /path/to/public-key.asc is the path to the file with the public GPG key.

  2. Add the registry to the APT sources list:

    echo "deb [signed-by=/usr/share/keyrings/ycr-pub.asc] https://registry.yandexcloud.net/debian/<registry_ID> <distribution> <component>" \
      >> /etc/apt/sources.list
    

Add the registry with the trusted=yes parameter:

echo "deb [trusted=yes] https://registry.yandexcloud.net/debian/<registry_ID> <distribution> <component>" \
  >> /etc/apt/sources.list

Remote registryRemote registry

Public source
Custom source
  1. Install the distribution public key package:

    • For Debian:

      sudo apt install debian-archive-keyring
      

      The key will be available at /usr/share/keyrings/debian-archive-keyring.gpg.

    • For Ubuntu:

      sudo apt install ubuntu-keyring
      

      The key will be available at /usr/share/keyrings/ubuntu-archive-keyring.gpg.

  2. Add the registry to the APT sources list:

    echo "deb [signed-by=<path_to_key>] https://registry.yandexcloud.net/debian/<registry_ID> <distribution> <component>" \
      >> /etc/apt/sources.list
    

    Where:

    • <path_to_key>: Path to the distribution key file, for example /usr/share/keyrings/debian-archive-keyring.gpg or /usr/share/keyrings/ubuntu-archive-keyring.gpg.
    • <registry_ID>: Registry ID.
    • <distribution>: Distribution, e.g., bookworm, bullseye, or focal.
    • <component>: Repository component, e.g., main.
Signed with a GPG key
Not signed with a GPG key
  1. Save a GPG key to the trusted keys directory:

    cp /path/to/upstream-public-key.asc /usr/share/keyrings/upstream-pub.asc
    

    Where /path/to/upstream-public-key.asc is the path to the public key file of the source repository (upstream).

  2. Add the registry to the APT sources list:

    echo "deb [signed-by=/usr/share/keyrings/upstream-pub.asc] https://registry.yandexcloud.net/debian/<registry_ID> <distribution> <component>" \
      >> /etc/apt/sources.list
    

Specify the trusted=yes parameter so that APT accepts packages without authentication:

echo "deb [trusted=yes] https://registry.yandexcloud.net/debian/<registry_ID> <distribution> <component>" \
  >> /etc/apt/sources.list

Adding authentication credentialsAdding authentication credentials

Warning

The APT package manager does not inject environment variables into configuration files. To protect your credentials, restrict access to /etc/apt/auth.conf at the OS level.

  1. Select the authentication method:

    IAM token
    API key

    Get an IAM token for the Yandex account or service account you are going to use for authentication.

    Note

    The IAM token's lifetime is limited to 12 hours.

    Create an API key for the service account you are going to use for authentication.

    Note

    The API key maximum lifetime is set manually when you create the key.

  2. Add authentication data to the /etc/apt/auth.conf file:

    IAM token
    API key
    machine https://registry.yandexcloud.net/debian/<registry_ID>
    login iam
    password <IAM_token>
    
    machine https://registry.yandexcloud.net/debian/<registry_ID>
    login api_key
    password <API_key>
    

Useful linksUseful links

  • Pushing a Debian package to a registry
  • Pulling a Debian package from a registry

Was the article helpful?

Previous
Pushing a Go module from the registry
Next
Pushing a Debian package to a registry
© 2026 Direct Cursus Technology L.L.C.