82 lines
4.8 KiB
Markdown
82 lines
4.8 KiB
Markdown
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
title = "Virtualization"
|
|
date = 2024-04-17
|
|
slides = true
|
|
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
|
# Virtual Machines (and more)
|
|
-------------------------------------------------------------------------
|
|
so what is a virtual machine???
|
|
-------------------------------------------------------------------------
|
|
basically you run another smaller computer in your computer
|
|
-------------------------------------------------------------------------
|
|
*insert inception joke here\*
|
|
-------------------------------------------------------------------------
|
|
### Why would you want this?
|
|
-------------------------------------------------------------------------
|
|
- You can run multiple OSes on one machine
|
|
- You can run software that might not be compatible with your main OS
|
|
- It's helpful for testing and setting up a new OS
|
|
- VMs are used **A LOT** in those big server rooms and professional environments
|
|
-------------------------------------------------------------------------
|
|
### How do I do this on my own laptop then?
|
|
-------------------------------------------------------------------------
|
|
there's a lot of *virtualization* software out there, but we'll be using VirtualBox today
|
|
-------------------------------------------------------------------------
|
|
It's free, and it's pretty easy to use
|
|
-------------------------------------------------------------------------
|
|
you can download it [here](https://www.virtualbox.org/wiki/Downloads)
|
|
-------------------------------------------------------------------------
|
|
if you already know all of this just wait we have more stuff after this
|
|
-------------------------------------------------------------------------
|
|
when you open VirtualBox, create a new VM like this:
|
|
<img src="7_virtualization/new-vm.png" alt="Create a new VM" width="400px" height="187px"></img>
|
|
-------------------------------------------------------------------------
|
|
then choose a name and select the image to use for the OS
|
|
<img src="7_virtualization/select-image.png" alt="Choose an image" width="351px" height="196px"></img>
|
|
I'll be using Ubuntu 24.04, if you want to use another linux distro you probably know how to do this already
|
|
-------------------------------------------------------------------------
|
|
now, select how much memory and CPU you want to allocate to the new VM
|
|
<img src="7_virtualization/memory-cpu.png" alt="Allocate memory and CPU" width="353px" height="196px"></img>
|
|
The defaults you get are fine for this demo
|
|
-------------------------------------------------------------------------
|
|
and finally, choose how much storage you want to give the VM
|
|
<img src="7_virtualization/storage.png" alt="Allocate storage" width="352px" height="196px"></img>
|
|
10GB is enough for now, you can use more if you want
|
|
-------------------------------------------------------------------------
|
|
### Click "Finish" and now you got your new VM!!
|
|
-------------------------------------------------------------------------
|
|
we still need to install the operating system but that's easy enough
|
|
-------------------------------------------------------------------------
|
|
*live demo in progress\*
|
|
-------------------------------------------------------------------------
|
|
### Now on to the next part (it gets better)
|
|
-------------------------------------------------------------------------
|
|
you probably saw how many resources it takes to run a VM
|
|
-------------------------------------------------------------------------
|
|
what if I want to only run a single app without all the overhead??
|
|
-------------------------------------------------------------------------
|
|
### Containers to the rescue!!
|
|
-------------------------------------------------------------------------
|
|
containers are kind of like VMs, but much lighter
|
|
-------------------------------------------------------------------------
|
|
instead of emulating an entire computer, they just run the OS
|
|
-------------------------------------------------------------------------
|
|
### Why use VMs then?
|
|
-------------------------------------------------------------------------
|
|
- VMs are more secure
|
|
- they're more isolated from the host system
|
|
- not limited to running the same OS as the host
|
|
-------------------------------------------------------------------------
|
|
### How do I use containers?
|
|
-------------------------------------------------------------------------
|
|
one of the most popular container platforms is Docker
|
|
-------------------------------------------------------------------------
|
|
rn we will use it on the VM we just created
|
|
-------------------------------------------------------------------------
|
|
the commands we will need to install Docker:
|
|
```
|
|
curl -fsSL https://get.docker.com -o get-docker.sh``
|
|
sudo sh get-docker.sh
|
|
```
|
|
-------------------------------------------------------------------------
|