How to Create and Run a Virtual Machine on Linux

Virtual machines allow you to run multiple operating systems on a single physical machine. This can be very useful for testing software, running legacy applications, or creating isolated environments for development or testing. In this article, we’ll show you how to create and run virtual machines on Linux using VirtualBox.

Using VirtualBox

VirtualBox is a free, open-source virtualization software developed by Oracle Corporation. It allows users to create and run virtual machines (VMs) on a single physical computer, enabling multiple operating systems to coexist and function simultaneously. VirtualBox is available for various host operating systems, including Windows, macOS, Linux, and Solaris.

VirtualBox provides a feature-rich, user-friendly interface that simplifies the process of creating, configuring, and managing virtual machines. It supports a wide range of guest operating systems, including various versions of Windows, Linux, BSD, and others. Some notable features of VirtualBox include:

  • Snapshot functionality: Users can save the current state of a VM and revert to it later, allowing for easy testing and experimentation without the risk of damaging the virtual environment.
  • Seamless mode: This feature allows for the seamless integration of guest operating system windows with the host desktop, improving the overall user experience.
  • Shared folders: VirtualBox enables users to share folders between the host and guest systems, simplifying file exchange and improving overall workflow.
  • USB support: VirtualBox can redirect USB devices from the host machine to the guest operating system, enabling the use of peripherals such as printers, flash drives, and webcams within VMs.
  • Network options: Users can configure various network settings for VMs, including NAT, bridged networking, and internal networking, facilitating a wide range of network scenarios.

Overall, VirtualBox is a powerful, versatile, and easy-to-use virtualization solution suitable for personal, educational, and professional use.

Step 1: Open Terminal

Open the terminal by pressing Ctrl + Alt + T on your keyboard or by searching for it in the applications menu.

Step 2: Install VirtualBox

