Installing Linux on a virtual machine (VM) enables us to understand Linux's effectiveness and flexibility without having to change our main operating systems. Using virtual machines enables people to use more than one operating system at the same time on one machine, it enhances a safe place in testing, development, learning. This guide will walk you through the steps to install Linux on a virtual machine, ensuring a smooth and efficient process.
Here, we will focus on installing the popular Linux distribution Ubuntu using VirtualBox, a widely used VM software. The step-by-step process includes downloading VirtualBox, creating a virtual machine, and installing the latest Ubuntu version.
These instructions are also applicable to other Linux distributions with minor adjustments.
Steps to Install Linux on a Virtual Machine
The first step is to choose the right virtualization program for you. Here are some popular choices:
- VirtualBox (Available for free and open-source)
- VMware Workstation Player (Free for individual download only)
- Hyper-V (Included in Windows professional and enterprise editions)
Installation of Oracle VirtualBox
Oracle VirtualBox is a virtualization tool that allows users to run other operating systems on a host OS. For example, you can install Ubuntu on your Windows 11 system virtually using VirtualBox.
Step 1 : To download VirtualBox, visit the Virtualbox website and choose the right version for your OS.
Installling Oracle Virtual BoxChoose the correct package to download VirtualBox based on your primary OS (Operating System). Here we are using windows operating system so will choose Windows Hosts package to download.
Step 2 : Run the downloaded setup or exe file. If it asks for making changes on your device, click Yes.
Step 3: Click Next on setup wizard. It will redirect you to "custom setup" dialog box where you can choose or change the features that will be going to installed on you system.
Here, we will not make any changes. Click on Next, it will ask "Proceed with the installation ?", Click yes to go to next menu. Then, click on install. It will take some time to install on your system, basically depends on system to system. After that, click on finish.
Installing Linux Using a Virtual Machine
Step 4: Upon installation of VirtualBox onto your device, launching the application will result in the appearance of the Virtualbox Manager window.
You will find options for generating and incorporating VMs on VirtualBox. This is the screen you will see any VMs you had made before. Click on the “New” button to generate a new VM. You will be asked for a VM name and a path to where VM files will be saved.
The operating system (OS) you intend to install may be like, Windows, macOS or Linux. Also, the OS version you will install, e.g., Ubuntu or Debian, will be required.
Step 5: Click on the “New” button to generate a new VM. You will be asked for a VM name, path to where VM files will be saved and an ISO image. The operating system (OS) you intend to install may be like, Windows, macOS or Linux. Also, the OS version you will install, e.g., Ubuntu or Debian, will be required.
For this tutorial or article, we are using Ubuntu which is Linux-distribution. You can choose other Linux distributions also.
Download the latest LTS version of Ubuntu. At the time of writing this article, the latest available version for Ubuntu is 24.04 LTS. Select the ISO image file which you have downloaded, type and version will automatically deducted by the prompt. Click on Next to proceed further.
Step 6: For Ubuntu, VirtualBox supports creating a username, password, and specifying the hostname. You can decide to customize it or go with the defaults. Click on Next.
Step 7: Later on, in running your virtual machine, what you need is to allocate it some memory & CPU. Please plan to assign half of what system resources are there for utilization during functioning of your VM. For example, if there are 16GB of memory (RAM), it would be wise enough to allocate just 8GB of RAM.
Step 8: Allocate the Hard disk size for the VM. Allocate at least 20 GB of storage. Click on Next.
Step 9: A summary of all of your choices is shown to you now, and it is necessary to launch and initiate the installation of the Linux OS as a virtual machine. Then Click on Finish.
After clicking Finish, Ubuntu will start and it will install Linux as a virtual operating system. Just wait for few minutes until it finishes installation and start the virtual operating system.
Step 10: Choose your password for your Ubuntu OS. In case, if you don't want to login with password, you can tick "Login automatically" option. Click on Continue. Welcome prompt will appear on your OS. It will take some time as it is copying some essential files.
IDo not worry about the special configuration as everything shall be seamless. After installing it, you will be requested to follow first time setup options normally followed on Ubuntu so that you can choose anything that concerns you such as Ubuntu Pro subscription and privacy settings.
And that’s it. You’re all set!
Enable Fullscreen and Clipboard Support
The Linux VM might not resize to full screen automatically. To fix this:
Step 1: Open Terminal and run:
sudo apt update
Step 2: Then install the required packages:
sudo apt install -y build-essential linux-headers-$(uname -r)
Step 3: In VirtualBox menu, go to Devices > Insert Guest Additions CD image.
Step 4: If it doesn’t autorun, open the disk, right-click -> Open in Terminal.
sudo ./VBoxLinuxAdditions.run
Step 5: Enter your password and press Enter and after completion, reboot your VM.
Once rebooted, resizing the window will now adjust the display properly.
Benefits of Using a Virtual Machine
Using virtual machines (VMs) comes with a lot of benefits that can really improve the efficiency and flexibility of your IT infrastructure:
- Better Resource Utilization: You can run multiple VMs on one physical machine, which makes the most out of your hardware.
- Enhanced Security and Stability: Since each VM operates in its own environment, issues in one VM won’t affect the others.
- Scalability: It’s super easy to add or remove VMs as your needs change, which makes scaling up or down a breeze.
- Cost Effective: Less hardware cost as fewer physical machines below this number of physical machines.
- Good for Testing: very useful for testing because separate environments are created for this purpose only on a VM so that the main systems are not exposed to danger.
- Disaster Recovery: Simpler data backup and recovery by merely duplicating and restoring VMs.
- Seamless Migration: When it comes to VMs, the process of shifting workloads from one physical server unit (or even data center) to another is pretty easy.
- Snapshots and Cloning: The fact that you are able to have a snapshot or clone the VM makes management as well as restoration very easy.
Also Read:
Conclusion
Installing Linux on a virtual machine provides a secure and efficient way to explore its features without making changes to your main operating system. By following the steps in this guide, you can set up a reliable environment for testing, development, or learning.
Using tools like VirtualBox and Ubuntu makes the process seamless and accessible, offering a safe and flexible platform for experimentation. Whether you are new to Linux or looking to expand your skills, this setup is a great way to get started.
Similar Reads
Best Virtual Machines for Kali Linux For many cyber professionals and experts, Kali Linux is an influential and multifaceted penetration testing and ethical hacking distribution. Although the direct installation of Kali Linux on hardware is one means, virtual machines grant flexibility and the ability to conduct safe test runs. This ar
7 min read
What is Linux Virtual Machine Whether youâre a developer, student, or IT professional, Linux VMs act as your personal sandbox, letting you safely explore, innovate, and break things without consequences. With a Linux VM, you can spin up a fully functional Ubuntu desktop inside Windows, host a Debian server on your MacBook, or ev
9 min read
How to Install Santoku on a Virtual Machine ? Santoku is a bootable Linux distribution that is focused on mobile forensics, analysis, and security. It comes with pre-installed platform drivers SDKs, and utilities and also allows auto-detection and setup of new connected mobile devices. It is a free and open community project sponsored by NowSec
3 min read
Create Linux Virtual Machine in Microsoft Azure Virtual Machines create a software environment that mimics computer hardware. An operating system can then be installed into this environment, this OS is called "guest OS". The operating system installed on the physical computer is called âhost OS". A Linux Virtual Machine is simply a virtual machin
3 min read
Installing Knoppix on virtual box KNOPPIX is a compilation of GNU/Linux software, which runs completely from CD, or flash disk. It automatically detects and supports a wide range of graphics adapters, sound cards, USB devices, and other devices. It is not necessary to install on a fixed disk. Because of its transparent decompression
3 min read