Vagrant, VirtualBox, Ubuntu 16.04 Setup

Setup Vagrant

replace project with any name you wish.

$ mkdir project

$ cd project

$ vagrant init ubuntu/xenial64

In text editor – Vagrantfile located within the ‘project' folder, change config.vm.network “forwarded_port”, guest: 80, host: 8080 to:

Change config.vm.network "forwarded_port", guest: 80, host: 80

or

Change config.vm.network "forwarded_port", guest: 80, host: 8080

Also by using synced folders, Vagrant will automatically sync your files to and from the guest machine. Uncomment and change the line in Vagrantfile from:

# config.vm.synced_folder "../data", "/vagrant_data"

to

config.vm.synced_folder "html", "/var/www/html"

where “sites” can be any name you choose inside your ‘project' folder. Now whatever folders/files you place inside “sites” will be processed by Ubuntu/Vagrant local server.
https://www.vagrantup.com/docs/getting-started/synced_folders.html

note: can also open a notepad from the command line and edit like this:

start notepad Vagrantfile

Then:

$ vagrant up

You can continue using Git and ssh into ubuntu:

$ vagrant ssh
$ sudo apt-get update
$ sudo atp-get upgrade

or open putty and ssh into vagrant using 127.0.0.1 as the Host Name/IP address, and 2222 as the Port.

login: vagrant
password: vagrant

then,

$ sudo apt-get update
$ sudo atp-get upgrade

Resources

VirtualBox
Vagrant
Putty
Notepad++

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.