You can download the latest version of VirtualBox from the official website (https://www.virtualbox.org/). Once downloaded, you can install it using your package manager.

On Debian/Ubuntu-based distros, run:

sudo apt install virtualbox

On Fedora/RPM-based distros, run:

sudo dnf install VirtualBox

On Arch-based distros, run:

sudo pacman -S virtualbox

Step 3: Create VM

Once VirtualBox is installed, you can create a new virtual machine by clicking the “New” button in the main window. This will launch the New Virtual Machine wizard, which will guide you through the process of creating a new virtual machine. Here are the steps:

  1. Choose a name and operating system for your virtual machine.
  2. Set the amount of memory and CPU cores you want to allocate to the virtual machine.
  3. Create a new virtual hard disk or use an existing one.
  4. Set the size and format of the virtual hard disk.

Once you have completed the wizard, your new virtual machine will appear in the main VirtualBox window.

Step 4: Configure VM

Before you can start the virtual machine, you may need to configure some additional settings. Here are a few things you may want to configure:

Network: By default, the virtual machine will use the NAT network mode, which allows it to access the internet but not other devices on your network. If you want to access the virtual machine from other devices on your network, you can switch to the Bridged or Host-only network modes.

Shared folders: You can share folders between your host machine and the virtual machine by creating a shared folder in VirtualBox and then mounting it in the virtual machine.

Guest additions: Installing the VirtualBox Guest Additions in the virtual machine can improve performance and add additional features, such as better graphics and file sharing.

Step 5: Run VM

To start the virtual machine, simply select it in the VirtualBox window and click the Start button. This will launch the virtual machine in a new window, which will display the boot process of the operating system you installed. Once the operating system has booted, you can use it just like you would on a physical machine.

Using KVM, QEMU, and Virt-Manager

QEMU, KVM, and Virt-Manager are tools used for virtualization on Linux systems. They work together to create and manage virtual machines, allowing you to run multiple operating systems on a single physical machine. Here’s an overview of each tool:

  • QEMU (Quick Emulator): QEMU is an open-source emulator and virtualization tool that can run various guest operating systems. It can emulate a wide range of hardware, from CPUs to peripheral devices. QEMU performs hardware virtualization by translating guest system calls to host system calls, allowing the guest OS to run on the host system.
  • KVM (Kernel-based Virtual Machine): KVM is a virtualization technology built into the Linux kernel, allowing it to act as a hypervisor for virtual machines. KVM leverages hardware virtualization features available in modern CPUs (Intel VT-x and AMD-V) to provide near-native performance for guest operating systems. KVM works alongside QEMU to manage and run virtual machines efficiently.
  • Virt-Manager (Virtual Machine Manager): Virt-Manager is a user-friendly graphical interface for managing virtual machines. It is built on top of libvirt, a library for interacting with various virtualization technologies, including QEMU and KVM. Virt-Manager simplifies the process of creating, configuring, and managing virtual machines, making it easier for users to work with virtualization on Linux systems.

Together, these tools provide a powerful and flexible solution for virtualization on Linux. QEMU and KVM handle the low-level aspects of virtualization, such as hardware emulation and virtual machine management, while Virt-Manager provides a convenient graphical interface for creating and managing virtual machines.

Step 1: Open Terminal

Open the terminal by pressing Ctrl + Alt + T on your keyboard or by searching for it in the applications menu.

Step 2: Install QEMU, KVM, and Virt-Manager

On Debian/Ubuntu-based distros, run:

sudo apt install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils virt-manager

On Fedora/RPM-based distros, run:

sudo dnf install qemu-kvm libvirt virt-install virt-manager

On Arch-based distros, run:

sudo pacman -S qemu virt-manager virt-viewer dnsmasq vde2 bridge-utils openbsd-netcat

Step 3: Start and Enable libvirtd Service

On Debian/Ubuntu-based distros and Fedora/RPM-based distros, run the following commands:

sudo systemctl start libvirtd
sudo systemctl enable libvirtd

On Arch-based distros, run the following commands:

sudo systemctl enable libvirtd.service
sudo systemctl start libvirtd.service

Step 4: Add User to libvirt Group

On Debian/Ubuntu-based distros, run the following commands:

sudo adduser your_username libvirt
sudo adduser your_username libvirt-qemu

Replace your_username with your username.

On Fedora/RPM-based distros and Arch-based distros, run:

sudo gpasswd -a your_username libvirt

Replace your_username with your username.

Step 5: Log Out and Log Back In

Log out and log back in for the changes to take effect.

Step 6: Create Virtual Machine

  1. Open Virt-Manager from your applications menu.
  2. Click on the Create a new virtual machine button or go to File > New Virtual Machine.
  3. Choose the installation method (local ISO file, network boot, or importing an existing disk image), and click Next.
  4. Browse and select the ISO file (if applicable), and click Next.
  5. Allocate the memory (RAM) and CPU resources for the virtual machine, and click Next.
  6. Specify the disk size and storage location for the virtual machine, and click Next.
  7. Review the virtual machine settings, give it a name, and click Finish.

The virtual machine will now be created, and you can start it by selecting it and clicking on the Start button (the Play icon) in Virt-Manager.

Conclusion

In conclusion, creating a virtual machine on Linux is a straightforward process that can be achieved using popular tools like VirtualBox or QEMU, KVM, and Virt-Manager. Whether you’re testing new software, running multiple operating systems simultaneously, or using virtualization for development purposes, these tools provide a powerful and flexible solution for your needs.

Please Leave Feedback and Corrections in the Comments

More to Explore

Why MALIBAL?

When it comes to choosing a laptop, you have numerous options from well-known brands like Dell, HP, Lenovo, and Apple. Each of these companies offers a range of products designed to meet the diverse needs of their customers. However, if you’re looking for a brand that stands out in terms

Read More »

How to Dual Boot Windows and Linux

Dual booting allows you to run two separate operating systems on a single computer, providing the flexibility to switch between different OS environments according to your needs. By setting up a dual-boot system with Windows and Linux, you can enjoy the robust performance and extensive software library of Windows alongside

Read More »

Table of Contents

Leave a Reply

Availability

We wish to inform our valued customers that, due to significant business growth and existing supply chain constraints, our laptop inventory is expected to be sold out this holiday season.

To secure a laptop for your personal or professional needs in anticipation of Christmas, we recommend placing your order at your earliest convenience.

Upon order placement, the estimated delivery date will be clearly indicated on the cart page, assuring the receipt of your purchase well ahead of the holiday festivities.

We appreciate your understanding and are dedicated to serving you with excellence.

What are you looking for?

Type in a question or keyword below

Search

Frequently Asked Questions

Why MALIBAL?

In a marketplace dominated by large corporations, MALIBAL offers a refreshing alternative that focuses on open-source support, the right to repair, hardware integration in the USA, personalized US-based customer support, and the unique combination of customization and high-performance technology in sleek, user-friendly designs. For those who value these qualities, MALIBAL stands out as a distinct and appealing choice among laptop brands.

Learn More

Are all the parts soldered to the motherboard?

In many modern laptops, especially thin and light models (like Apple’s MacBook Air or Pro, Dell’s XPS 13, or many of Lenovo’s ThinkPad X1 Carbon models), the memory, storage, battery, and wireless module are often soldered directly onto the motherboard. This is done to save space and allow the laptop to be thinner, but it means that the RAM and SSD are not user-upgradeable.

However, as part of our commitment to the Right to Repair Movement, the memory, storage, battery, and wireless module all MALIBAL laptops are user-upgradeable or user-replaceable.

Is the firmware on your laptops open source?

Yes, the UEFI / EC firmware on our laptops is open-source and licensed under the GPL.

Can your laptops be charged or powered via USB-C?

USB-C is revolutionizing the way we charge laptops. As a universal charging standard, USB-C has a number of advantages that make it particularly suited for this task.

First and foremost, it offers high power delivery capability – up to 100 watts – which is sufficient to charge even power-hungry laptops. This eliminates the need for proprietary laptop chargers and allows for charging via common adapters, power banks, or even other laptops.

Additionally, USB-C is a reversible connector, meaning it can be inserted either way, making it more user-friendly.

It also supports data transfer and display output, allowing for a single cable to provide power, transfer data, and connect to external monitors.

All MALIBAL laptops can be powered via the Thunderbolt 4 port.

Who is MALIBAL?
MALIBAL is an innovative technology company that produces high-performance, custom linux laptops for developers and content creators; mobile workstations for engineers, scientists, video editors, 3D modelers, and animators; and mobile servers for enterprise applications. On our site, you will find information about the best linux laptops, such as our Aon S1 and Aon L1 models, our customers, new articles, latest news, guides, features, and more.
How do I get a quote?

If you need a quote for any reason, e.g., to submit to accounting for approval, before ordering, simply add the laptop(s) you want to purchase to the Cart, then click Checkout, and on the checkout page, click Convert Cart to Quote. We will email you a PDF of the quote with a link to make payment once you are ready to complete the order.

How do I cancel an order?

You may cancel an order any time up until it ships. After it ships, you will not be able to cancel it, but will instead have to use our return policy in order to return the laptop for a refund. To cancel an order, simply open a sales ticket or sales chat and give the representative your order information, and they will cancel the order for you and send you confirmation via email and text.

How do I make a change to my order?

You may make changes to your order up until it ships. To modify an order, simply open a sales ticket or sales chat and give the representative your order information and specify which changes you want to make.

When is my order shipping?

If all parts are in stock, the average build time for laptops is 5-7 business days. This means laptops will ship 5-7 business days after the order is placed. If a component is backordered, it will say which parts are backordered in your order confirmation email.

To see the estimated delivery date of your laptop, please check your order confirmation email for the Estimated Delivery Date. You can also see this information on your My Account > Order Details page. The estimated delivery date is the build time (plus backorder delay, if applicable) plus the shipping time.

Once your laptop ships out, we will email you the tracking information. An adult will need to be at the address to sign for the package when it arrives.

How do I track my order after it ships?

You can view your tracking status via the order details page in your account.