Opkg Repositories

Create an Opkg repository in JFrog Artifactory and connect opkg to deploy and resolve packages.

Opkg, which stands for Open PacKaGe, is a lightweight package manager designed for embedded Linux systems. Opkg automates the process of installing, removing, and managing software from remote repositories known as feeds. You can use JFrog Artifactory as a fully-fledged Opkg repository to generate index files that are fully compliant with the Opkg client. For more information, see the Opkg documentation.

package_management_images_for_Opkg.png

Artifactory fully supports Opkg repositories, including the following capabilities:

  • Unified Repository Management: Consolidate all your .ipk packages by using Opkg repositories in Artifactory as a single source of truth. Set up secure local repositories and access cached versions of downloads.openwrt.org.
  • Full Automation with REST API and JFrog CLI: Natively manage and provision .ipk packages from Artifactory using the opkg client, or automate fully with the JFrog CLI and REST API to optimize software delivery.
  • Automated Metadata Calculation: Artifactory automatically calculates metadata for packages uploaded to local repositories, eliminating the need for manual indexing.
  • Flexible Key Management: Sign indexes and verify packages with GPG signatures, and manage the GPG signatures using the Artifactory UI and REST API.
  • Enterprise Readiness: Use secure, private Opkg repositories in a High Availability installation of Artifactory. Artifactory provides enterprise-ready stability, reliability, scalable storage through Cloud providers, and advanced replication options for disaster recovery.

Get Started with Opkg

To get started working with Opkg, complete the following main steps:

  1. Create an Opkg Repository
  2. Connect opkg to Artifactory
  3. Deploy Opkg Packages and Resolve Opkg Packages

Create an Opkg Repository

This topic describes how to create an Opkg repository. This is required before deploying and resolving Opkg packages. Artifactory supports the following repository types for Opkg:

  • Local repositories: Store and share first- and second-party packages with your organization
  • Remote repositories: Download packages from Opkg feeds and other remote locations or Artifactory instances

For more information on JFrog repositories, see Repository Management.

Prerequisite: You need Admin or Project Admin permissions in Artifactory to create a repository. If you don't have Admin or Project Admin permissions, the option will not be available.

To create an Opkg repository:

  1. In the Administration tab, click Repositories > Create a Repository.

    CreateAnsibleLocal1.png
  2. Select the type of repository you want to create: Local or Remote.

  3. Select the Opkg package type.

  4. Configure the required fields for the repository:

    • For local repositories, in the Repository Key field, type a meaningful name for the repository. For example, opkg-local. For more information on local repositories and their settings, see Local Repositories.

    • For remote repositories, verify the Repository URL and update as needed. For more information on remote repositories and their settings, see Remote Repositories.

      You can set the repository URL to point to a specific Opkg feed, like http://downloads.openwrt.org/chaos_calmer/15.05/adm5120/rb1xx/packages/luci, or point to a base level like http://downloads.openwrt.org/chaos_calmer/15.05/ and specify feeds in the client's opkg.conf file.

  5. Click Create Local Repository or Create Remote Repository. The repository is created and the Repositories page is displayed.

Connect opkg to Artifactory

There is no single release of the opkg client, so you must manually download, compile, and configure the client according to your environment by completing these steps:

  1. Compile and Install the opkg Client
  2. Configure opkg to Work with Artifactory
  3. Configure Signature Verification

Next steps:

Compile and Install the opkg Client

Prerequisite: Before connecting opkg to Artifactory, you must have an existing Opkg repository in Artifactory. For more information, see Create an Opkg Repository.

📘

Note

This task includes universal commands for Unix-like systems. Commands for your environment may vary. Treat this workflow as a template, and use relevant commands that serve the specified purpose.

