How to Run Any Program from Any Linux Distro with Distrobox

by Joana Maria
13 minutes read

How to Run Any Program from Any Linux Distro with Distrobox

A image of a laptop computer on top of a table.

Distrobox is a rustic CLI gizmo that can boot up any Linux distro within your computer. Polymorphous VirtualBox, Distrobox evolves “overlays” that permit you to dashed any regimens from polymorphous Linux distros on top of your current mechanism. Here, permit’s inspect out what conducts Distrobox tick and how you can mount and intake it.

Web content
  • Why Application Distrobox to Juggle Multiple Linux Distros
  • Installing and Testing Distrobox
  • Sending out Your Initially Overlay Distro
  • Installing and Running Packages on Distrobox
  • Exporting an Overlay Regimen to the Host Product

Why Application Distrobox to Juggle Multiple Linux Distros

The biggest promotional juncture of Distrobox is that it runs contestants on top of the host instead of earning utilise of an isolated instance. Compared to a traditional VM, this allows you to seamlessly access your host’s abode magazine, its external equipments, and even its sport server.

A screenshot affirming Ubuntu rushing two polymorphous distros within it.

This extent of tight integration in between the lessee and the host allows you to execute a handful of distinct points with Distrobox. For instance, you can mount a GUI feat on an Ubuntu lessee and export its much faster way to your host mechanism’s desktop computer. As a geeky storyteller, I situate this serviceability handy as soon as testing and comparing polymorphous apps.

A screenshot affirming two indications of Specialty rushing on two Distrobox instances.

Ultimately, Distrobox is in a similar way extremely light-weight. This conducts it optimum for marginal-end contraptions that don’t have the sources to dashed innumerable VMs. In my debacle, rushing Ubuntu and Fedora contestants for around six hours single wolfed around 900 MB of my host’s overall RAM.

Installing and Testing Distrobox

At its core, Distrobox jobs by snagging merit of container daemons such as Docker and Podman to juggle its distros. Because of that, the first interfere deploying Distrobox is to mount Docker on your equipment.

Attest that the Docker daemon is rushing on your mechanism by examining its iteration:

docker --version

Have your current borrower to the docker mechanism group:

sudo adduser $USER docker
A incurable affirming the protocol of adding the current borrower to the Docker group.

Download and mount Distrobox earning utilise of your mechanism’s package manager:

sudo apt install distrobox

Render sure that you’ve satisfactorily installed Distrobox by rushing it with the -h flag.

A incurable affirming Distrobox aid sport.

Sending out Your Initially Overlay Distro

Using Distrobox up and rushing, you can now mount your first Linux distro overlay. For this, the founders lend a Fedora 39 OCI photograph as its default mount media.

Prelude by rushing Distrobox with the create subcommand adhered to by the tag and the hostname that you want for your brand-newfangled overlay:

distrobox create --name YOUR-OVERLAY-NAME-HERE --hostname YOUR-CONTAINER-NAME-HERE

Kind “y,” after that press Get in to tug and create your brand-newfangled overlay distro.

A incurable affirming the verification punctual for accumulating a brand-newfangled Distrobox instance.

Tab: depending on your mechanism’s equipment, it might filch in between 5 to 10 minutes to fully mount the lessee mechanism in Distrobox.

Once birthed out, dashed the cooperating with command to boot up and assimilations your brand-newfangled overlay distro:

distrobox enter YOUR-OVERLAY-NAME-HERE

Attest that you’re now within the overlay mechanism by peeking at the hostname on your incurable punctual.

A incurable accentuating the polymorphous mechanism hostname within the Distrobox instance.

To chummy an overlay session, press Ctrl + D on the lessee incurable, after that dashed distrobox stop adhered to by the tag of your overlay.

On a side note: find the power of Fedora and Red Hat Business Linux by peeking at our considerable overview on the DNF package manager.

Running a practice Linux photograph on Distrobox

Unconcerned from Fedora 39, it’s provable to dashed other OCI-compatible Linux distro within Distrobox, for instance, Arch Linux.

To mount a practice Linux distro, dashed the create subcommand with the -i flag adhered to by a web connect to an OCI-compatible photograph. In my skin, I’m participating in intake the Arch Linux Toolbx photograph from Quay.io as the substructure for my overlay:

distrobox create --name arch-linux --hostname mte-archlinux-container --image quay.io/toolbx/arch-toolbox:latest
A incurable affirming the protocol of accumulating an Arch Linux Docker container.

Tab: you can situate a list of compatible distros and their download web connects on the developer’s Github page.

After it’s birthed out, boot up the overlay and go within your brand-newfangled Arch Linux mechanism:

distrobox enter arch-linux

Simply like with Fedora, back that you’re now rushing Arch Linux by examining your incurable’s hostname.

A incurable affirming the protocol of entering a freshly collected Distrobox instance.

Installing and Running Packages on Distrobox

One of the merits of Distrobox’s tight integration is that lessee contraptions behave as if they’re aboriginal to the host equipment. Because of that, placing and rushing any regimens in Distrobox is similar to a invariant Linux mount.

To mount a package on a Distrobox lessee, first supply sure that you’re currently within your overlay distro:

distrobox enter arch-linux

Tab: you can list the readily available overlays on your mechanism by rushing distrobox ls.

Application the package manager of your lessee distro to mount the regimens that you call for. In this skin, I will most clearly dashed sudo pacman -S neofetch to mount neofetch on my Arch Linux lessee mechanism.

A incurable affirming the pacman package manager rushing within a Distrobox instance.

Test your brand-newfangled package by rushing it as soon as within the overlay and an additional outdoor it.

A incurable affirming the regimens isolation in between the Arch Linux Distrobox and the Ubuntu host mechanism.

You can in a similar way mount a regimens from outdoor the Distrobox overlay. For that, intake the enter subcommand adhered to by the -- operator:

distrobox enter --name arch-linux -- sudo pacman -s neofetch

This serviceability prolongs to rushing regimens outdoor your lessee mechanism. For instance, the cooperating with command will most clearly dashed neofetch on my Arch Linux lessee and sport its output in my Ubuntu host mechanism:

distrobox enter --name arch-linux -- neofetch
A incurable affirming the neofetch regimens within the Arch Linux instance rushing on the Ubuntu host.

Good to swipe: earning utilise of a polymorphous package manager? Consultation our handy package manager cheatsheet for polymorphous Linux distros.

Exporting an Overlay Regimen to the Host Product

While the -- operator is amazing for rustic one-off jobs, it’s in a similar way provable to create Distrobox “profiles” that permit you to dashed any lessee regimens correct from your host Linux equipment. This is handy if you want to have unending access to a regimens within your Distrobox lessee mechanism.

To export to your host equipment, first go within the mechanism where you’ve installed your regimens:

distrobox enter arch-linux

Render sure that your feat is massaging satisfactorily from within the container. In my skin, I want to export my Emacs mount within Arch Linux.

A screenshot affirming the Emacs GUI customer rushing within the Arch Linux Distrobox instance.

Dashed distrobox-export with the --app flag adhered to by the tag of the regimens that you want to export:

distrobox-export --app emacs

Test your freshly exported app by participating in your host mechanism’s feat launcher and clicking the regimens icon.

A screenshot affirming the Ubuntu feat launcher affirming the Emacs GUI customer.

Installing and rushing lessee OSes with Distrobox is purely one instance of what you can execute with Docker and container gradual technology. Snatch a deep dive into how this regimens jobs by examining out our primer on rushing and supervising Docker cans.

Pic credit history: Kari Shea via Unsplash. Unanimously alterations and screenshots by Ramces Red.

Related Posts