How to install OSM on VirtualBox

From OSM Public Wiki
Revision as of 10:41, 21 September 2018 by Fraiadan (talk | contribs)
Jump to: navigation, search

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 Rel THREE.

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

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

3) Install OpenSSH server (sudo apt-get install openssh-server) and update Ubuntu (sudo apt-get update)

4) Add a static address to the "Host-only" adapter (e.g. enp0s8 with static IP 10.20.0.90), e.g. appending the following 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

5) Restart the network services, then the VM should be reachable in ssh from the host using the static IP address

sudo service networking restart

6) Configure LXD following the instructions: OSM Release THREE LXD config

7) Install OSM following the instructions: OSM Three install

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

8) 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 

where DEFAULT_IP is the static IP address configured for host-only network)

9) Install OSM

./install_osm.sh 

10) 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)
sudo ./temp/installers/nat_osm      # in order to apply NAT rules

11) Check NAT rules in "/etc/iptables/rules.v4".

12) Access OSM GUI using https://10.20.0.90:8443 (admin/admin). You can also ssh to the Virtualbox VM running OSM (ssh ubuntu@10.20.0.90)