How to run OSM on Vagrant

From OSM Public Wiki
Revision as of 08:16, 25 June 2018 by Israelad (talk | contribs)
Jump to: navigation, search

Basic instructions

Pre-built OSM vagrant images are available here: https://app.vagrantup.com/osm

The pre-built image requires 4GB of memory and 2 VCPUs.

1) Install vagrant (https://www.vagrantup.com) and virtualbox (https://www.virtualbox.org/)

2) Create the initial Vagrantfile in a predefined directory of your choice:

 vagrant init osm/releasefour --box-version 4.0.1

3) Edit the generated Vagrantfile if you need to customize, for example, opened ports and assigned memory:

  • If you would like to access the OSM Web client externally from the virtualbox VM, you can open up port 80 (mapped to 8080 at your host) by uncommenting this line:
 # config.vm.network "forwarded_port", guest: 80, host: 8080

4) Start OSM:

 vagrant up

5) ssh to OSM:

 vagrant ssh

6) Add the relevant environment variables for OSM client, either exporting them every time you access the shell, or copying the export lines to your .bashrc file.

export OSM_HOSTNAME=127.0.0.1
export OSM_SOL005=True

You are ready to use OSM !

Additional notes

  • If at any time you need to change something from the Vagrantfile, you can apply the changes by reloading the VM:
vagrant reload
  • If you need to copy a file to your vagrant machine, just run 'vagrant ssh-config' and copy the private key path, then:
scp -P 2222 -i /path/to/private_key someFileName.txt vagrant@127.0.0.1:
  • The vagrant box file can also be downloaded manually:
 wget https://vagrantcloud.com/osm/boxes/releasefour/versions/4.0.1/providers/virtualbox.box
  • To use a manually downloaded image, add the box to Vagrant and create a matching Vagrantfile:
 vagrant box add osm/releasefour /path/to/vagrant.box
 vagrant init osm/releasefour
  • If at any point you need to add the optional components (elk_stack, pm_stack...) you can do so by downloading the installer from inside your VM and executing it with the -o option, for example:
wget https://osm-download.etsi.org/ftp/osm-4.0-four/install_osm.sh
chmod +x install_osm.sh
./install_osm.sh -o pm_stack
  • Please note that you may need to add more forwarded ports, for example, to access Grafana after adding the pm_stack, you would need to add a line like this one to your Vagrantfile, then run 'vagrant reload':
config.vm.network "forwarded_port", guest: 3000, host: 3000