Knowledge Base
MilesWeb / How-Tos

How can I configure a Virtual Machine for Local Testing?

Approx. read time : 5 min

In this article, you will learn how to install and configure a virtual machine using VirtualBox, a known virtualization application. VirtualBox can be accessed on Windows, Mac OS X, and Linux, and also features the easy-to-use graphical user interface for creating and managing virtual machines.

What are Virtual Machines?

Virtual machines copy the working behavior of computer – that means, they enable you to install an entire operating system within an existing operating system. The virtual machine also runs its own “sandbox”, safely at the remote place away from the operating system. This remote situation of the virtual machines allows you to test new features, applications, and configurations very safely, and you don’t need to worry about any harm to your existing operating system.

You can create a virtual machine with a configuration that closely matches with MilesWeb Hosting’s servers, and can safely do testing and development work on your own computer before you actually roll out the changes to the live site.

# Steps to install virtual box :

Before creating a virtual machine, you first need to install the VirtualBox application on your computer. Perform the following procedure for the operating system that is installed on your computer :

For Windows –

Perform these steps to install VirtualBox on Windows-based computer :

1. On your local computer, through the web browser go to https://www.virtualbox.org/wiki/Downloads

2. Click on Windows hosts, and then download the .exe file to your computer.

3. Now run the .exe file to start the installation process.

4. Click on Next.

5. Follow all the prompts to complete your installation.

For Mac OS X –

Perform these steps to install VirtualBox on a Mac OS-X based computer :

1. On your local computer, through the web browser go to https://www.virtualbox.org/wiki/Downloads

2. Click on OS X hosts. After that download the .dmg file to your computer.

3. Now double click on the .dmg file, to start the installation.

4. Follow the prompts instruction to complete your installation.

For Linux

Perform these steps to install VirtualBox on a Linux-based computer :

1. On your local computer, through web browser go to https://www.virtualbox.org/wiki/Downloads

2. Click on Linux distributions.

3. Also, download the appropriate package file for the Linux distribution your computer uses.

4. Make use of your Linux distribution’s package manager to install the package file.

Steps to create a virtual machine and install an operating system

At this step, you must have installed the VirtualBox application on your computer, but still, you need to create a virtual machine. To do this, you have to specify the virtual machine’s settings, and then install an operating system on it.

The following procedure shows how you can create a new virtual machine and install CentOS on it. CentOS 7 is a good choice for your first virtual machine.

# Steps to create a new virtual machine

1. Start VirtualBox.

2. On the Machine menu, click on New.

3. In the text box for Name, type CentOS 7. VirtualBox will automatically detect CentOS and selects Linux in the Type list box, and the Red Hat in the version list box.

4. Click on Next.

5. In the dialog box for Memory Size, select the amount of RAM you want to allocate to the virtual machine, and after that click on Next.

Note: If there is more RAM in your computer, then you can safely allocate more RAM to the virtual machine. As per the general rule, you should have at least 512 MB of free RAM to run a Linux virtual machine.

6. In the dialog box for Hard disk, select Create a virtual hard disk now, and then click on Create.

7. In the dialog box for the Hard disk file type, select VDI (VirtualBox Disk Image), and then click on Next.

8. In the dialog box for the Storage on a physical hard disk, select Dynamically allocated, and then click on Next.

9. In the dialog box for File location and size, type a name for the virtual hard disk file, select the size of the hard disk, and then click on Create.

Note: If there is more RAM on your computer, then you can safely allocate more RAM to the virtual machine’s hard disk. As a general rule, you must have at least 5 GB of free disk space for a Linux virtual machine.

# Steps to install the operating system

Once you create a virtual machine, you get ready to install an operating system on it. Perform the following steps to install CentOS 7 :

1. Using your web browser go to https://www.centos.org/download/

2. Click on Minimal ISO, and then save the .iso file to your local computer.

3. In the VirtualBox, select the virtual machine you have created in the previous procedure, and then click on Start.

4. In the dialog box for Select start-up disk, click on the folder icon.

5. In the dialog box for file selection, locate and select the .iso file that you have downloaded in step 2, and then click on Start. Using the .iso CD image file, VirtualBox boots the virtual machine.

6. On the CentOS 7 installation page, select the Install CentOS 7 option.

7. Welcome to CentOS 7 page will appear. On that page select the language that you want to use for the installation process and then click on Continue.

8. On the page for Installation Summary, complete any items marked with a yellow triangular warning icon, and then click on Begin Installation.

Note: During this installation, you must set the root password and create a regular user.

9. Also, follow all the remaining prompts to complete the installation.

10. After the installation is completed, click on Reboot to restart the virtual machine.

Now you have a fully-functioning CentOS 7 installation on your local computer.

Also Read :

 Learn to Secure your Hacked site

 How to Create a Landing Page in WordPress?

Sonam Wagh
With an interest in doing something creative daily, Sonam works as a Digital Marketing Executive. She likes to write technical blogs related to web hosting, digital marketing, and other IT topics. She also likes to spend her leisure time on social media to find different strategies for client engagement.