How to set up a virtual machine with VirtualBox for local testing
This article describes how to install and configure a virtual machine using VirtualBox, a popular virtualization application. VirtualBox runs on Windows, Mac OS X, and Linux, and features an easy-to-use graphical user interface for creating and managing virtual machines.
About virtual machines
Virtual machines emulate a computer—they enable you to install an entire operating system within an existing operating system. The virtual machine runs in its own “sandbox,” safely isolated from the host operating system. Because of this isolation, virtual machines enable you to safely test new features, applications, and configurations without having to worry about harming your existing operating system.
By creating a virtual machine with a configuration that closely matches A2 Hosting's servers, you can safely do testing and development work on your own computer before you roll out the changes to a live site.
Installing VirtualBox
Before you can create a virtual machine, you must first install the VirtualBox application on your computer. To do this, follow the appropriate procedure for the operating system that is installed on your computer:
VirtualBox on Windows
To install VirtualBox on a Windows-based computer, follow these steps:
- On your local computer, use your web browser to go to https://www.virtualbox.org/wiki/Downloads.
- Click Windows hosts, and then download the .exe file to your computer.
- Run the .exe file to start the installation.
- Click Next.
- Follow the prompts to complete the installation.
VirtualBox on Mac OS X
To install VirtualBox on a Mac OS X-based computer, follow these steps:
- On your local computer, use your web browser to go to https://www.virtualbox.org/wiki/Downloads.
- Click OS X hosts, and then download the .dmg file to your computer.
- Double-click the .dmg file to start the installation.
- Follow the prompts to complete the installation.
Virtual Box on Linux
To install VirtualBox on a Linux-based computer, follow these steps:
- On your local computer, use your web browser to go to https://www.virtualbox.org/wiki/Downloads.
- Click Linux distributions.
- Download the appropriate package file for the Linux distribution your computer uses.
- Use your Linux distribution's package manager to install the package file.
Creating a virtual machine and installing an operating system
At this point, you have installed the VirtualBox application on your computer, but you still need to create a virtual machine. To do this, you specify the virtual machine's settings, and then install an operating system on it.
The following procedures demonstrate how to create a new virtual machine and install AlmaLinux on it. Many A2 Hosting servers run AlmaLinux, so it is a good choice for your first virtual machine.
Creating a new virtual machine
To create a new virtual machine, follow these steps:
- Start VirtualBox.
- On the menu, click .
- In the Name text box, type AlmaLinux. VirtualBox should automatically detect AlmaLinux, and select Linux in the Type list box, and AlmaLinux in the Version list box.
- Click Next.
- In the Memory Size dialog box, select the amount of RAM you want to allocate to the virtual machine, and then click Next.
The more RAM your computer has, the more RAM you can safely allocate to the virtual machine. As a general rule, however, you should have at least 512 MB of free RAM to run a Linux virtual machine.
- In the Hard disk dialog box, select Create a virtual hard disk now, and then click Create.
- In the Hard disk file type dialog box, select VDI (VirtualBox Disk Image), and then click Next.
- In the Storage on physical hard disk dialog box, select Dynamically allocated, and then click Next.
- In the File location and size dialog box, type a name for the virtual hard disk file, select the size of the hard disk, and then click Create.
The more disk space your computer has, the more space you can safely allocate to the virtual machine's hard disk. As a general rule, however, you should have at least 5 GB of free disk space for a Linux virtual machine.
Installing an operating system
After you create the virtual machine, you are ready to install an operating system on it. To install AlmaLinux, follow these steps:
- Use your web browser to go to https://almalinux.org/get-almalinux/.
- Click Minimal ISO, and then save the .iso file to your local computer.
- In VirtualBox, select the virtual machine you created in the previous procedure, and then click Start.
- In the Select start-up disk dialog box, click the folder icon.
- In the file selection dialog box, locate and select the .iso file you downloaded in step 2, and then click Start. VirtualBox boots the virtual machine using the .iso CD image file.
- On the AlmaLinux installation page, select Install AlmaLinux.
- On the Welcome to AlmaLinux page, select the language you want to use for the installation process, and then click Continue.
- On the Installation Summary page, complete any items marked with the yellow triangular warning icon, and then click Begin Installation.
During installation, you can (and should) set the root password and create a regular user.
- Follow the remaining prompts to complete the installation.
- After installation is complete, click Reboot to restart the virtual machine. You now have a fully-functioning AlmaLinux installation on your local computer.
For more information about VirtualBox, please visit https://www.virtualbox.org.