How to run multiple Linux distros inside Terminal using Distrobox

If you've been a Linux user for a while, you'll probably want to use multiple distributions on your machine. Now it's possible thanks to a great tool called Distrobox.

It allows you to create containers on your Linux system using Podman or Docker. These containers are integrated with servers to allow users to share home folders, external storage and USB devices, GUI applications, sounds, etc.

This guide will help you learn everything about Distrobox including how to use it with any Linux distribution.

How to install and use Distrobox

Let's see how to install and use Distrobox on Linux. The article is using Ubuntu to provide detailed step-by-step instructions on how to use this tool, but the steps will be the same on other Linux distributions.

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

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 commands below to start and enable the Docker service:

sudo systemctl enable --now docker

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

sudo systemctl status --now docker

Output:

Picture 1 of How to run multiple Linux distros inside Terminal using Distrobox

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

sudo usermod -aG docker $USER

Once you're done, allow the system to check out the newly changed Docker bucket:

newgrp docker

After successfully installing Distrobox and Docker, create a Docker container for Distrobox. Assuming you want to use AlmaLinux from the terminal, run the following command to continue:

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

Output:

Picture 2 of How to run multiple Linux distros inside Terminal using Distrobox

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

distrobox-enter --name alma

Output:

Picture 3 of How to run multiple Linux distros inside Terminal using Distrobox

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

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

Picture 4 of How to run multiple Linux distros inside Terminal using Distrobox

When you create multiple containers for Distrobox, you can quickly view the complete list of containers available on the system using:

distrobox-list

Output:

Picture 5 of How to run multiple Linux distros inside Terminal using Distrobox

Note that you should not use sudo with the above command as it will show the error "/usr/local/bin/distrobox-list as sudo is not supported".

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

distrobox-rm --name rocky

Output:

Picture 6 of How to run multiple Linux distros inside Terminal using Distrobox

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

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

dnf install epel-relase dnf install neofetch

Make sure you import the AlmaLinux Distrobox container first and then install Neofetch. Otherwise, it won't work when the host system runs Ubuntu. The example was inside the container and using AlmaLinux, so the above commands were executed directly.

If you are running some other Linux distro inside Distrobox, install Neofetch with these 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 the following output:

Picture 7 of How to run multiple Linux distros inside Terminal using Distrobox

Here you will get all information about current operating system with its official logo. The article recommends using Neofetch with Distrobox because it helps verify the operating system currently running inside the terminal.

Update 14 April 2022
Category

System

Mac OS X

Hardware

Game

Tech info

Technology

Science

Life

Application

Electric

Program

Mobile