Skip to content

Working with Debian

Introduction

As of version 3.6.0, it is now possible to manage Debian packages using RepoForge.io. This document is a quick start guide for how to manage Debian packages in RepoForge.io.

We have provided a detailed tutorial on how to publish Debian packages to RepoForge on our blog site here

Pushing Debian packages to RepoForge.io

This guide assumes that you already have a valid Debian package file, e.g. my-package_1.0.0_arm64.deb, that you would like to upload to RepoForge.

Step 1 - Get your unique Debian RepoForge.io URL

You can retrieve your URL from the RepoForge.io dashboard - simply login, click on Debian > Show me how to publish packages. And you'll see your unique URL: Debian repository URL

You'll need to replace the RepoForge.IO URLs used in the below examples with your own URL.

Step 2 - POST your Debian package to your URL

There are a number of ways to do this - the below script using Python's request module is just one option:

python
import requests

with open("my-package_1.0_all.deb", "rb") as f:
    response = requests.post(
        "https://api.repoforge.io/debian/my-repoforge-hash/",
        files={"content": f}, 
        auth=("chris@packagr.app", "${MY_REPOFORGE_PASSWORD}")
    )
    assert response.status_code == 200

Once you've run the above script, refresh the Debian packages page of the dashboard, and you should be able to see your newly-created package:

Debian package list

And that's it! Your package is now available in RepoForge.io, ready for you to use

Installing Debian packages saved in RepoForge.io

Once you've created your package, you'll presumably need to deploy it somewhere. To do this, you'll need to:

  • Download the RepoForge.io public key to your target.
  • Add your RepoForge.io Debian repository as an apt source.
  • Add your credentials so your target can authenticate reqeuests to RepoForge.io properly.

For the sake of this example, I am using Ubuntu version 20.04. Other distros/versions may behave slightly differently, although the main principal is the same.

Step 0 - A few prerequisites

There are few dependencies that your linux distro will need to be able to complete this process, so let's start by installing them:

bash
apt-get update && apt-get install wget gpg gnupg ca-certificates nano -y

Some of the above packages may already be installed on your system

We have installed 5 things here:

  • wget, which we'll us to download the RepoForge.io public key later
  • gpg, gnupg and ca-certificates, which will allow apt to sign requests to RepoForge.io
  • nano, which we'll use to edit some configuration files later. Feel free to use your own preferred editor

Step 1 - Download the RepoForge.io public key to your target.

In the version of Ubuntu being used here, the GPG certificates trusted by apt are all stored at /etc/apt/trusted.gpg.d/, so we'll download the RepoForge.io public key here, too:

bash
cd /etc/apt/trusted.gpg.d/
wget https://api.repoforge.io/debian/my-repoforge-hash/repoforge.public.key

Step 2 - Add your RepoForge.io Debian repository as an apt source.

Next, we can add a new apt src. First, we'll cd into the folder where your apt repos are stored, which in the case of Ubuntu is /etc/apt/sources.list.d/ then create a new apt source file for RepoForge.io:

bash
cd /etc/apt/sources.list.d/
nano repoforge.list

# then add the below content to your file:
deb [signed-by=/etc/apt/trusted.gpg.d/repoforge.public.key] https://api.repoforge.io/debian/my-repoforge-hash/raiDf1l/ my-package main

The signed-by variable is a path to the public key you downloaded earlier.

Step 3 - Add your RepoForge.io credentials

By default, all packages uploaded to RepoForge are private. You will therefore have to set your credentials on the target machine so that apt knows how to authenticate requests to RepoForge.io.

On Ubuntu, apt auth credentials are stored in the /etc/apt/auth.conf.d/ path:

bash
cd /etc/apt/auth.conf.d/
nano repoforge

# add the below content to the file
machine https://api.repoforge.io
  login     chris@repoforge.io
  password  secret-password

Step 4 - Install the package

Finally, we should be able to install the new package like this:

bash
apt-get update && apt-get install my-package