How to install OSM on VirtualBox

From OSM Public Wiki
Revision as of 09:10, 16 April 2018 by Fraiadan (talk | contribs)
Jump to: navigation, search

How to setup OSM on VirtualBox (and access UI from the host without SSH tunnelling)



VirtualBox has different networking setup modes (see Table 6.1)

In case we want to install OSM on VirtualBox, it needs an IP address that remains the same across reboots. If the host is attached to DHCP and you cannot access the router to assign the same IP to your VMs, "bridged" mode could be difficult to manage. So, a possible alternative is to have two network adapters: one NAT that allows the VMs to access Internet + one Host-Only that allows static address on the VM and traffic from Host to VM.

OSM can be configured like that using the procedure below, tested on OSM r3.

1) create a VM on VirtualBox (e.g. 8GB RAM, 40GB DISK)

2) configure network with 2 adapters: NAT + Host-Only

3) complete installation and add a static address to the "Host-only" adapter (e.g. enp0s8 with static IP 10.20.0.90) and have something like this:

append this part to (/etc/network/interfaces)

auto enp0s8

iface enp0s8 inet static

address 10.20.0.90

netmask 255.255.255.0

network 10.20.0.0

broadcast 10.20.0.255

then restart the network services (sudo service networking restart)

4) update Ubuntu and install OpenSSH to allow remote ssh access

sudo apt-get update

sudo apt-get install -y openssh-server curl wget git

5) configure LXD (from the official guide OSM Release THREE LXD config)

sudo apt-get install -y lxd

newgrp lxd

sudo lxd init (all default but NO IPv6)

lxc list

sudo lxc profile device set default eth0 mtu 1446

6) download OSM install script, but wait to launch it! (from the official guide OSM Three install)

wget https://osm-download.etsi.org/ftp/osm-3.0-three/install_osm.sh

chmod +x install_osm.sh

7) before launching the installation, modify install_osm.sh:

find export_ips (2 times!), and add a line afterwards with

export DEFAULT_IP=10.20.0.90

(it is the static IP used for host-only network)

8) install OSM

./install_osm.sh

9) when the installation is over, a final step to configure NAT

git clone https://osm.etsi.org/gerrit/osm/devops.git temp

vi temp/installers/export_ips

change the DEFAULT_IF to DEFAULT_IF=enp0s8 (the interface used for Host-only network configuration)

apply NAT rules launching sudo ./temp/installers/nat_osm

check the rules with more /etc/iptables/rules.v4

rules are ok even after reboot, but give it some time for the VM to start (1-2 mins)

10) access OSM using https://10.20.0.90:8443 admin/admin or ssh ubuntu@10.20.0.90