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).
- Set it to Auto-mount and Make Permanent. You can find instructions here.
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
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