Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Vagrant Virtual Development Environment Cookbook

You're reading from   Vagrant Virtual Development Environment Cookbook 35 solutions to help you utilize virtualization with Vagrant more effectively – learn how to develop and manage Vagrant in the cloud to improve collaboration

Arrow left icon
Product type Paperback
Published in Feb 2015
Publisher
ISBN-13 9781784393748
Length 250 pages
Edition 1st Edition
Tools
Arrow right icon
Author (1):
Arrow left icon
Chad O Thompson Chad O Thompson
Author Profile Icon Chad O Thompson
Chad O Thompson
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Setting Up Your Environment FREE CHAPTER 2. Single Machine Environments 3. Provisioning a Vagrant Environment 4. Provisioning with Configuration Management Tools 5. Networked Vagrant Environments 6. Vagrant in the Cloud 7. Packaging Vagrant Boxes A. Vagrant Plugins B. A Puppet Development Environment C. Using Docker with Vagrant Index

Running basic shell commands

The most basic method of provisioning is to run simple shell commands in the Vagrant machine. For Linux environments, this typically means executing basic shell commands with shells that are typically bundled with distributions (sh, bash, zsh, and so on). The provisioning process can also execute other command-line applications if runtime environments are installed (such as system provisioning with Ruby or Perl).

In this example, we'll use a shell command to install a basic Message of The Day command to output a greeting on login using the vagrant ssh command.

How to do it...

  1. We'll start this example with a simple Vagrantfile that boots a basic Ubuntu environment. Here is the complete Vagrantfile:
    # -*- mode: ruby -*-
    # vi: set ft=ruby :
    
    VAGRANTFILE_API_VERSION = "2"
    
    Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
      config.vm.box = "puppetlabs/ubuntu-14.04-32-nocm"
    end

    Booting this environment with vagrant up will start a basic...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image