Getting started with Vagrant
So, I got sucked down another rabbit hole and decided to explore “Vagrant”. The environment here is
- MacBookPro 15″ with
- macOS Sierra, v 10.12.6;
- processor 2GHz Intel Core i7;
- 8 GB 13333 MHz DDR memory
- VirtualBox v 5.1.28
Installation appeared to complete smoothly, without complications.
The next section in the “Getting Started” document gives two command line commands:
$ vagrant init hashicorp/precise64
$ vagrant up
First command appeared to complete normally. vagrant init hashicorp/precise64 returned:
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.
And I did indeed read through the Vagrantfile. Fascinating! These are good comments. They are explanatory, lucid, and not too opaque. For example:
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# NOTE: This will enable public access to the opened port
# config.vm.network "forwarded_port", guest: 80, host: 8080
But wait a minute! The actual configuration directive, “config.vm.network “forwarded_port”, guest: 80, host: 8080″ is commented out. Shouldn’t that hash mark be deleted? Is this comment simply showing the vagrant defaults? Or am I supposed to select what I think are the relevant, desired config directives and un-comment them.
I’m kind of a literal guy … Absent specific, enumerated instructions, I don’t make self-initiated changes.
That is especially true when we get to the segment of the Vagrantfile that deals with VirtualBox. The Vargrantfile lists:
# config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = true
# # Customize the amount of memory on the VM:
# vb.memory = "1024"
So, I proceed to the next step.
$ vagrant up
That command completes with errors. Here’s the text the command returned:
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'harshicorp/precise64' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
The box 'harshicorp/precise64' could not be found or
could not be accessed in the remote catalog. If this is a private
box on HashiCorp's Vagrant Cloud, please verify you're logged in via
`vagrant login`. Also, please double-check the name. The expanded
URL and error message are shown below:
Error: The requested URL returned error: 404 Not Found
Well! That wasn’t expected!
Did I miss an instruction to “login to vagrant”? Nope. I’ve gone back to the documentation and looked very carefully an instruction to “login”. I can’t find it.
Not to be deterred, I call for “vagrant login” and receive the following message:
In a moment we will ask for your username and password to HashiCorp's
Vagrant Cloud. After authenticating, we will store an access token locally on
disk. Your login details will be transmitted over a secure connection, and
are never stored on disk locally.
If you do not have an Vagrant Cloud account, sign up at
OK, I can go along with the gag. I toddle off to vagrantcloud.com and create an account. I return to my terminal try the vagrant up command again… And still get the http error 404: file not found. <!SIGH/>
Let’s go see where this precise64 file is.
It turns out that navigating to https://vagrantcloud.com/harshicorp/precise64 actually lands me in https://app.vagrantup.com/harshicorp/boxes/precise64 AND a very politely worded HTTP 404 says:
404 Not Found
Sorry, the page /harshicorp/boxes/precise64 could not be found.
This error could mean one of three things:
The resource doesn't exist
The resource exists, but requires proper authorization to access
The resource exists, but its owner organization is delinquent
If someone has linked you to this resource, ensure that they have given you proper permissions to access it.
So what does a DBA have to do to get a working URL to this demo box?