Thursday, January 12, 2017

Getting Started with Vagrant on Windows

Vagrant is the hot new buzzword right now on the web, it seems like everyone must be using it.

If you don’t know, you’ll know Vagrant is a program to aid in creating virtual machines via a set of reusable options and configurations. Many people have shared their configurations and scripts via GitHub and elsewhere.

Vagrant is great if you want to spring up servers on-the-fly, to test programs, learn how to use Linux tools, or do stuff in a test environment before trying it on a production system. Do you want to learn to install the PHP Apache MySQL stack from scratch on a new server? Or play with setting up a cache server like Varnish in front of Apache? Even try your hand at Nginx? Vagrant makes things a bit simpler than using VirtualBox directly.

Vagrant logo

Let’s take a look at how to get Vagrant set up on Windows.

Installing the Megabits and Pieces

To get started, go ahead and install these tools:

Create Your Projects

Now that you have it all set up, you can start your first Vagrant project by creating a project folder, which will house the various configurations for each of your VMs. You’ll use the command line to run Vagrant commands from within these folders.

Create your first project folder and call it C:\vm\test\.

Tip: As a Windows user, you can quickly open a command prompt to your project by holding down shift and right-clicking the project folder, then choose “open command window here”.

Using Vagrant

The only commands we need to get servers up and running are vagrant init and vagrant up.

Open a command line and change directories to your test project folder. Then, type vagrant init and a new vagrant file will be created in the current directory. Open and read that file, there are lots of comments you can study. You can set shared folders between guest and host, turn on port forwarding, set the hostname, and more.

Browse the Vagrant Cloud for user-created base boxes you can use. For this example, we’ll use “ubuntu/trusty64” which is the “official” base box for Ubuntu Server 14.04 LTS (Trusty Tahr). Delete the Vagrant file you just created, and type the following:

Continue reading %Getting Started with Vagrant on Windows%


by Zack Wallace via SitePoint

No comments:

Post a Comment