Virtualization technology has made it easy for users to work on two different software platforms on their single device without needing to install more than one Operating System.
Linux Containers (LXC) is a lightweight virtualization technology that lets users run multiple Linux Distros on a single hosted Linux platform. This means that you might be loving any other Linux Distro and want to check it up without installing it on your device, then all that you can do is through using up the Linux Containers.
Steps to Run Multiple Distros Using Linux Containers
Now, you might be willing to know how you can run multiple Linux Distros using Linux Containers. To help you with that, we have written a detailed method in this article through which you could use up the Linux Containers and run up multiple Distros on any Linux OS.
Install and Configure the Linux Containers
This method can be used for Linux Mint 18 64-bit or Ubuntu 16.04 or above.
1. Install the Linux Containers on your Linux device using the command “sudo apt install lxc lxc-te” through the terminal. This will automatically install the Linux Containers on your Linux system.
2. You will need to configure your profile for the Linux Containers. For that, you need to run the below commands in the terminal:
mkdir -p ~/.config/lxc echo "lxc.id_map = u 0 1000 echo "lxc.id_map = g 0 1000 echo "lxc.network.type = ve echo "lxc.network.link = lx echo "SUSER veth lxcbr0 2"
3. To set up the user permissions, you again have to execute the below commands:
sudo usermod --add-subuids sudo usermod --add-subgids sudo cgm create all user sudo cgm chown all user $(i cgm movepid all user $$
Set up the Container
After the above step, when you have installed the LXc container, you have to follow up some steps to set up the container, and the steps are given below:
1. We will be setting the Ubuntu Container named <code>ubu1</code>, and for that, you have to execute the command “lxc-create –template downl”
2. After that, you will see the list of all supported Distro images in your terminal app. Enter the specifics or the details of the Distro you wish to install. This could also be done through the command “lxc-create -t download -n u”.
3. This will then download the image file for that Linux Distro you selected and install it on your host system. This might take some time because the distro file isn’t too small; you need to download it before.
4. After the installation, you will be ready to play that distro inside the containers on your Linux OS.
Using Multiple Distros with LXC containers:
1. Start the container using the command “lxc-start -n ubul -d” where the <code>-n</code> specifies the name of the container which you wish to start and the <code>-d</code> type makes it run on your device.
2. You can easily verify whether the container is started by the command “lxc-ls -f” in the terminal app.
3. To stop your container, you can execute the command “lxc-stop -n ubu1” while if you wish to auto-start your containers at the boot, then you could execute the command “lxc.start.auto = 1”, “lxc.start.delay = 5” run these command simultaneously without a break, and you are done.
So this was the method through which you could easily run any of your selected Linux Distro on your single Hosted Linux OS device. If you need more help running multiple distros using Linux containers, let us know in the comments. Also, if the article helped you, make sure to share it with your friends.