Install VirtualBox

Install VirtualBox, configure Host-Only Networking, and ensure Vagrant synced folders work flawlessly.

Projects: c2platform/gis/ansible-gis


Install VirtualBox

VirtualBox is required for certain nodes in this project, especially for MS Windows nodes where LXD is not an option. You can install it on Ubuntu with the following commands:

sudo apt-get install virtualbox virtualbox-guest-utils virtualbox-guest-x11

Allowing Any IP Addresses

To enable VMs to use network ranges other than 192.168.56.0/21, create a file called /etc/vbox/networks.conf.

sudo mkdir /etc/vbox
sudo nano /etc/vbox/networks.conf

Add the following line. For more details, refer to the 6.7. Host-Only Networking  .

* 0.0.0.0/0 ::/0
Show me
==> c2d-iis1: Clearing any previously set network interfaces...
The IP address configured for the host-only network is not within the
allowed ranges. Please update the address used to be within the allowed
ranges and run the command again.

  Address: 1.1.8.146
  Ranges: 192.168.56.0/21

Valid ranges can be modified in the /etc/vbox/networks.conf file. For
more information including valid format see:

  https://www.virtualbox.org/manual/ch06.html#network_hostonly

Configuring Synced Folders

On Ubuntu 22.04, ensure that “synced folders” work correctly by adding the following line to your ~/.bashrc file:

export VAGRANT_DISABLE_VBOXSYMLINKCREATE=0
Show me
Vagrant is currently configured to create VirtualBox synced folders with
the `SharedFoldersEnableSymlinksCreate` option enabled. If the Vagrant
guest is not trusted, you may want to disable this option. For more
information on this option, please refer to the VirtualBox manual:

https://www.virtualbox.org/manual/ch04.html#sharedfolders

This option can be disabled globally with an environment variable:

VAGRANT_DISABLE_VBOXSYMLINKCREATE=1

or on a per folder basis within the Vagrantfile:

config.vm.synced_folder '/host/path', '/guest/path', SharedFoldersEnableSymlinksCreate: false

Shared Clipboard

For better performance and usability, consider installing VirtualBox Guest Additions  on Vagrant boxes  based on VirtualBox images. If you’re using a project like c2platform/gis/ansible-gis, where the box c2platform/win2016  is used, VirtualBox Guest Additions are already installed.

If VirtualBox Guest Additions are installed, you can enable the shared clipboard by installing the VirtualBox Extension Pack with the following commands:

cd /opt
sudo wget https://download.virtualbox.org/virtualbox/6.1.38/Oracle_VM_VirtualBox_Extension_Pack-6.1.38.vbox-extpack
sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-6.1.38.vbox-extpack
sudo systemctl restart virtualbox.service

To enable shared clipboard functionality, follow these steps:

  1. Stop the VM(s) by running vagrant halt.
  2. Open VirtualBox Manager and navigate to FilePreferencesExtensions.
  3. If you have the Oracle VM VirtualBox Extension Pack installed, select it and uninstall it.
  4. Select Add New Package and locate the extension file at /opt/Oracle_VM_VirtualBox_Extension_Pack-6.1.38.vbox-extpack, then install it.
  5. Start the VM(s).

How to Downgrade the Kernel on Ubuntu 22.04

Learn how to downgrade the kernel on Ubuntu 22.04 to resolve compatibility issues with VirtualBox.



Last modified November 14, 2024: guideline tags en fme flow tags RWS-353 (ed0ed3f)