Site icon Tech-Wire

Best Way To Set up a Virtual Lab Environment

Lab Environment

Setup & Prepare your Test Lab Environment

Either you work as system administrator, Network engineer, software developer, infosec, ethical hacker, or whatever job you have in the IT field: you need from time to time to test some new tools, software programs, scripts, configurations, or even new operating systems.

You may be afraid to test a new script on a production environment (and you should never do). Same for a new required configuration change, a patch you need to deploy, or security hardening requirements that you must apply. In all cases, it is very important to have your test or lab environment that you could test “safely” new things on.

Over the years, I have used several virtualization software products. The one I felt most comfortable with, so I have been using and relying on for about 10 years ago (and still using) is the one we are going to introduce in this article.

Oracle VirtualBox

A free open-source virtualization software from Oracle that works under Windows, Red Hat Enterprise Linux, Oracle Linux, Ubuntu, OpenSUSE, and Fedora.

Oracle VirtualBox can host a long list of guest operating systems:

For the complete list of supported guest operating systems, check the following URL:

https://www.virtualbox.org/wiki/Guest_OSes

It can be used for enterprises and for your own home lab environment as well.

Downloading and Installing VirtualBox

In your browser, go to https://www.virtualbox.org/wiki/Downloads

To install it under your Windows PC / Laptop, click Windows hosts to start downloading the installer package for Windows. When download is complete, click ” VirtualBox-6.1.38-153438-Win.exe” to start installation wizard.

 In the installation wizard welcome screen, click Next.

In the Custom Setup screen, click Browse to change the installation directory (if you need to)

Make sure that VirtualBox will be installed on local Hard drive.

Click Next twice.

Click Yes to proceed.

In the “Ready to Install” screen, click Install to start the installation process.

The installation starts.

Click Finish to complete installation.

After installation, the Oracle VirtualBox is started.

Congratulations!! You have just setup your own Virtual Lab Environment.

Start Using Oracle VirtualBox

In real life, everything starts physical in the beginning, then comes the logical “higher level” part. A logical concept that doesn’t rely on a physical “tangible” thing remains just concept.

In our IT world, the same principle remains true. There is no logical hard drive without having an “underlying”  physical hard drive. Virtualization as defined by VMware is to create a software-based – or virtual – representation of applications, servers, storage and networks in order to reduce IT expenses while boosting efficiency and agility.

Virtualization depends on using part (or a ratio) of your (actual) physical resources (CPU, Memory, Hard drive, and Network interface cards) so that it appears to the administrator, user, or even other system as if it were a real physical resource.

What is the purpose of this long introduction?

Just to tell you that you have to make sure that the physical asset in hand should be powerful enough to host what you are trying to virtualize.  

Sorry, I couldn’t get your point.

Let’s make it clear by example: Before installing Oracle VirtualBox on your laptop to create multiple virtual machines of different operating systems, with different minimum CPU, RAM, and storage requirements for each, you need first to make sure that the CPUs, physical memory, and hard drive of your laptop could afford hosting these “guest” virtual machines that will share physical resources with the original host operating system (of your laptop, PC, or physical server).

Okay, Got it.

*  *  *  *  *  *  *

In the VirtualBox Manager Window, there are two main sections. The right section (pane) contains 5 buttons: Preferences, Import, Export, New, Add.

Preferences

The preferences button opens a dialog button containing a large number of options.

The important option for now to consider is the Default Machine Folder, which is the path under which individual folders for each new VM are created. I advise that you open your Windows explorer window and check which computer drive has enough space to contain the VM folders (a typical VM can be as large as 10 GB size or more)

Obviously, you should create this folder in the D: drive which contains sufficient space. So, back to the Preferences dialog box: click the drop down list box next to “ Default Machine Folder ” and click Other.

In the Select Folder dialog, browse to D: drive. Under D: drive, create a new folder and name it VirtualBox-VMs. Once created, select it and then click “Select Folder” button.

Now, the new path we created will be the default folder for VMs we are going to create.

For now, we don’t have anything to Import or Export. We want to see how to create a New VM.

Create New Virtual Machine

The Create Virtual Machine wizard is started. The first screen asks about the name, Machine Folder (defaults to the folder we created in the last section), the operating system type and version.

While you are typing the machine name, the wizard will try to guess the operating system type. For example, if you type RHEL-srv, it will change Type to Linux, and Version to Red Hat (64-bit). If you change the name to deb-host, it will automatically change the version to openSUSE (64-bit). If you type mac, it will automatically (as you are typing) change the type to Mac OS X, and version to Mac OS X (64-bit).

In all cases, you can change the default detected (proposed) type and version if you want.

For now, type RHEL9-srv, and click Next.

The next screen asks you to set the amount of memory you are going to allocate to the new VM. In our case, the wizard recommended 1024 MB (1 GB) RAM. You can move the slide bar to the right or to the left to increase or decrease the memory amount, or you can directly set it in the box on the right. When complete, click Next.

The Hard disk screen asks about how you will handle storage: will you create a new virtual hard disk now (default), or you are going to choose an existing hard disk file, or don’t want to add virtual hard disk. In our case, I will keep the default and click Create.

A new dialog screen is open, asking for the type of the hard disk file to create. Leave the default and click Next.

Again the wizard asks about the type of hard disk file to create, but regarding how it will be stored on the physical hard drive: it can be dynamically allocated: which grows gradually with usage, up to a specific size that we will specify. Or, it can be of a fixed size that occupies the whole size we specify from the moment of its creation.

For me, I use the default (Dynamically allocated), click Next.

The next screen presents the suggested hard disk location and size. The wizard created a folder for the VM under the “Default Machine Folder” we specified as preference. Keep the file location and name as they are, but change the file size to 12 GB, then click Create.

The new VM is created, and the left side section (that was initially empty) now contains the newly-created VM, with its status shown as Powered Off.

The right side pane shows the attributes of the new VM:

Congratulations!! You have just created your first Virtual Lab Environment.

Now What ?

Now, we have a virtual machine that we can install an operating system on. Once installed, the VM will act as if it is a real physical machine: it can be powered on, rebooted, powered off. It can access local network and Internet (if required). It can also be accessed from network.

In the next article, we are going to learn how to download and install Red Hat Enterprise Linux 9 on our new virtual lab environment. You can also read about Step by Step Guide to Install MySQL on CentOS, RedHat, Ubuntu, and Windows

See you there!!

Exit mobile version