aboutsummaryrefslogtreecommitdiffstats
path: root/doc/README.vagrant
blob: 1d2f0438a5d91f949a7e5d058f0d0cf5a6cecba6 (plain)
1
2
3
4
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
45
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
1. Introduction

Vagrant is a virtual machine management program that makes it trivial to build
and configure reproducible virtual machines. Wireshark's source code includes
a Vagrantfile which can be used to set up a complete Ubuntu development
environment in a virtual machine, including all necessary compilers, dependent
libraries, and tools like valgrind.

Using vagrant can greatly simplify the creation of a Linux build environment
for new developers, at the cost of running your builds in a virtual machine,
thus with reduced performance.

2. Installation

The Vagrantfile included in Wireshark's source directory is configured to use
VirtualBox as the backing virtual machine technology provider. You must first
install VirtualBox from https://www.virtualbox.org/.

Now install vagrant itself from https://www.vagrantup.com/.

Please note that vagrant is a CLI command and should typically be installed in
your host system's $PATH. To better understand what vagrant is doing you may
want to review vagrant's `Getting Started` web pages.

3. Setup

By default vagrant looks for the file name Vagrantfile in the current
directory. Wireshark's Vagrantfile is located in the root of the Wireshark
source folder.

Once both VirtualBox and vagrant are installed, setting up an Ubuntu Wireshark
development VM is as simple as running `vagrant up` followed by
`vagrant provision`.

The first time that the `vagrant up` command is executed vagrant will initiate
the download of a specific Ubuntu VM image (what they call a box) from
HashiCorp's Atlas box catalog. Once the box is downloaded an Unbuntu VM will
be instantiated and powered-on.

Use the command `vagrant status` to determine the state of the VM.

The command `vagrant provision` will run any provisioning tasks defined in the
Vagrantfile. Wireshark's Vagrantfile is configured to run two bash based
provisioning scripts, vagrant_provision.sh and vagrant_build.sh. These
provisoning scripts are executed on the Ubuntu VM system and not on the host
system.

The vagrant_provision.sh script initiates several apt-get tasks to get the
Ubuntu VM reasonably up to date. The vagrant_build.sh script sets up a cmake
build environment which includes creating a ~/build folder initialized for an
out-of-tree cmake build and then triggering a build.

4. Usage

Running `vagrant ssh` from the wireshark source directory will log you into
Ubuntu VM as the userid vagrant.

The Ubuntu VM's build folder is located in ~/build. The Ubuntu VM's source
folder is actually the source folder from the host system mounted as /vagrant.
Any changes made in the VM's /vagrant folder are reflected in the host system's
Wireshark source folder and visa-versa.

Once logged into the VM issue the command `cd ~/build` followed by `make` to
trigger a new wireshark build based on whatever is in your host system's source
tree (the Ubuntu VM's /vagrant folder).

The various Wireshark applications can be run from the ~/build folder of the
Ubuntu VM with commands such as `./run/wireshark`, `./run/tshark`, etc.

To run the Wireshark GUI you will typically need an X server. If you are using
macOS ({Mac} OS X) as the host system then you would likely use XQuartz as
your X server. XQuartz can be downloaded from https://www.xquartz.org/.

The Ubuntu VM can be shutdown or suspended from the host system with the
commands `vagrant halt` and `vagrant suspend` repectively. In either case the
Ubuntu VM can be brought back up with the command `vagrant up`.