How to install OSM on VirtualBox: Difference between revisions

From OSM Public Wiki
Jump to: navigation, search
No edit summary
No edit summary
Line 1: Line 1:
== How to setup OSM on VirtualBox (and access UI from the host without SSH tunnelling)==
----
VirtualBox has different networking setup modes (see [https://www.virtualbox.org/manual/ch06.html Table 6.1])
VirtualBox has different networking setup modes (see [https://www.virtualbox.org/manual/ch06.html Table 6.1])


In case we want to install OSM on VirtualBox, it needs an IP address that remains the same across reboots.
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.
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.
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) 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 [https://osm.etsi.org/wikipub/index.php/LXD_configuration_for_OSM_Release_THRE 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 [https://osm.etsi.org/wikipub/index.php/OSM_Release_THREE 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
1) Create a VM on VirtualBox (e.g. 8GB RAM, 40GB DISK)


9) when the installation is over, a final step to configure NAT
2) Configure network with 2 adapters: NAT + Host-Only


git clone https://osm.etsi.org/gerrit/osm/devops.git temp
3) Complete OSM installation following instructions here:


vi temp/installers/export_ips
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":


''change the DEFAULT_IF to DEFAULT_IF=enp0s8 (the interface used for Host-only network configuration)''
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


''apply NAT rules launching '' sudo ./temp/installers/nat_osm
5) Restart the network services
sudo service networking restart
6) Configure LXD following the instructions: [https://osm.etsi.org/wikipub/index.php/LXD_configuration_for_OSM_Release_THRE OSM Release THREE LXD config]


''check the rules with '' more /etc/iptables/rules.v4
7) Install OSM following the instructions: [https://osm.etsi.org/wikipub/index.php/OSM_Release_THREE 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)


''rules are ok even after reboot, but give it some time for the VM to start (1-2 mins)''
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".


10) access OSM using https://10.20.0.90:8443 admin/admin or ssh ubuntu@10.20.0.90
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)

Revision as of 12:13, 16 April 2018

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) Complete OSM installation following instructions here:

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

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)