DEB Files on Arch? Run Any App on any Linux distro with this tool

Configurare noua (How To)

Situatie

hero-1.png (1140×759)

Frustrated by an app’s absent or lagging support for your preferred distro? Like magic, Distrobox runs applications from different Linux distributions right on your Linux computer. They’re running on your computer, yet they’re in their own native distribution.

Solutie

A container, on the other hand, only contains the minimum amount of operating system and tools to run the programs that the container is dedicated to supporting.Because containers are lightweight and computationally cheaper than traditional virtual machines, they can be launched very quickly and controlled programmatically. Scripts can control their creation, use, shut-down, and removal. This makes them ideal for such things as development and test environments, and providing automatic scalability for cloud-based services.

Just as they are with virtual machines, the applications inside containers are isolated from the host system. That’s a good thing in most scenarios, but it’s a showstopper if you want to use a program that’s installed inside a container as though it’s installed on your own physical computer.

How Distrobox is Different

Distrobox is a way to create and manage containers that are integrated with the host computer. You can run programs inside the container that appear on the desktop of the host computer. Those applications can access your home directory on the host computer, allowing them to save files in your actual home directory, and not inside the container.

It allows two copies of an application, one on your physical computer and one in the container, to share the configuration files of the host computer. So a browser in the container, for example, can use the bookmarks stored in the configuration files on your physical computer.

Distrobox containers also benefit from hardware pass-through. If you plug in a USB device, for example, the container can see it too.

You can choose from a wide selection of Linux distributions when you create a Distrobox containers. And because you can install applications into the container using the container’s package manager, you can overcome difficulties you may have installing a package directly onto your own computer.

Perhaps a package is notoriously difficult to install on your chosen distribution, or the version in your repositories is outdated, or not in the repositories at all. You may be able to find a Flatpak for that application, or you may be happy to build it from source.

Distrobox takes away the pain, and gives you a way to install and run applications that are difficult to find or otherwise problematic for your distribution.

How to Install Distrobox

Distrobox uses either Docker or Podman as the underlying container management system. We’re going to use Docker. If you don’t already have Docker on your computer you’ll need to install it.

Docker is available in the repositories of the major distributions. To install Docker on Ubuntu, use this command. They added the “io” to the package name to differentiate it from another application in the Ubuntu repositories that was already using the name “docker.”

sudo apt install docker.io

On Fedora the command is:

sudo dnf install docker

On Manjaro you need to type:

sudo pacman -S docker

On all distributions, you need to create a user group and add yourself to that group. This allows you to use Docker in a rootless fashion, which is more secure than giving Docker root access to your system.

We create the group with groupadd command.

sudo groupadd docker

Docker may have created the group for you. If that’s the case, you’ll be told it already exists. Either way, we need to add you to that group, using the usermod command.

sudo usermod -aG docker $USER

You’ll need to log in and out to activate your group membership.

Installing Distrobox

Installing Distrobox is even easier than installing docker. On Ubuntu, the command to use is:

sudo apt install distrobox

On Fedora type:

sudo dnf install distrobox

On Manjaro, the syntax is:

sudo pacman -S distrobox
Creating a Distrobox Container

We’re now ready to create a container. This step requires an image file. The Distrobox command downloads the image for us, so we need to know the web address our image resides at.

We can select the image we want to use from the list on the Distrobox website. The list is in alphabetical order by distribution name, starting at AlmaLinux and finishing at Void Linux.

Many distributions are available in several versions. For example, Fedora is available in versions 35, 36, 37, 38, and 39, and Fedora Rawhide is available too. Versions that have “toolbox” added to their name include a set of default programs. Those without “toolbox” are lightweight images.

We’re going to create an Arch Linux container. Copy the web address for the image you’re going to use, and paste it into the following command.

distrobox create -i quay.io/toolbx-images/archlinux-toolbox:latest -n "Arch-Db-1"

We’re using the Distrobox create command to create a container. The -i (image) option tells Distrobox which image to use. The -n (name) option sets a name for the container. It also becomes the host name for the virtual computer inside the container.

You’re prompted to download the image to your computer. Press Y and hit the Enter key.

All the downloads we tried were surprisingly fast. When you return to the command prompt, use the Distrobox enter command to launch and enter our new Arch Linux container.

distrobox enter Arch-Db-1

There’s some housekeeping to be performed the first time the container is launched. On our test machine this took one or two minutes.

When you’re returned to the command prompt, take a look at it. It’ll say the name of the container you’ve created and entered. You’re now inside an Arch Linux container.

Using Apps inside a Container on the Host

To prove a point, we’ll use the Arch package manager, pacman, to install neofetch.

sudo pacman -S neofetch

Running neofetch shows we’re inside an instance of Arch Linux, running on a VirtualBox virtual machine that we know is running Ubuntu.

We can install any application in our container, either from the Arch repositories or from the AUR, and run them on our host computer.

Running the ls command shows the home directory of our Ubuntu host computer.

We created a file called “MyUbuntuDocument.md” on our host computer, and it is visible and accessible inside our container.

Using Graphical Apps Inside a Container on the Host

Let’s install and run an application inside our Arch container that uses a graphical interface.

sudo pacman -S opera

As soon as it is installed, we can type “opera” to launch the browser from our Arch Linux command prompt. But Distrobox lets us start the program from outside the container, from our host computer’s command prompt.

distrobox-enter -T -n Arch-Db-1 -- "opera"

The -T (no tty) option supresses the creation of a new terminal window. -n (name) command tells Distrobox which container to look inside for the command. The “–” (end of arguments) option is a flag that tells Distrobox everything that follows is part of the command that should be launched.

Opera is launched and runs on your desktop as though you had installed it on the host computer.

To make life easier, the command to launch the application could be saved as an alias, or put inside a desktop file on the host computer.

It’s clear that the launched application has access to your host computer. By looking inside the “~/.config” directory on the host computer, we can see that an “opera” directory has been created. The browser is storing its settings on the Ubuntu host.

Other Useful Commands

To exit from a container, type “exit” and hit “Enter.”

You’ll see the prompt return to that of your host computer. The container is still running though. If you want to shut down the container, use the stop command.

distrobox stop Arch-Db-1

You need to confirm that you really do want to stop the container.

To see which containers you’ve created, use the list command.

distrobox list

Color is used to highlight which containers are running and which are not.

You can remove, as in delete, a container with the distrobox rm command.

distrobox rm OpenSuse-1

Tip solutie

Permanent

Voteaza

(6 din 11 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?