Installation.asciidoc 4.33 KB
Newer Older
Leonardo Galli's avatar
Leonardo Galli committed
1
= Installation Instructions
Leonardo Galli's avatar
docs  
Leonardo Galli committed
2 3 4
Leonardo Galli <leonardo.galli@vis.ethz.ch>
v0.1, 2020-03-11
:toc:
Leonardo Galli's avatar
Leonardo Galli committed
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44

== Terminology

In the following, `host` will be used to refer to the machine you want to setup your Virtual Machine (i.e. where you do everything else).
`guest` will be used to refer to the operating system running inside your virtual machine.

== Prerequesites

There are a few prerequesites that need to be installed for the VM to be setup correctly.
You can find instructions on installing them below.

=== VirtualBox

VirtualBox is the default provider used to actually run the virtual machine itself.
The installation should be relatively self explanatory and you can find the latest download here: https://www.virtualbox.org/wiki/Downloads[VirtualBox Downloads]

Just select the download for your OS (e.g. Windows hosts) and run the installer.

=== Vagrant

Vagrant is the software used to configure the Virtual Machines.
The installation is very easy and you just have to download the installer found at https://www.vagrantup.com/downloads.html[Vagrant Download].

However, depending on your operating system, you might need to do some advanced configuration after installation.

==== Using Vagrant with the Windows Subsystem for Linux (WSL)
If you want to use vagrant through the WSL (the bash shell), you will have the follow the instructions provided by vagrant on their site: https://www.vagrantup.com/docs/other/wsl.html#windows-access[Vagrant WSL Instructions]

=== Ansible

Ansible is used to setup the Virtual Machine after it is booted by vagrant.
This includes installing any tools, changing configs, etc.

Installing ansible should be extremely simple, just run the following (on your host!):

[source,bash]
----
pip3 install ansible
----

Leonardo Galli's avatar
docs  
Leonardo Galli committed
45
NOTE: On some operating systems you probably need to run this as root / with sudo (`sudo pip3 install ansible`)
Leonardo Galli's avatar
Leonardo Galli committed
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126


== Cloning the Repository

This part should be relatively straight forward, clone this repository to a place you will quickly find again (mostly with your terminal).

Easiest way to do this, is - inside e.g. your home directory - running either

[source,bash]
----
git clone git@gitlab.ethz.ch:vis/ctf/ctf-vm.git
----

- if you have your ssh key linked - or

[source,bash]
----
git clone https://gitlab.ethz.ch/vis/ctf/ctf-vm.git
----

- if you do not.

== Configuration

After cloning the repository, configuration should be very straightforward.
Open config.rb in your favourite text editor (it's just a ruby file).
All options should have some documentation, but more than likely you only want to change the following two or three:

=== Shared Folders

[source,ruby]
----
:shared_folders => {
    # macOS
    "/Users/leonardogalli/CTF/shared" => "/home/vagrant/CTF",
    # linux
    "/home/leonardogalli/CTF/shared" => "/home/vagrant/CTF2"
},
----

Here you can define folders that are shared between your Virtual Machine and the host.
It is advisable to create a folder (that you can easily reach from both your terminal and gui), where you will be keeping all CTF related stuff.
Furthermore, I recommend actually creating a subfolder for files that are shared between host and Virtual Machine.
This helps keeping other stuff you might want to have in your CTF folder from appearing in the Virtual Machine.

Like in the example above, you specify the path on your host on the left and the path on the Virtual Machine on the right.
Feel free to add as many paths as you like!

=== SSH Key

[source,ruby]
----
:ssh_key => "/Users/leonardogalli/.ssh/id_rsa.pub",
----

While vagrant will automagically ssh you into the Virtual Machine, you will have to be in the correct folder (inside this cloned repository) for that to work.
Thus, it is a good idea to add your ssh key to the Virtual Machine. This way, you should be able to ssh - without entering a password.

=== CPU and Memory

[source,ruby]
----
:num_cores => 2,
:num_mem => 2048,
----

Here you can set the amount of CPU cores and MBs of RAM allocated for the Virtual Machine.
Since the purpose of these Virtual Machines is to merely run small binaries, they don't require large amounts of RAM or many CPU cores.

== Booting the VM

After you are done configuring, run

[source,bash]
----
vagrant up 27
----

to boot up your first virtual machine.

Now you are ready to read link:docs/Usage.asciidoc[Usage Guide] for learning more about how to use the Virtual Machine and what to do if something should break.