If you have been a Linux user for quite a while, you probably want to use multiple distros on your machine. Now it is possible because of a great tool called Distrobox. It allows you to create a container on your Linux system using Podman or Docker. These containers are integrated with hosts to enable users to share their home directory, external storage and USB devices, GUI apps, audio, etc.

In case you're not familiar with Distrobox but want to know more about it, don't worry. This guide will help you learn everything about Distrobox including how to use it with any Linux distro.

What Is Distrobox?

There are so many Linux-based operating systems available, and as Linux enthusiasts, we all want to use different operating systems at the same time. Distrobox offers a fantastic way to use any Linux distro right from the terminal.

In simple words, Distrobox is a command-line tool that uses Docker or Podman to provide a way to access multiple Linux OSes.

It works the same as Toolbox but simplifies everything by using POSIX sh. The environment of Distrobox is based on an OCI image, which is used for creating containers.

Distrobox aims to offer a platform to enter any container quickly and use it as a default environment for the terminal. This is why many Linux users prefer Distrobox instead of Toolbox. Distrobox is not complex at all because it only includes six commands. Here is the list of basic commands available in Distrobox:

Command

Description

distrobox-create

Creates a container

distrobox-enter

Provides access to the container

distrobox-list

Lists the containers created by Distrobox

distrobox-init

It is an entry point of a container

distrobox-export

Exports the services and apps from one container to a particular host

distrobox-rm

Deletes a container

distrobox-stop

Stops a running container

How to Install and Use Distrobox

Let's look at the way to install and use Distrobox on Linux. We are using Ubuntu to give you a step-by-step explanation of how to use it but the steps are more or less the same for other Linux distros as well.

First, open the Linux terminal and execute the following command to download and execute the Distrobox installation script:

        curl https://raw.githubusercontent.com/89luca89/distrobox/main/install | sudo sh
    

If you get the "curl: command not found" error, you should install cURL on Linux and run the above command again. Now it's time to install and set up Docker for Distrobox, so execute the following command to install Docker on Linux:

        sudo apt install docker.io -y
    

After installing Docker, run the below commands for starting and enabling the Docker service:

        sudo systemctl enable --now docker
    

You can also run the following command to check the active status of the Docker service:

        sudo systemctl status --now docker
    

Output:

the Docker serivce status

Now issue the following command for adding the current user to the Docker group named "docker":

        sudo usermod -aG docker $USER
    

Once you are done, allow the system to check the newly changed Docker group:

        newgrp docker
    

After successfully installing Distrobox and Docker, create a Docker container for Distrobox. Let's assume you want to use AlmaLinux from the terminal. Run the following command to proceed:

        distrobox create --image almalinux:latest --name alma

Output:

Running the command to create an OS image on Docker

The above command will automatically deploy the latest version of AlmaLinux for Distrobox. Finally, start Distrobox and access the Docker container:

        distrobox-enter --name alma
    

Output:

Terminal name is changed to alma

After issuing the command, you'll notice that your terminal prompt will change to "alma." It means you're now using AlmaLinux from the Ubuntu terminal.

For example, the system shows a "command not found" error when you execute the sudo apt update command. However, sudo yum update works well in the terminal because AlmaLinux supports YUM instead of APT.

Terminal window image with apt and yum command execution

Once you create multiple containers for Distrobox, you can quickly check out the complete list of containers available on the system using:

        distrobox-list

Output:

Terminal window with Distrobox containers list

Note that you shouldn't use sudo with the above command because it'll display an error "/usr/local/bin/distrobox-list as sudo is not supported."

To remove any container from the list, execute the command given below.

        distrobox-rm --name rocky
    

Output:

Deleting Container from Terminal

After running the command, the system will ask for your confirmation, so type "Y" to proceed with the deletion process. You can change the name rocky in the aforementioned command to any other container that you want to delete from the system.

There is a command-line tool called Neofetch using which you can check the current operating system with its related information and logo. Let's install it in the AlmaLinux system using the following commands:

        dnf install epel-relase
dnf install neofetch

Make sure you enter the AlmaLinux Distrobox container first and then install Neofetch. Otherwise, it will not work as the host system runs Ubuntu. We are already inside the container and using AlmaLinux, so we executed the above commands directly.

If you're running some other Linux distribution inside Distrobox, install Neofetch using the following commands:

For Debian/Ubuntu:

        sudo apt install neofetch
    

On Arch Linux and its derivatives:

        sudo pacman -S neofetch
    

Now, launch the Neofetch utility from the terminal by executing the neofetch command, and you will get an output like this:

Almalinux related information

Here, you will get all the information about the current operating system with its official logo. We recommend you to use Neofetch with Distrobox as it helps in verifying the operating system currently running inside the terminal.

Running Different Linux Distros Inside the Terminal

So this was a detailed description of Distrobox and the complete method to install and set it up on any Linux distro. For this guide, we have used Ubuntu to show the step-by-step procedure. Distrobox is an excellent tool to test your scripts and commands on multiple operating systems using only a single system.

Moreover, we have also included some essential tricks you need to know while using Distrobox on Linux. Ensure that you first set up the Docker container and then install Distrobox because it will become simple for you to use the tool this way. Distrobox is becoming popular because POSIX sh simplifies everything and makes it easy to access any Linux OS from the terminal.