O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating Development Environments with Vagrant

Book Description

Improving your efficiency as a developer, programmer, or coder is the purpose of this book. It takes you through the steps one by one to help you set up and implement virtual development environments with Vagrant.

  • Provision virtual machines using Puppet and Chef
  • Replicate multi-server environments locally
  • Set up a virtual LAMP development server

In Detail

Vagrant is a tool for building complete development environments. With an easy-to-use workflow and focus on automation, Vagrant lowers development environment setup time, increases development/production parity, and makes the "it works on my machine" excuse a thing of the past.

"Creating Development Environments with Vagrant" is a practical, hands-on guide that walks you through the functionality of Vagrant, Puppet, and Chef to create powerful and flexible virtual development environments. Create your own virtualization environments containing configurations for different projects so that you can simulate complicated environments that can be easily shared with colleagues to get your projects up and running quickly and effortlessly.

"Creating Development Environments with Vagrant" starts with an introduction to virtualization and the concepts behind it, why it’s useful, and an overview of the architecture of Vagrant. We will learn to install Vagrant and get to know its prerequisites. Covering provisioning scripts with Puppet and Chef, learning to use them independently as well as with Vagrant to create a powerful combination.

If you want to locally test your projects, juggle multiple projects running on different versions of software, easily share technology requirement changes with colleagues, and, most importantly, want to perform all these tasks efficiently, then this book is for you.

"Creating Development Environments with Vagrant" will take you from a virtualization novice to running all of your projects across your team in robust, isolated virtual development environments.

Table of Contents

  1. Creating Development Environments with Vagrant
    1. Table of Contents
    2. Creating Development Environments with Vagrant
    3. Credits
    4. About the Author
    5. About the Reviewer
    6. www.PacktPub.com
      1. Support files, eBooks, discount offers and more
        1. Why Subscribe?
        2. Free Access for Packt account holders
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    8. 1. Getting Started with Vagrant
      1. Requirements for Vagrant
      2. Getting installed
        1. Installing VirtualBox
        2. Installing Vagrant
      3. Summary
    9. 2. Managing Vagrant Boxes and Projects
      1. Creating Vagrant projects
        1. Importing and using base boxes
        2. Creating projects without importing a base box
      2. Managing Vagrant boxes
        1. Adding Vagrant boxes
        2. Listing Vagrant boxes
        3. Removing Vagrant boxes
        4. Repackaging Vagrant boxes
        5. Finding Vagrant boxes
      3. Controlling guest machines
        1. Powering up the virtual machine
        2. Suspending the virtual machine
        3. Resuming the virtual machine
        4. Shutting down the virtual machine
        5. Starting from scratch
        6. Connecting to the virtual machine over SSH
      4. Integration between the host and the guest
        1. Port forwarding
        2. Synced folders
        3. Networking
      5. Auto-running commands
      6. Summary
    10. 3. Provisioning with Puppet
      1. Provisioning
      2. About Puppet
        1. Creating modules and manifests with Puppet
          1. Puppet classes
          2. Default Puppet manifests
          3. Resources
            1. Resource requirements
          4. Resource execution ordering
        2. Installing software
          1. Updating our package manager
          2. Installing the Apache package
          3. Running the Apache service
        3. File management
          1. Copying a file
          2. Creating a symlink
          3. Creating folders
          4. Creating multiple folders in one go
        4. cron management
        5. Running commands
        6. Manage users and groups
          1. Creating groups
          2. Creating users
          3. Updating the sudoers file
        7. Subscribe and refresh only
        8. Puppet modules
        9. Using Puppet to provision servers
      3. Summary
    11. 4. Provisioning with Chef
      1. Knowing about Chef
      2. Creating cookbooks and recipes with Chef
        1. Resources – what Chef can do
        2. Installing software
          1. Updating our package manager
          2. Installing the Apache package
          3. Running the Apache service
        3. Understanding file management
          1. Copying a file
          2. Creating a symlink
          3. Creating folders
          4. Creating multiple folders in a single process with looping
        4. Managing cron
        5. Running commands
        6. Managing users and groups
          1. Creating groups
          2. Creating users
          3. Updating the sudoers file
        7. Knowing common resource functionalities
        8. Using Chef cookbooks
        9. Using Chef to provision servers
      3. Summary
    12. 5. Provisioning with Vagrant using Puppet and Chef
      1. Provisioning within Vagrant
      2. Provisioning with Puppet on Vagrant
        1. Using Puppet in a standalone mode
          1. Puppet provisioning in action
        2. Using Puppet in client/server mode
      3. Provisioning with Chef on Vagrant
        1. Using Chef solo
        2. Using Chef in a client/server mode
      4. Other built-in provisioners
        1. Provisioning with SSH – a recap
        2. Ansible playbooks
      5. Using multiple provisioners on a single project
      6. Overriding provisioning via the command line
      7. Summary
    13. 6. Working with Multiple Machines
      1. Using multiple machines with Vagrant
        1. Defining multiple virtual machines
      2. Connecting to multiple virtual machines over SSH
        1. Networking multiple virtual machines
        2. Provisioning the machines separately
      3. Destroying a multi-machine project
      4. Summary
    14. 7. Creating Your Own Box
      1. Getting started
      2. Preparing the VirtualBox machine
      3. VirtualBox Guest Additions
      4. Vagrant authentication
        1. Vagrant user and admin group
        2. Sudoers file
        3. Insecure public/private key pair
      5. Provisioners
        1. Puppet
        2. Chef
      6. Cleanup
      7. Export
      8. Summary
    15. A. A Sample LAMP Stack
      1. Creating the Vagrant project
      2. Creating the Puppet manifests
        1. Installing Apache
        2. Enable an Apache rewrite module
        3. Installing MySQL
        4. Installing PHP
      3. Installing e-mail
      4. Default manifest
      5. Launch the VM
      6. Summary
    16. Index