This install guide assumes that you have already followed my Vagrant/VirtualBox Guide and have it running successfully.
Open the “Vagrant” file that was created in the directory and add the below content and save:
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.provision :shell, path: "bootstrap-ubuntu.sh"
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
config.vm.provision "shell", inline: <<-SHELL
echo INSTALLING PACKAGE: tree------------------------------.
apt-get install tree -y
echo INSTALLING PACKAGE: snapd------------------------------.
apt install snapd -y
echo INSTALLING PACKAGE: hugo------------------------------.
sudo snap install hugo
SHELL
end
Next, in the same directory ensure a script file named “bootstrap-ubuntu.sh” exists and has:
#!/usr/bin/env bash
echo UPDATE: base machine------------------------------.
apt-get update
Having it setup this way allows for some flexibility in configuring the machine. You can run shell commands within the Vagrant file and/or have a bash script run.
Now, from that directory run:
vagrant status
For a clean install run:
vagrant destroy
Then run:
vagrant up
You’ll notice that it fails towards the end. The problem is that after the package ‘snapd’ is installed it requires a reboot of the machine before it continues, so the next hugo install command fails. This is expected, so now run the following two commands:
vagrant reload
vagrant provision
This should install the latest version of hugo. Log into the machine with:
vagrant ssh
You should now be in the command window for the actual virtual machine. Run the “hugo version” command to ensure that it was installed successfully:
hugo version
That is it; you are now ready to create some awesome static sites with ease! As always, stay inb8a!