Skip to content

Commit 3fb07a9

Browse files
committed
Automatic release of teaching material.
1 parent 0a2596c commit 3fb07a9

File tree

1 file changed

+42
-8
lines changed

1 file changed

+42
-8
lines changed

sessions/session_03/README_PREP.md

+42-8
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,21 @@ Install VirtualBox and Vagrant on your computer.
55

66
### Vagrant & VirtualBox
77

8-
In case you are running MacOS or Windows you might find helpful [installation instructions for your host operating system in the linked guide](https://www.itu.dk/people/ropf/blog/vagrant_install.html). Note, Vagrant cannot be run in a VirtualBox VM. This means that you should install Vagrant and related plugins in your host OS (Windows/MacOS) if you are running Linux in a virtual box already. This is because vagrant creates VMs, and creating VMs from a VM can cause problems.
8+
**Note :** In case you are running MacOS or Windows you might find helpful [installation instructions for your host operating system in the linked guide](https://www.itu.dk/people/ropf/blog/vagrant_install.html). If you're running running a Mac with an ARM processor (M1, M2, M3 as of 2025) then you can't install VirtualBox, but you'll have to install UTM instead of VirtualBox. The instructions below are alternating between how to work with VirtualBox or UTM. Read them attentively and apply what makes sense to your own situation.
99

10-
Install Virtualbox:
1110

11+
12+
**Note:** Vagrant cannot be run in a VirtualBox VM. This means that you should install Vagrant and related plugins in your host OS (Windows/MacOS) if you are running Linux in a virtual box already. This is because vagrant creates VMs, and creating VMs from a VM can cause problems.
13+
14+
#### Install the Hypervisor (VirtualBox, UTM)
15+
16+
To install VirtualBox you can use sudo:
1217
```bash
1318
sudo apt install virtualbox virtualbox-ext-pack
1419
```
20+
**Note:** If you are on a Mac with ARM processor you install UTM either via their UI: https://mac.getutm.app/ or with brew: `brew install --cask utm`
21+
22+
#### Install Vagrant
1523

1624
Since the packaged Vagrant in the linked repositories is in a bit buggy version we install it directly from the package provided by the tool vendor:
1725

@@ -21,16 +29,23 @@ echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://
2129
sudo apt update && sudo apt install vagrant
2230
```
2331

24-
After installing Vagrant, we need to install a Vagrant plugin that we will need later:
32+
After installing Vagrant, we need to install a VirtualBox plugin that we will need later:
33+
```bash
34+
vagrant plugin install vagrant-vbguest
35+
```
36+
For UTM you install the corresponding plugin
37+
```
38+
vagrant plugin install vagrant_utm
39+
```
40+
We install a few other useful plugins:
2541

2642
```bash
2743
vagrant plugin install vagrant-digitalocean
2844
vagrant plugin install vagrant-scp
29-
vagrant plugin install vagrant-vbguest
3045
vagrant plugin install vagrant-reload
3146
```
3247

33-
Save the following into a file called `Vagrantfile` in your current directory:
48+
If you're using VirtualBox save the following into a file called `Vagrantfile` in your current directory :
3449

3550
```ruby
3651
# -*- mode: ruby -*-
@@ -46,14 +61,23 @@ Vagrant.configure("2") do |config|
4661
end
4762
end
4863
```
64+
If you're using UTM replace the above `config.fm.box` and `config.fm.provider` lines with a corresponding ones from UTM, i.e.
65+
66+
```ruby
67+
config.vm.box = "utm/bookworm"
68+
69+
#...
70+
config.vm.provider "UTM"
71+
```
4972

50-
Now, try to run from your current directory (the one in which you saved the `Vagrantfile`):
73+
Now, run from your current directory (the one in which you saved the `Vagrantfile`):
5174

5275
```bash
5376
vagrant up
5477
```
5578

56-
The command downloads the OS image `bento/ubuntu-22.04` and brings up a virtual machine on your computer (with Virtualbox as backend).
79+
80+
The command downloads the OS image specified in the configuration and brings up a virtual machine on your computer (with the specified hypervisor as backend).
5781
It will take some time since the corresponding OS image has to be downloaded first. That image will be cached on your disk, i.e., following VM instantiations of the same image will be faster.
5882
Observe that no error message is displayed. If so, and in case you cannot find a solution for it, we will look at it in class.
5983

@@ -85,7 +109,17 @@ $ vagrant init bento/ubuntu-22.04
85109
$ vagrant up
86110
```
87111

88-
> After running the above commands, you will have a fully functional VM in VirtualBox running Ubuntu 22.04 LTS 64-bit. You can SSH into this machine with `vagrant ssh`, and when you are done playing around, you can terminate the virtual machine with `vagrant destroy`.
112+
for UTM the equivalent init lines that would start an Ubuntu bookworm could be:
113+
114+
```
115+
vagrant init utm/bookworm
116+
vagrant up --provider=utm
117+
118+
```
119+
120+
> After running the above commands, you will have a fully functional VM in VirtualBox running Ubuntu. You can SSH into this machine with `vagrant ssh`, and when you are done playing around, you can terminate the virtual machine with `vagrant destroy`.
121+
122+
89123

90124

91125
#### Accessing a VM

0 commit comments

Comments
 (0)