You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: sessions/session_03/README_PREP.md
+42-8
Original file line number
Diff line number
Diff line change
@@ -5,13 +5,21 @@ Install VirtualBox and Vagrant on your computer.
5
5
6
6
### Vagrant & VirtualBox
7
7
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.
9
9
10
-
Install Virtualbox:
11
10
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:
12
17
```bash
13
18
sudo apt install virtualbox virtualbox-ext-pack
14
19
```
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
15
23
16
24
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:
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:
25
41
26
42
```bash
27
43
vagrant plugin install vagrant-digitalocean
28
44
vagrant plugin install vagrant-scp
29
-
vagrant plugin install vagrant-vbguest
30
45
vagrant plugin install vagrant-reload
31
46
```
32
47
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:
34
49
35
50
```ruby
36
51
# -*- mode: ruby -*-
@@ -46,14 +61,23 @@ Vagrant.configure("2") do |config|
46
61
end
47
62
end
48
63
```
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
+
```
49
72
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`):
51
74
52
75
```bash
53
76
vagrant up
54
77
```
55
78
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).
57
81
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.
58
82
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.
> 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`.
0 commit comments