To compile and install the opkg client:

  1. Install the compilation dependencies using one of the following commands based on your environment:

    • Debian/Ubuntu using APT:

      sudo apt-get update && sudo apt-get install -y gcc libtool autoconf pkg-config libarchive-dev libcurl4-gnutls-dev libssl-dev libgpgme-dev
    • Red Hat/Fedora using DNF:

      sudo dnf install -y gcc libtool autoconf pkgconf libarchive-devel libcurl-devel openssl-devel gpgme-devel
    • macOS using Homebrew:

      brew install autoconf automake libtool pkg-config libarchive curl openssl gpgme
  2. Download and extract the source code of the latest stable release of the opkg client:

    wget https://downloads.yoctoproject.org/releases/opkg/opkg-<VERSION>.tar.gz && tar -zxvf opkg-<VERSION>.tar.gz

    Where:

    • <VERSION>: The version number of the latest stable release

    For example:

    wget https://downloads.yoctoproject.org/releases/opkg/opkg-0.7.0.tar.gz && tar -zxvf opkg-0.7.0.tar.gz
  3. Navigate to the extracted directory:

    cd opkg-<VERSION>

    Where:

    • <VERSION>: The version number of the latest stable release

    For example:

    cd opkg-0.7.0
  4. Run the configuration script, making sure to add --enable-gpg and --enable-curl to support signature verification and HTTPS authentication:

    ./configure --with-static-libopkg --disable-shared --enable-gpg --enable-curl --prefix=/usr/local --sysconfdir=/etc
  5. Compile and install the client:

    make && sudo make install
  6. If needed, manually create the client configuration file:

    mkdir -p /etc/opkg && touch /etc/opkg/opkg.conf

Next steps:

Configure opkg to Work with Artifactory

For your opkg client to work with Artifactory, you need to add Artifactory Opkg feeds and credentials to your opkg.conf file.

To configure the opkg client to work with Artifactory:

  1. Run the following command to add an Artifactory feed to your client:

    echo 'src <FEED_NAME> <JFROG_PLATFORM_URL>/artifactory/<REPO_NAME>/<PATH_TO_FEED>' >> /etc/opkg/opkg.conf
✅

Tip

To install the .gz variant of the package index file, replace src with src/gz.

Where:

  • <FEED_NAME>: The name of the feed
  • <JFROG_PLATFORM_URL>: The base URL of your JFrog Platform
  • <REPO_NAME>: The name of the target repository in Artifactory
  • <PATH_TO_FEED>: The path to the index file in the target repository

For example:

# Default connection using hostname and port
echo 'src artifactory-feed http://prod.mycompany:8080/artifactory/opkg-local/my-distro/1.0/i386' >> /etc/opkg/opkg.conf
# Secure connection using a standard HTTPS URL
echo 'src/gz artifactory-feed https://company.jfrog.io/artifactory/opkg-local/my-distro/1.0/armv7a' >> /etc/opkg/opkg.conf
  1. To access Artifactory feeds that require authentication, run this command to add credentials to your client:

    echo 'option http_auth <USERNAME>:<AUTH_TOKEN>' >> /etc/opkg/opkg.conf

    Where:

    • <USERNAME>: Your Artifactory username
    • <AUTH_TOKEN>: Your Artifactory identity token

    For example:

    echo 'option http_auth jeffry:<TOKEN>' >> /etc/opkg/opkg.conf
✅

Tip

You can also use an encrypted plaintext password as described in Centrally Secure Passwords.

📘

Note

You can also use JFrog Set Me Up to copy the snippet populated with your token and environment. For more information, see Use Artifactory Set Me Up for Configuring Package Manager Clients.

Next steps:

Configure Signature Verification

You can configure the opkg client to verify signatures created with your private GPG key pair.

Prerequisites:

  • Generate and upload GPG keys to Artifactory. For more information, see Manage Signing Keys.
  • Make sure gnupg is installed.

To configure signature verification:

  1. Import your GPG keys to the opkg keychain:

    • 0.3 legacy versions:

      opkg-key add key.pub
    • 0.4 versions and newer:

      mkdir -p /etc/opkg/keys
      opkg-key add key.pub
  2. Run the following command to add the check_signature option to your opkg.conf file:

    echo 'option check_signature true' >> /etc/opkg/opkg.conf
📘

Note

