Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save srMarquinho/fdb76d84a1aab6bfc0c880bef59101e2 to your computer and use it in GitHub Desktop.
Save srMarquinho/fdb76d84a1aab6bfc0c880bef59101e2 to your computer and use it in GitHub Desktop.
Virtualbox - MacOS host - Linux Ubuntu guest - Local development

Local development setup

Set up VirtualBox with an Ubuntu virtual machine:

  • Sugested: RAM:2048MB, Storage:20GB

Create and mount a /dev folder from your Mac (Host) to the Ubuntu VM (Guest).

From Ubuntu guest:

  • Install the gest-additions.
$ sudo apt-get install dkms
$ sudo apt-get install virtualbox-guest-additions-iso
$ sudo apt-get install virtualbox-guest-x11
$ reboot
  • Permissions: Add yourself to the vboxsf group within the guest VM.
$ sudo adduser <user> vboxsf
  • Setup Port Forwarding to access the guest via the host.
    • Install OpenSSH on the VM. (instructions here)
    • Shutdown the VM and do:
    • VirtualBox > Settings > Network > Adapter 1 > Advanced > Port Forwarding > Add
    • Set as:
name Protocol Host IP Host Port Guest IP Guest Port
HTTP TCP 8080 80
SSH TCP 5679 22

Then you should be able to access http://localhost:8080 and ssh -p 5679 localhost from your Mac when running the server on Ubuntu. Mounted folder should be under ./media

Possible issues

unable to create symlink on Ubuntu guest

i.e. error: unable to create symlink node_modules/.bin/sshpk-conv (Read-only file system)

As per this comment/fix, symlinking in VirtualBox is disabled by default "for security reasons".

The fix:

  • On Mac host, shutdown Ubuntu and quit VirtualBox:

  • i.e. $ VBoxManage setextradata 'Ubuntu Server 16.04.4 LTS' VBoxInternal2/SharedFoldersEnableSymlinksCreate/dev 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment