Skip to content

Instantly share code, notes, and snippets.

@andradei
Last active July 15, 2019 04:14
Show Gist options
  • Save andradei/c46f60ac822d75cac8ee8782b704ea81 to your computer and use it in GitHub Desktop.
Save andradei/c46f60ac822d75cac8ee8782b704ea81 to your computer and use it in GitHub Desktop.
VirtualBox Ubuntu Server 16.04 Development Setup

Setup SSH from Host to Guest on VirtualBox

  1. Make sure VM is shutdown
  2. Go to Network settings of the VM you want to SSH in
  3. Generally the first Adapter is set to NAT. Go to Advanced and click in Port Forwarding
  4. Create a new rule (click in the icon with a "+" sign) and enter:
Name Protocol Host IP Host Port Guest IP Guest Port
ssh TCP 2222 22
  1. Click OK and start the VM (can start in headless mode if you prefer)
  2. Connect with ssh -p 2222 [user]@127.0.0.1

Install VirtualBox Guest Additions on Ubuntu Server 16.04 guest

  1. Make sure dkms is installed: sudo apt-get install dkms
  2. Insert Guest Additions disk: (On guest window) Devives (tab) -> Insert Guest Additions CD Image...
  3. Mount the disk: sudo mount /dev/cdrom /mnt/
  4. cd /mnt and sudo ./VBoxLinuxAdditions.run

Add a VirtualBox Shared Folder

  1. On the VM's settings: Shared Folders -> Add folder icon (small icon to the right of the panel) -> Choose folder to be shared -> Choose options for the share as you want -> Click OK -> Click OK
  2. Add your VM user to the VirtualBox group: sudo adduser your-user vboxsf
  3. (Re)start VM: sudo shutdown -r now
  4. Mounted folder will be in /media/sf_you-directory-name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment