Chapter 2. Your First Vagrant Machine

With Vagrant now installed on your system, let’s create your first Vagrant-managed work environment. This chapter introduces the few components involved in using Vagrant. You’ll see firsthand how easy it is to get started with Vagrant, how Vagrant can improve your workflow, and how fun having disposable work environments can be.

Vagrant is highly configurable—almost every default can be overridden. In this chapter, we’ll use the defaults so you can see just how easy it is to get started with Vagrant. In subsequent chapters, we’ll dive in depth into every feature exposed by Vagrant, so that you can make the perfect development environment.

To follow along in this chapter (and all remaining chapters in this book), you’ll need to open a command-line interface (e.g., Terminal or the Windows Command Prompt) and a text editor (e.g., Emacs, Vim, Eclipse, TextMate, etc.).

Up and Running

You can get started by simply running the following two commands. This will involve Vagrant downloading a file that is around 300 MB, but it will save time later since we’ll continue to reuse this file. The first command is the following:

$ vagrant init precise64 http://files.vagrantup.com/precise64.box
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.

As the output indicates, you’re ...

Get Vagrant: Up and Running now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.