How to Create a Local Development Environment using Vagrant and VirtualBox
Vagrant allows you to start up a pre-built virtual machine with just two commands from a terminal. Vargrant uses Oracle's VirtualBox to run several virtual machine guests on Windows, MacOS or Linux hosts.
To initialise a new box to download to your local machine, do:
$ vagrant init ubuntu/focal64
This will create a Vagrantfile in your current directory that looks something like:
To start the Virtual Machine, use the
$ vagrant up
command in the same directory as the Vagrantfile
You should now see your VM running in the Oracle VirtualBox Manager GUI:
Now that the ubuntu-focal VM is up and running, we can SSH into it by opening a new terminal in the same directory as the Vagrantfile, and running
$ vagrant ssh
Related Links:
- How to Download and Install VirtualBox for your Host Machine
- How to Download and Install Vagrant for your Host Machine
- Creating Your First VM with Vagrant
- Fixing Some Virtual Machine Settings in the VirtualBox GUI
- Adding an Optical Drive to the Virtual Machine
- SSH into a Running Virtual Machine
- Checking for and Applying Virtual Machine Security Updates
- Installing Midnight Commander File Manager in a Virtual Machine
- Installing VirtualBox Guest Additions to a Virtual machine