What is a “Virtual Machine”? Virtual machines are self-explanatory, a non-physical “virtual” computer inside of your own computer. This allows us to safely contain an operating system (the “guest operating system” or “guest”) inside your computer (the “host operating system” or “host”).
Prerequisites
System Requirements
It goes without saying that supporting a second computer inside of your own computer is going to require some resources. For our purposes, we will be using Kali Linux, a cybersecurity-focused Linux operating system with a wide-variety of tools. Kali Linux requires as a bare-minimum 2 Gigabytes of RAM and 20 Gigabytes of storage space (3GB for the zipped installation file, typically 15-20GB after extraction), and a decent processor with at least 4 cores (see below).
MacOS Note: Apple M1, M2, and M3 chips run ARM, which is a different CPU architecture versus x86. Most computers you are familiar, with CPUs made by Intel and AMD with run x86 (32-bit) or x86-64 (64-bit). This tutorial assumes you are running x86, and we’ll get to an ARM tutorial eventually. Just ask for help in the meanwhile.
Get a .7z (7zip) capable extraction tool
7-Zip is a free and open-source compression and extraction archiver which does not constantly ask you to buy their software, unlike some applications. Kali Linux provides their operating system in the .7z format, and Windows File Explorer does not support extracting 7zip files.
Ensure virtualization is enabled
How to check…
- On Windows:
- Open Task Manager (Ctrl + Alt + Delete), go to
Performance > CPU
and look forVirtualization: Enabled/Disabled
. If it is enabled, you may go right ahead to the installation.
- On MacOS:
- See the “MacOS Note” above
- Run
sysctl -a | grep machdep.cpu.features
in your macOS terminal, and look for “VMX” in the list
- On Linux:
- Why do you need our help? You should already know what you are doing!
cat /proc/cpuinfo
Enable Virtualization in BIOS
If disabled, follow the tutorial below. It might be helpful to take a photo of the instructions before attempting as you will not be able to access them if you forget midway! :)
Downloads
- VirtualBox (Free, Open-source hypervisor)
- Under “VirtualBox Binaries”, choose your operating system. A download should initiate.
- Kali Linux (Penetration Testing OS)
- Be sure to download the VirtualBox 64bit version labeled “Recommended”.
- 7zip (or any other unarchiver that supports 7z)
- Download and install here:
Installation
- After downloading the installer for VirtualBox, proceed to launch the downloaded executable titled similarly to “Oracle VM VirtualBox <version#>. At the time of writing, the VirtualBox version is 7.0.10.
- Setup
- After downloading and installing the VirtualBox software, you should be greeted with a page resembling the below photo. If your screen looks radically different from the one below, you may need to click “Tools” in the top left of your screen. (Highlighted in Blue in the image below). Additionally, if you have not used this software before, you will not have any Virtual Machines listed as you see below. (Do not worry 😉, we’ll get there!)
- At this time, we will have to unzip the downloaded Kali Linux file. To do this, navigate to the directory that you downloaded the Kali Linux file in, right-click the file, and unzip (Extract). This can take a couple of minutes. After doing so, you should be left with a folder labeled “kali-linux 2023.2-virtualbox-amd64” (or something similar). Inside this folder should be 2 files shown below.
- Double-click on the file ending with the extension “.vbox”. This should launch another instance of VirtualBox and automatically create a new Virtual Machine.
- Finally, your VirtualBox window should look something like this:
- Most people prefer to make more RAM available to their VM to increase the responsiveness and overall speed of it. If you’re not sure about this optional step, there’s nothing wrong with skipping it! To do this, we can click the “Settings” cog wheel at the top of our window.
- From this window, we can now see all the settings we can change for our virtual machine. The option we are most interested in is the “System” tab. After switching to this tab, we can see that we have an option for “Base Memory”. It is helpful to make yourself familiar with the number of Gigabytes of RAM your computer has. However many gigabytes of RAM you would like to allocate to your VM, multiply that value by 1024. This will give you the value of megabytes to input into the settings. The most common values are below for easy reference. (BE SURE TO LEAVE A COUPLE OF GIGABYTES (2-4 GB) FOR YOUR COMPUTER TO FUNCTION.) For example, I have 16 GB of RAM in my laptop, I usually allocate 6-8 GB to my virtual machines to put a little more pep in their step.
- 2 GB - 2048 MB
- 4 GB - 4096 MB
- 6 GB - 6144 MB
- Now we can finally launch our VM! When you’re ready, click the “Start” arrow at the top of the window. This will create a new window and initiate the booting of your virtual machine.
Once you’re happy with the value you chose, click “OK” to confirm the changes you made. You can always come back and change this value to increase or decrease the amount of allocated RAM.
First Boot
- After booting the Virtual Machine, you will be greeted with a boot screen that gives your 5 seconds to make a choice as to what you’d like to boot to. We do not have to manually choose any option, so we’ll wait until the 5-second countdown is finished.
- Next, we should be welcomed by a Kali Linux login screen that looks similar to the one below. (Wallpapers could be different).
- The default username and password for this Kali machine are both “kali”. After entering these credentials, click “Log In” or click Enter.
- Congratulations! You have successfully installed your Kali Linux virtual machine!
- Its common practice after installing a new Virtual Machine to open a terminal window and run the commands below.
# ATTENTION: The sudo password should be "kali"
# NOTE: Yes, you are typing your password. On most command lines, passwords are invisible.
# Run to recieve package updates
> sudo apt update
# After that is finished, run the command below to install the new updates
# (THIS COULD TAKE A WHILE SINCE THIS IS A NEW VM INSTANCE)
> sudo apt upgrade