UniCode™
Loading ...
How to set up test environment with VirtualBox
Thomas Jan Solgaard
Thomas Jan Solgaard

20 Jan 2023 · 7 min read

How to set up test environment with VirtualBox

In this guide, I will walk you through the setup of VirtualBox step by step. We will use VirtualBox and Debian GNU/Linux to meet the requirements of a test environment. We will explore the advantages and disadvantages of this setup as well as why it is a good idea to use VirtualBox and Debian.

Introduction

Creating a secure test environment is critical to any technical development process. This isolated space safeguards new features, bug fixes, and other modifications prior to their introduction into a production environment. By thoroughly testing and verifying changes in a secure test environment, organizations can reduce the potential for unexpected issues or damage to the production environment.

To ensure a safe and effective testing process for web development, it is essential to create a distinct server to host the test environment. This server should be completely isolated from the production environment to avoid any issues or conflicts that may arise. By having a separate server for testing, developers can ensure that any changes or updates to the website are thoroughly tested prior to release in the production environment. This helps to ensure that the website functions correctly, that any security or performance issues are identified and addressed in advance, and that any potential problems are identified and rectified before the website goes live.

It is imperative to ensure consistency between the server configurations of the test and production environments to generate reliable results from testing. This is because any changes conducted in the testing environment must replicate the same performance when applied in the production environment. Additionally, the data utilized in the testing environment should mirror that of the production environment as closely as possible to ensure that results of tests are reflective of real-world performance.

Having a backup plan in place is essential for the successful completion of any testing process. It enables the environment to be rapidly restored in the event of any issues arising during testing, thereby minimizing any disruption to the process. Additionally, it allows for a safe and accurate replication of the production environment, reducing the risk of system damage or unexpected costs. Having a backup plan in place facilitates the testing process and enables any errors to be accurately reproduced, allowing the team to swiftly and effectively address any potential issues.

I will be using VirtualBox and Debian GNU/Linux to create a test environment that meets the necessary requirements. However, readers can opt to use a different virtualization software or operating system to suit their individual needs.

Why use VirtualBox

VirtualBox is a virtualization software that facilitates the running of multiple operating systems on a single physical machine, enabling users to test software and execute other operations in a secure environment without impacting the host computer. Moreover, VirtualBox provides the capability to create snapshots of the virtual machine and revert to a previous state when necessary, making it a convenient tool for testing different configurations and scenarios.

Why use Debian

Debian is renowned for its stability and powerful package management system, along with its commitment to free and open-source software. It exclusively features free software in its archives, making it an optimal choice for users seeking a dependable system for their testing requirements at a minimal cost.

We should consider tackling this topic in an incremental manner so we can ensure a comprehensive comprehension of the material at each step.

In order to successfully utilize this guide, it is essential to meet a few basic requirements:

  • VirtualBox installed - obtained from their website https://www.virtualbox.org
  • An .iso of Debian GNU/Linux saved on your system - Multiple variants available through their website https://www.debian.org
  • CPU virtualization enabled in the bios - This is usually enabled by default

Once you are prepared, launch VirtualBox and move forward with the next step. Remember to always download the above from the provider's own website to avoid compressed software.

Welcome to VirtualBox

When launching VirtualBox, you will be presented with a menu featuring a couple of options. To create a new virtual machine, select the blue star labeled 'New'. This will open a new window.

Name the machine

When creating a new virtual machine in VirtualBox, the user will need to provide some essential information such as the name, storage folder, and the ISO image of the operating system they will be installing. The name should be unique and descriptive for easier identification when selecting the machine from the list of available virtual machines. The storage folder should indicate the location of the virtual machine file on the system. The .iso file should point to the directory containing the operating system to be installed. VirtualBox may auto-fill the required specifications from the .iso, which is indicated by the greyed out sections.

For those who wish to have a more automated approach to their system setup, Debian offers the option of an "Unattended Installation". This feature allows users to pre-configure setup parameters that the system can use to install itself. Alternatively, if you prefer to be more involved in the installation process, simply check the box to "Skip Unattended Installation" prior to proceeding.

You may note that the installer I use requires an internet connection to proceed with the setup. A network adapter will be automatically configured for the Virtual Machine when it boots up, allowing it to access the internet. If you would prefer not to use this feature, you can download an offline installer or adjust the network adapter settings as needed.

Automatic installation of the OS

If you have not previously tick the skip option, then in this step of the installation process, you will be presented with a menu. Here, you can specify the user that should have root privileges on the system, enter a hostname and domain name for the computer, and decide whether the installation should run in a separate window. To ensure the security of your device, if it will have access to the internet, it is recommended to create a secure Username and Password.

You may also adjust additional options according to your preference; the hostname and domain name will be used to identify and connect to the machine within your network.

Hardware

The specifications you need for your machine setup will depend on the scope of tasks you intend to use it for. It is essential to consider your objectives carefully before deciding on the machine's specifications, even if it is only for testing purposes. Doing so will help ensure that the server is able to meet the requirements of your project and provide optimal performance.

For the Debian version used, the minimum requirements can be found on their website. https://www.debian.org/releases/stable/amd64/ch03s04.en.html

VirtualBox will usually set a recommended configuration for your operating system, so it can safely be left as is. Additionally, it is important to bear in mind that while the virtual machine is running, it will allocate the resources that have been assigned to it. Therefore, it is advisable to choose the lowest settings for your needs, rather than increasing the system resources to improve performance.

Virtuel Hard disk

When configuring a virtual hard drive, it is important to consider the amount of space required by the operating system, as this will determine the amount of space available for use. The “Pre-allocate Full Size” box can be toggled depending on the user's needs. If checked, the disk space will be allocated from the drive permanently; if left unchecked, space will only be allocated as necessary. Checking this box can help to prevent running out of space, however it may result in wasted resources. Therefore, it is advised to leave the box unchecked, unless the system is frequently running out of memory.

Summary

Before proceeding to configure the virtual machine, please take the time to review all of the settings provided in the overview. Ensure that they are correctly configured and satisfactory to you. Once you are satisfied with the settings, click the 'Finish' button to complete the virtual machine setup.

Boot the machine

Congratulations! Your virtual machine is now set up and ready to boot.

If you chose an unattended installation, the virtual machine will start automatically and the installation process will begin without any further intervention. Alternatively, if you did not select an unattended installation option, you can manually start the machine by pressing the green start arrow or by right-clicking the machine indicator and clicking the start prompt. Once the system is installed, you can log in with the root user account created during the unattended installation setup or during manual installation, as applicable.

Welcome to your new virtual machine

Experimentation is an essential part of working with computers. Whether setting up a web server environment for testing a website before making it available online, or building a network of connected systems and databases to find a functional setup, the potential is limitless.

Spending time experimenting with a virtual machine is the best way to learn and develop one's skills.

I hope that this process has been successful and educational for you. Enjoy your new virtual machine!

Thomas Jan Solgaard
Thomas Jan Solgaard LinkedInthomas-solgaard

Passionate data enthusiast and number cruncher | CDO - Co-founder at UniCode™

Thomas Jan Solgaard
Thomas Jan Solgaard
LinkedInthomas-solgaard

Passionate data enthusiast and number cruncher | CDO - Co-founder at UniCode™

Back to Blog
Thomas Jan Solgaard
Partner and Data Protection Officer

Let's work together to make your business visually impressive, enhance its functionality, and provide you with a great experience all at the same time.

Enter your phone number and we will call you to discuss how we can help elevate your business digitally.

Tilbage
Dansk
English