Skip to content

jhwohlgemuth/my-virtual-machine-setup

Repository files navigation

My Virtual Machine Setup   CodeFactor

Create development environments with Vagrant & Packer

Caution

This project is not actively maintained and may or may not actively function as described. You will find my current shell setup here and my current dev environment (using containers) here 🤓

What?

  • Vagrant is a high-level wrapper API for kernel-based virtual machines (KVM). Vagrant uses packaged environments called boxes and allows one to manage, configure, and control virtual environments with code and automation.

  • Packer enables one to create Vagrant boxes (and other things) via an automated and repeatable process driven by a single JSON-formatted template file.

Requirements

Quick Start

Warning: Internet connection is required

  • Open up a command prompt (or Git bash)
  • Create and enter a new directory:
mkdir path/to/dev/dir && cd path/to/dev/dir
  • Initialize a Vagrantfile and start your Vagrant box:
vagrant init jhwohlgemuth/env && vagrant up

See the Vagrant Getting Started guide for more information

Customize the Vagrant Box

The default jhwohlgemuth/env Vagrant box hosted on Atlas, includes the ~/.jhwohlgemuth directory that has some useful files.

usage:

#setup.sh is executable and can be run with just:
~/.jhwohlgemuth/setup.sh

usage:

#Most functions require root privileges
sudo -s
#Functions are sourced when terminal is opened
#Type 'install_' followed by tab to see the available install functions
#Type 'setup_' followed by tab to see the available setup functions

Create Your Own Vagrant Box with Packer

Warning: Internet connection is required

Warning: This sections requires that Packer is installed

Warning: An Atlas token is not required for box creation, but not having one set will cause the atlas post-provisioner to fail.

#Set token for connecting to Atlas
export ATLAS_TOKEN=<your secret token>
#Validate Packer template and fix errors if applicable
packer validate packer.json
#Start the build process. Go get a coffee.
packer build packer.json

See the official Packer Introduction for more information