Why use a Vertial Machine?
It is easiest to develop the websites locally, but there are advantages to develping inside a virtual machine. If you are planning to run a simple blog building a virtual machine does not make sense, but if you are planning to do some serious programming, it may be worth the investment to set up a virtual machine.
A virtual machine is like having a computer running inside a computer, in fact you can have as many guest computers as can fit into the computer memory.
Working in Virtial Machine Pros and Cons
- If something crashes the computer, like an instlled program, the guest can be rebuilt withing just few hours.
- The guest can be backack up periodically and restored if needed.
- The guest can be exactly the same setup as the server, therfore what works while developing, will work in production.
- Time investment to install
- Requires a more powerful computer with more memory to run computer inside computer
- The networking between host and guest is sometimes difficult to understand.
The easiest to use the VirtualBox virualizatin product.
After downloading the packages, install them.
My distribution of choice is the Ubuntu Server
Connecting to the Headless server
Select the virtual machine to edit
Click on Settings
Selct Network tab
Make sure the Enable Network Adapter is checked
Click on Port Forwarding
Clic on the Plus Sign to add a rule
Give the rule a name, its a note for yourself.
Add the Host port,
2222for SSH is a normal port.
Restart the virtual machine.
Serving Hugo from VirtualBox
$ hugo server --bind=10.0.2.15