How do I get started with Vagrant?
The simplest approach to get started with Vagrant is to install it and experiment with it. Aside from that, the official material is invaluable and provides excellent guidance for your first actions. It is also beneficial to be familiar with some of the basic terms used by Vagrant.
Box: A box is a pre-configured Vagrant environment, usually a virtual computer.
Provide: A provider is the site where the virtual environment is hosted. It can be local (VirtualBox is the default), remote, or even a specific case like a Docker container.
Provisioner: A provisioner is a tool for configuring the virtual environment. It can be as simple as a shell script, or it can be a more complicated tool like Chef, Puppet, or Ansible.
Your initial virtual machine
You will have a fully functional virtual machine with Ubuntu 18.04 LTS 64-bit after running the two commands below.
Initialize Vagrant
vagrant init hashicorp/bionic64
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
Before proceeding to the following step, make sure Vagrant has built a Vagrantfile
.
ls -al
-rw-r--r-- 1 kaitlincarter staff 3024 13:07 Vagrantfile
Start the virtual machine
You must start the virtual machine now that you have a Vagrantfile that configures your deployment.
vagrant up
When the virtual machine is successfully deployed, a notice stating that it is booted and ready will appear.
==> default: Machine booted and ready!
==> default: Configuring network adapters within the VM...
==> default: Waiting for HGFS to become available...
==> default: Enabling and configuring shared folders...
Connect to the machine using vagrant ssh and investigate your surroundings.
Logout to end the SSH session.
Destroy the virtual machine
When you're finished, make sure to shut off the virtual machine. When the CLI prompts you, type y to confirm.
vagrant destroy
==> default: Stopping the VMware VM...
==> default: Deleting the VM...
Vagrant allows you to work on any project, install any dependencies required by that project, and set up any networking or synchronized folders so you can continue working from the comfort of your own machine.
You've just finished creating your first virtual environment with Vagrant. Continue reading to discover more about project setup.
Top comments (0)