In this video, you’ll learn how to use virtual machines for free with Virtualbox and take
your cyber skills to the next level.
Have you ever been so frustrated with your operating system crashing or becoming slow
over time?
Because I certainly have.
Before virtual machines, or VMs, I did all of my web browsing, work, and entertainment
right on the native OS.
But not any more, because over time, your computer gets bogged down with temporary files,
plugins, and maybe even malware from long term use.
You end up wiping the disk and reinstalling.
Or maybe you even just buy a new box.
With VMs though, my computer just DOESN’T slow down over time because I can segregate
everything within a virtualized OS under my full control, and reset it in SECONDS.
Today I’m gonna show how YOU can do this as well and supercharge your personal digital
security.
We’ll go over building an Ubuntu Linux and Windows 10 VM in Virtualbox so you’re fully
equipped for both environments.
Stay tuned.
Before we start, let’s go over VMs conceptually.
So VMs are simply collections of files on your computer that software called a “hypervisor"
can read and run.
For the most part, the native, or host operating system runs idle and doesn’t use the excess
CPU cores, RAM, or storage space physically present on your computer.
The hypervisor can grab what’s unused and create a pool of resources to allocate for
a virtual, or guest operating system.
With all that said, let’s get setup!
To begin, we’ll need to download the hypervisor and installation media.
Let me open up a web browser and navigate to virtualbox dot org.
Click the download button and pick the right installer for your host operating system.
We'll save that to the desktop.
I’m gonna also verify the SHA256 hash of the installer by opening up Bash, and running
the sha256sum command.
I'll copy the hash and search for it in the list with Ctrl-F, and that checks out!
Next I'm gonna go to ubuntu.com, download, and pick 18.04 LTS.
LTS stands for long-term support and represents the newest stable release available.
We’ll save the ISO somewhere, which is just a CD image.
I’ll click the verify link to get a one-line Bash command to do the checksum as well.
And we have an OK.
To download Windows 10, search "windows media creation tool”, go to Microsoft’s webpage,
download it, and run the installer.
Let me accept the license agreement to proceed.
When it asks what you wanna do, select "Create installation media for another PC”.
Choose ISO file, and save it somewhere.
Before installing, you'll wanna make sure that your computer’s UEFI or BIOs has the
virtualization features for your CPU turned on.
You’ll see the terms VT-d and VT-x or AMD-V depending on if you’re running an Intel
or AMD processor.
On macOS, these settings should be enabled already.
On Linux, you’ll have to quickly hit Enter, F12, F2, DEL, or some other key after reboot
and seeing the power-on self-test, or POST screen.
On Windows 10, search “Change advanced startup options” in the task bar and click restart
now under advanced startup.
Click Troubleshoot, Advanced Options, UEFI Firmware Settings, and Restart to get to the
BIOs settings.
So now, we’ll run through the Virtualbox installer.
Once that's finished, let’s build an Ubuntu VM first.
I’ll click New to make a new virtual machine.
I’ll name it Ubuntu 18.04, and use the default location for saving our VMs.
Click Next.
For memory size, you’ll typically wanna use something that's enough for the OS you’re
installing and applications you'll be running.
We’ll use this VM for just development and web browsing, so I'll give it 3GB.
A virtual hard disk is a file that can be mounted just like a physical drive, and is
where the hypervisor installs your OS.
Different hypervisors have different file formats for virtual hard disks, as you can
see here.
If you’re just gonna use this VM for Virtualbox, go ahead and chose VDI.
VHD is used by Microsoft Hyper-V, and VMDK is used by VMware.
If you ever wanna import this VM for use on a different hypervisor, choose one of the
others.
You can always use a tool to convert between them.
I’m gonna pick VMDK for now so I can easily import into VMware down the road.
Dynamically allocated disks take up just what’s actually used, which is usually less than
what you allocate.
If the Ubuntu installation takes up 8GB but we made a 64GB dynamically allocated virtual
disk, the actual file on your host OS will only be around 8GB.
A fixed 64GB will eat up the entire amount of space on your drive.
I almost always use dynamic disks since they’re more portable and resizable.
If you’re running applications with a lot of reads and writes, like a mail or database
server, fixed will give you better performance and less fragmentation over time.
We don’t need to split the VM into smaller chunks since modern drives support files hundreds
of gigs in size.
I’m gonna give this VM 10GB, which is more than enough to fit Ubuntu and most apps you
might install.
If you need to store lots of files, we can just create a bigger virtual disk in the VM
and mount it to use specifically for storage later.
With the VM built, I’m gonna attach our Ubuntu ISO to the VM’s virtual CD drive
by going settings, storage, IDE controller, and adding the ISO.
Let me run you through some of the the other VM settings real quick.
In General, we can go to advanced and enable one-way or two-way copy-paste and drag and
drop.
In disk encryption, you can set a password to encrypt the VM.
Under system, we can change the boot order, and adjust the amount of resources dedicated
to the VM.
I’m gonna bump up the CPU cores to two.
I’ll also go to Display and double the available memory.
Audio lets you pass through your host OS's sound driver.
Under network, we can change how this VM connects to the Internet.
With NAT, Virtualbox will act like a router and forward the VM’s traffic so it appears
to originate from your host operating system.
With Bridged adapter, Virtualbox will act like a switch and pass your VM's traffic through
the host computer's physical network interface with its own MAC address.
It’s as if the VM was just another physical computer on
the network you’re connected to.
If you want other computers on the network to see and communicate directly with your
VM without port forwarding, use bridged.
Internal network lets you build a private network between multiple VMs you’re running,
so you can make a virtualized home lab to play around with.
This network can’t talk to the host computer or outside world though.
Host-only is similar to internal network, except the guests can talk the host computer.
NAT network is like private network, except the VMs can talk to the Internet.
Not attached isolates your VM from any network connectivity.
Shared folders let you choose a directory on your host OS to mount inside of your VM.
This is one way to transfer files between the host and guest OSes.
Now, malware that can escape your VM do exist, though they’re quite rare.
Most of them exploit the Shared folders, clipboard, and drag and drop functions in hypervisors.
So remember to disable these features when you're not using them.
Now that you’re familiar with the settings, let’s install Ubuntu Linux now.
Hit start to boot up the VM.
I’m gonna scale up the window so we can see things easier.
At launch, it’ll prompt us with running through the installation process.
I’m gonna do a minimal install to keep everything lean.
We’ll skip doing special partitioning setups like LVM and just let it use the default.
Pick a timezone you're in, and set the login and hostname information.
Then wait for the install to complete.
Once that’s done, click restart and make sure the installation ISO is unchecked, meaning
ejected, from the virtual CD drive so it can boot from the virtual hard drive.
Let me run through the what’s new screen real quick.
The next thing you wanna do is install Virtualbox’s Guest Additions by mounting it as a CD in
the VM.
This installs drivers that make everything run smoother and at better resolution.
Ubuntu doesn't come with some development packages that you need to install guest additions,
so we'll open up a Terminal and type the following command to make them.
We’ll need gcc, make, perl, dkms, and the build-essential packages.
Once that’s done, open the CD, run the software, and wait for it to complete.
Press enter, and then reboot the system.
Once it's back up, we can rescale the screen to a better resolution, and you’ll notice
much more responsive interaction now.
You should take a snapshot at this point so you have a clean installation state.
Go to Machine, Snapshot, and give it a name.
Now you're ready to use the VM like a normal operating system.
If I wanna transfer files between the host and guest without drag and drop or shared
folders, Virtualbox also lets me create a session by going to Machine, File Manger,
and providing a username and password to the VM.
I can go to my home desktop folders and transfer files back and forth.
I’ll copy the media creation tool we downloaded earlier.
As you can see, it’s now in the VM.
Let me show you snapshots in action now.
Let’s say I go to Wall Street Journal and get a bunch of tracking cookies.
While I could try to clear them out in the browser, it’s not a perfect sanitization.
I’ll take a snapshot of the current state, then power off the VM, go back to my snapshot
library, and restore to the first one, then click start.
Bam, back in time.
Now I’m gonna show you what your Ubuntu VM actually looks like on the host OS, with
Ubuntu taking up around 6GB, and an XML file defining the settings for the VM, a folder
for our saved snapshots, and one for our logs.
You can easily zip up this folder for backup and and send it to a friend to share.
We did it with Linux, now let’s make a Windows VM.
I’m gonna run through very similar settings, just with higher resource allocations.
In settings, I’ll now attach our Windows ISO to the virtual CD drive.
I'll bump up the CPU cores as well.
Let’s start the VM and go through the installation process.
Once you're at the activation step, enter a license key if you have one.
If you don't have one click, "I don’t have a product key" to use with some cosmetic restrictions.
What you shouldn't do is torrent some cracked or bootlegged version of Windows to use for
free perpetually.
You’re almost GUARANTEED to get bonus features that enroll your computer in a botnet controlled
by some crime group to mine cryptocurrency or attack other computers.
As the saying goes, if you don’t pay for the product it’s probably because YOU are
the product.
I’m gonna pick Windows 10 Pro N, which is for European customers and doesn't come with
pre-installed media technologies like Skype, Music, Video, and Voice Recorder.
Let’s move on to a custom install of Windows and partition this virtual drive.
While we're waiting, let me show you how VMs help you achieve two important security principles:
compartmentalization and ephemerality.
Compartmentalization is purposely separating things from each other so that damage to some
have limited effect on the whole.
If you imagine watertight compartments on a ship, flooding only a few compartments doesn’t
make the entire ship sink.
Same thing with a bank vault.
Once you’ve gotten through the big door, there’s hundreds of smaller deposit boxes
inside.
There’s really no way to pick through all of them in time before the cops come, which
limits the amount of money you can steal.
When it comes to virtual machines, software and data are contained, so application crashes
and lock-ups are isolated from your host OS and other VMs you’re running.
Same is true of malware infections, so much that security researchers will use VMs as
sandboxes reverse engineering conducting forensics.
The second principle, ephemerality, means changes to your state are temporary.
In the popular video game, Overwatch, a character called Tracer can rewind herself seconds back
to a previous location to reverse damage and avoid imminent danger.
With VMs and snapshots, we've got the same advantage.
Ephemerality gives you the luxury of taking on greater risks since the costs of doing
so are cheap.
Now if your host OS is already compromised, VMs aren’t gonna help you very much.
It’s best to start using them from a fresh host that you fully trust is clean.
Once Windows is done installing, we'll make sure it's ejected like last time by going
to devices, optical drives, and ejecting.
After the reboot, step through the welcome screen.
Now just like last time, we'll install the
Virtualbox Guest Additions drivers in this VM.
On Windows, it’s a bit more straightforward of an install.
After it's finished, reboot and login.
Now we can make the display larger from within Windows and make things easier to see.
I’ll do a fresh install snapshot, and we are good to go!
As you can see, using VMs with Virtualbox makes it incredibly flexible to start learning
cybersecurity.
It gives you exposure to different software and operating systems, lets you build virtual
networks to study networking protocols, and establish a development environment for programming
and coding.
So what are the cons of using virtual machines?
Well as a start, there's much higher resource requirements for running multiple OSes, since
you gotta divide and allocate them in advance.
There’s a rumor Bill Gates once said that 64kB of RAM ought to be enough for anyone.
I used to think 64GB of RAM ought to be enough for anyone too.
But when you’re running lots of virtual machines, there’s really no limit to how
much you’ll need.
Virtualization also doesn't give you that same snappy feel as the host OS.
This is especially true when it comes to graphics-intensive
activities like desktop animations, games or videos.
At the end of the day, I find that the performance and stability of virtual machines have really
improved over the years, and work quite nicely for day-to-day use.
So that's it for Virtualbox and how to build VMs.
You’ve successfully learned how to setup a hypervisor, configure and install an OS,
and operate your first virtual machine.
If this video was valuable for you, hit that like button, share it with your friends and
co-workers, and subscribe today.
And before you leave, I wanna know: what kinds of things are you using VMs for?
I do almost everything in VMs exclusively for the compartmentalization and security
benefits.
Thanks so much for watching, and if you have any questions, please let me know.
See you soon!