If resolving fails with one of the following errors:

  • opkg_verify_gpg_signature: No sufficiently trusted public keys found.
  • pkg_src_verify: Signature verification failed for <REPO_NAME>.

The trust level of the key.pub may not be high enough. Upgrade the trust level.

Deploy Opkg Packages

Prerequisite: Before deploying Opkg packages, create an Opkg repository and connect the opkg client. For more information, see Create an Opkg Repository and Connect opkg to Artifactory.

To deploy Opkg packages:

  • Run the following command to upload the package:

    curl -L -u <USERNAME>:<AUTH_TOKEN> -XPUT "https://<JFROG_HOSTNAME>/artifactory/<REPO_NAME>/<PATH_TO_FEED>/<IPK_PACKAGE_NAME>" -T <PATH_TO_FILE>

    Where:

    • <USERNAME>: Your Artifactory username
    • <AUTH_TOKEN>: Your Artifactory identity token
    • <JFROG_HOSTNAME>: The hostname of your JFrog Platform
    • <REPO_NAME>: The name of the Opkg repository in Artifactory
    • <PATH_TO_FEED>: The path to the feed in the repository
    • <IPK_PACKAGE_NAME>: The name of the .ipk package file
    • <PATH_TO_FILE>: The local path to the file you want to upload

    For example:

    curl -L -u jeffry:<TOKEN> -XPUT "https://company.jfrog.io/artifactory/opkg-local/feeds/armv7a/my-app.ipk" -T ~/builds/my-app.ipk
📘

Note

You can also use JFrog Set Me Up to copy the snippet populated with your token and environment. For more information, see Use Artifactory Set Me Up for Configuring Package Manager Clients.

Resolve Opkg Packages

Prerequisite: Before resolving Opkg packages, connect the opkg client and deploy a package to your repository. For more information, see Connect opkg to Artifactory and Deploy Opkg Packages.

To resolve Opkg packages:

  • Run the following command to install the package:

    opkg install <PACKAGE>

    Where:

    • <PACKAGE>: The name of the target package in your Artifactory repository

    For example:

    opkg install my-app

Additional Opkg Information

The following pages provide additional information about using Opkg with Artifactory:

Deploy Opkg Packages Using the UI

You can deploy an Opkg package from the Artifactory UI. For more information, see Deploy Opkg Packages.

To deploy an Opkg package using the UI:

  1. Go to Artifacts.
  2. Click the icon.
  3. Select your Opkg repository as the Target Repository.
  4. Upload the file you want to deploy.
  5. Wait about 1 minute for Artifactory to recalculate the repository index and display your upload in Artifacts.
Deploy Opkg package.jpg

REST API Support for Opkg

The Artifactory REST API provides extensive support for signing keys and recalculating the repository index as follows:

Opkg Limitations in Artifactory

The following are the limitations of Opkg in Artifactory:

  • Package index signing: Artifactory signs the repository metadata file, or the index, not individual Opkg packages themselves.

Frequently Asked Questions

This section provides answers to frequently asked questions.

plusFAQs
Q: How do I connect the opkg client to an Artifactory feed?

A: Run the echo command to add an src feed line to your opkg.conf file, using your JFrog Platform URL and repository path. For the full steps, see Configure opkg to Work with Artifactory.

Q: What do I need before I can deploy Opkg packages?

A: You need an Opkg repository in Artifactory and a connected opkg client. For more information, see Create an Opkg Repository.

Q: Why does resolving an Opkg package fail with a signature verification error?

A: Resolving fails when the trust level of your key.pub file is too low. Upgrade the trust level of the key, then resolve the package again. For more information, see Configure Signature Verification.

Q: What is the difference between local and remote Opkg repositories?

A: Local repositories store and share first- and second-party packages with your organization. Remote repositories download packages from Opkg feeds and other remote locations or Artifactory instances.

Q: Can I recalculate the repository index through the REST API?

A: Yes, you can call the REST API to recalculate the index of an Opkg repository. For more information, see REST API Support for Opkg.

Related Topics


Did this page help you?