Skip to content

Instantly share code, notes, and snippets.

@guycall
Last active September 26, 2017 07:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guycall/1748efa852b88e105a6bf688de10054c to your computer and use it in GitHub Desktop.
Save guycall/1748efa852b88e105a6bf688de10054c to your computer and use it in GitHub Desktop.
#!/bin/sh
# Purpose: a minimalistic provisioning of a fresh vagrant box
# based on Ubuntu 17.04 for Rails development.
# Created: 2017-09-25
# Updated: 2017-09-25
# Uses shell as the provisioner - https://docs.vagrantup.com/v2/provisioning/shell.html
# Avoid using official Canonical boxes since they do not conform to Vagrant's standards
# Vagrant's officially supported are the bento boxes.
# Assumsumptions:
# * Installed latest vagrant https://www.vagrantup.com/downloads.html
# * Installed latest virtualbox https://www.virtualbox.org/wiki/Downloads
# * Ran `vagrant init bento/ubuntu-17.04` and `vagrant up` https://app.vagrantup.com/bento/boxes/ubuntu-17.04
# * Edited the generated `Vagrantfile` setting this script as the provisioner. I.e. add this line
# `config.vm.provision "shell", path: "https://gist.github.com/guycall/1748efa852b88e105a6bf688de10054c"`
# Ensure OS is up to date
sudo apt-get update
sudo apt-get dist-upgrade
# Install Ubuntu's default version of Ruby (2.3.3)
# For more options can use the Brightbox repository https://www.brightbox.com/docs/ruby/ubuntu/
# or use a Ruby manager like rbenv or RVM.
sudo apt-get install -y ruby
sudo apt-get install -y ruby-dev
# Update RubyGems to latest version
sudo gem update --system
# Needed by gems that build native extensions
sudo apt-get install -y build-essential
# Needed to build mysql gem
sudo apt-get install -y libmysqlclient-dev
# Install mysql client
sudo apt-get install -y mysql-client
# Needed to build the pg gem
sudo apt-get install -y libpq-dev
# Needed to build rmagick gem
sudo apt-get install -y libmagickwand-dev
# Needed to build capybara gem
sudo apt-get install -y libqt4-dev libqtwebkit-dev
# Some other development essentials
sudo apt-get install -y git
sudo gem install bundler
# Currently I manually install mysql server (v5.7.x) since it
# prompts for root password. There are ways to script a silent install
# sudo apt-get install -y mysql-server
echo 'Welcome! Install mysql-server, then go to your app folder and run: bundle install, rake db:create, etc.. '
# The MIT License (MIT)
#
# Copyright (c) 2017 https://github.com/guycall
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment