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:
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:
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:
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.
When you create multiple containers for Distrobox, you can quickly view the complete list of containers available on the system using:
distrobox-list
Output:
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:
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:
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.
You should read it
- 3 main types of Linux distributions that you should know
- Linux distro for new, easy to use, beautiful
- 10 best Linux distros for developers
- Top 7 best Linux terminal emulators
- How to run 2 or more Terminal commands at the same time on Linux
- Top 3 Distros for Linux for Beginners
- How to use Guake Terminal in Linux
- How to install dictionaries in Linux Terminal
- How to back up and restore Linux Terminal history
- Which Linux distros will Windows 10 put into Windows 10?
- How to play Game Boy games on Linux Terminal
- How to use Linux Terminal as a computer