The Ultimate Guide to Getting Started with Vagrant and Why Every Software Developer Should’ve Been Using it Like Yesterday.

Why do all the blog posts ever make vagrant into rocket science?

I mean… It CAN be like rocket science but getting started with it is so easy my great grandma can do it — and she’s not even alive. That should give you a rough sense of how easy it is.

Before we begin, I’m gonna need you to put your onesies on because this stuff can get a little heavy. We are gonna be talking about concepts like Virtual Environments, Package Managers, VMware, and Development Environments.

Whether you just learned how to turn on your computer, or you are a rocket scientist… Learning the basics about this stuff will not only save you years of frustration, pain, and misery. But, it will also allow you to quickly build mouthwatering real world projects that soup up your portfolio and dazzle your potential employers.

Plus, you get to put all of this on your resume. Most professional development teams at companies are dying to hire people who can streamline their development process using things like VMware and all the other cool stuff I’ll be showing you in this post.

I’ll be keeping the examples specific to python but this is just as useful and applicable to a developer working in ANY language (Java, Ruby, PHP, Javascript, etc).

It took me YEARS to learn about this stuff because most online blog posts were made by P.H.D’s or by developers who write for other developers!

And now that I know this stuff, I could NEVER go back to that old lifestyle. If I COULD go back… I would slap my old self in the face and force him to learn this stuff.

Countless of my dreams have died simply because certain libraries I needed wouldn’t get installed, or JUST WOULDN’T WORK! I followed every step in the docs, read stackoverflow, scoured reddit, and even read through every single closed issue in the library’s github repo to see if my problem was already solved by someone else… But NOPE.

Finally, after going through all that tedious work, I would give up and just try to do a more boring project because it required things I already had in my computer.

Before we start, let’s first talk about your life now without Vagrant.

Your Problematic Life Without Vagrant

Most of the times following an online tutorial or working on whatever project you want works just fine. You pip install your way through hell and virtualenv like a boss to get stuff done.

I know most of you reading this from the Clever Programmer community have ZERO idea about this but, this is a game changer, so listen up.

For my beginner python friends or people from outside the python world — GASP — pip is a package manager in python which allows you to install modules and libraries super easily (basically it makes it dangerously easy to ethically steal code and get infinite power)!

pip install django

Now you’re ready to create django apps.

pip install flask

You’re ready to create flask apps. Yeah, it’s that easy.

Unless, of course, you try pip install scipy or pip install scikit-learn or pip install pygame or pip install numpy

You get the idea.

Now, if you’re incredibly lucky or you have deliberately worked to create the perfect setup, 99% of you WON’T be able to get all of those libraries installed without a problem… If at all.

If you are on Windows you might have even gotten the beautiful bash: pip: command not found error. God, I just hate Windows. Windows sucks for developers.

My advice is usually to buy a mac OS or get a Virtual Machine installed as fast as possible. BUT, you’re in luck. Vagrant just saved you $1500, once you learn how to use it of course.

Virtualenv allows you to create these little virtual environments where Django project doesn’t have to know about your Flask project. Just like your bathroom doesn’t know about your kitchen. How does that saying go again, “Don’t sit where you eat”…? Yeah, I think it’s something like that. Anyways, moving on!

Now, let’s talk about…

What your life will be like after Vagrant

  • Use your favorite OS — Since you ssh into this (you’ll know what SSH means if you don’t know already), you get to be on your favorite operating system. I personally HATED having Ubuntu VMware on my MacOS because Mac’s OS is way more mature than the freebie and bad Ubuntu. Plus VMwares are not native so they slow your computer down AND they are clunky.
  • You’ll be able to follow every tutorial & learn any new technology without any problem — No environment problem just because you have Windows, or that your ruby virtual environment is broken, or that your paths are all screwed up. I remember way back when I couldn’t get iPython to work, or I couldn’t install npm cause of some random stuff being broken in my computer.
  • Everyone in the world will be able to use your code — No more “umm… well it works on my machine” crap. This is awesome for professional developers working on a team, beginner coders who want to share their code, or teachers trying to get all their students on the same page without pulling their hair out(the last one is the story of my life.)
  • Your hire-ability will skyrocket plus you’ll beef up that resume — Employers love people who can use virtual environments, package managers, virtual machines, and tools like Vagrant! Anything cloud based gets those shot callers drooling.
  • You’ll save years of your time and 10x your progress in your software development journey– You won’t feel like crying. You won’t give up. Plus you’ll get stuff done. FAST. Period.
  • Stick with your favorite editor — Because of something called Synced Folders in Vagrant… You get to even use your favorite editors like Sublime Text, Atom, or Pycharm AND your favorite OS! This wouldn’t be possible if you used a VMware.

If you’re not sold yet… You’re just a wannabe developer and you should just quit.

Still here? Are you pumped?


I’m gonna show you the EASIEST way for you to add vagrant into your life and it’ll take like 5 min (unless your internet sucks).

Let’s Get You All Vagrant-ed UP!

Step 1: Download and Install Vagrant

Step 2: Download and Install VirtualBox

All done? Great!

You now have more power than you know. I envy you learning this so early in your coding life! Let’s power through that gorgeous command line stuff now.

Step 3: Open that command line (and follow along ❤)

On windows, open up cmd or powershell. If you can’t figure out how to open up those… Smh.

On Mac, open up your terminal (cmd + space, that opens up your spotlight and then type in terminal ).

Okay now type in the following.

mkdir folder_of_awesomeness
cd folder_of_awesomeness
vagrant init bento/ubuntu-16.04
vagrant up
vagrant ssh

I’ll talk about the synced folders later in the post. For now, I’ve just shown you how to access your shiny new Ubuntu Vagrant Box.

Note: If you got the error Timed out while waiting for the machine to boot … Don’t PANIC! You probably just need to upgrade your Virtual Box.

Note: Windows Users use PUTTY to SSH:

protocol: SSH
Port 2222

(Don’t you just love windows? It always has these ugly workarounds. Sorry for these tangents but I will brow beat you till you get a Mac like a real developer.)

Here’s roughly what you should be seeing right now:

Obviously your folder wouldn’t be called vagrant_medium_blog but folder_of_awesomeness instead.

And BOOOOOM!!!! You’ve just ventured into a completely different virtual world. I know for some people this might be confusing like… What’s so special about this?

The Infinite Power Behind the Ugly Command Line

What that screen means is that you are in a completely different computer. So, if you were on a Windows… You’re not anymore! Woohoo! Just saved you $1,500. You can thank me later.

Unfortunately, there is no way to control this computer with your mouse to be able to drag and drop things using a beautiful user interface. All you have is the ninja command line. But, you’re literally controlling different computers in the world and can hack the ULTIMATE setups with like 3 lines of code. THIS is why the command line is so powerful. (Command line, Terminal, Powershell, CMD, I use them interchangeably)

Using Vagrant, you could use people’s pre-built boxes and get their entire systems wth few lines of code.

Now, here’s all you have to do to get your python 3 up & running.

sudo apt-get install python3 python3-pip 
(I love Ubuntu’s package manager apt-get. You install everything using this in Ubuntu).

Now do python3 and your python should be running. Now, you’re probably like…

THAT’s not that impressive. Python3 was already running for me!

BUT, what is cool is that you could go and steal another virtual box using vagrant and finally follow that advanced image recognition tutorial you couldn’t follow before because you couldn’t get all the tools installed on your computer.

You could get numpy library working, or that nodejs working, AND you could share your environment (box) with anyone else in the world and they could just run your python code without having to do ANY extra work or installing ANY extra things.

If you were having problems getting any tools working in your windows or even in your mac, you could just go here now and [ethically] steal boxes that are made to get all the things you want working.

Now if you want something more complicated like a postgres database, that’s super easy too. Just do sudo apt-get install postgresql .

Let’s Break It Down

I’ll start off by running you through some command line basics as a refresher and then walking you through the vagrant lines.

  • mkdir => creates a directory
  • cd => change directory
  • vagrant init bento/ubuntu-16.04 => It creates a Vagrantfile in your directory. If you type in ls you’ll see it. If you do cat Vagrantfile you’ll the contents of the entire file. What I want you to focus on is this; Scroll up a bit and find a line that reads = "bento/ubuntu-16.04" . This means that when you run this file, it’ll download and install the Ubuntu-16.04 image from the web automatically!
  • vagrant up => runs the Vagrantfile + it downloads & installs the bento/ubuntu-16.04.
  • vagrant ssh => You SSH into your vagrant box.

SSH sounds boring and lame. It should be called hack or takeover… Cause that’s what happens when you ssh into something. You TAKE OVER that computer and control it using the ugly command line (my command line is gorgeous. Thanks ZSH ❤). I hate thinking about my college C.S. teachers now who start off by saying “So… SSH stands for Secure Shell”. YAWN, YAWN, followed by a please shoot me in the head. Here’s the new definition. SSH means you take over shit. alias takeover=ssh if you’d like haha.

Synced Folders — The Sexiest Secret About Vagrant

The best reason for synced folders…

  • Use Your Favorite Editor and Your Favorite OS — You get to stick with everything you love and know (Pycharm + Mac ❤ or Windows + Sublime)… Your code just happens to live in a perfectly fake little world, a development environment, a box that you can share with anyone. Tomato, Tohmaato.

Let’s get to it.

Just to recap here are the commands you should have typed in already:

mkdir folder_of_awesomeness
cd folder_of_awesomeness
vagrant init bento/ubuntu-16.04
vagrant up
vagrant ssh

How Synced Folders in Vagrant Work

You put stuff in the /vagrant folder of your vagrant box (development environment) but it shows up on your local computer where your Vagrantfile is. Once it shows up on your local computer, you can just edit your file using your favorite editor. Then edit the code using your favorite editor on your favorite OS, and just run the code from your virtual box since you’re already SSH’ed into it from the command line.

Okay now onto the commands!

touch /vagrant/

Here’s what those commands say:

  1. We’ll add a new file in the /vagrant folder of your vagrant box called (doesn’t matter what you call it). touch is a command used to quickly create a file (obviously the command doesn’t work on windows and the workaround is painful. However, since you are in a vagrant box… BOOM! It worked!!! $1500 saved.)
  2. exit out of your SSH so we can enter back into your local computer
  3. ls to see if the file showed up on your LOCAL COMPUTER! The command is dir if you are on a windows command line (1 letter longer than the command on a linux).

And WOW! Look at that! The file is right there on your local computer. You can use your GUI (means your mouse & usual stuff) to right click on it and open it in your favorite editor or just open that file from a command line. Once you type up code in that file. Save it. Then just SSH into your box to run your code.

Protip: Stay SSH’ed into your device the entire team, edit the code in your favorite editor, and then just run the code from your command line.

Wrap Up

It just blows my mind that you could do something like controlling a computer in a completely different part of the world and then come right back to your own world with just one command. Never ceases to amaze me.

If you want to dive deeper into Vagrant and learn more about it. Here’s their getting started guide.

For those a little bit more advanced users who like Pycharm, here’s a post that shows you how to connect your Pycharm with Vagrant. Then you can open up your command line right inside of your Pycharm and it would be ssh’ed into your box the entire time while you edit the files locally with Pycharm.

Hopefully you’re now at a point where you know about some of the benefits of Vagrant’s power and flexibility, how it’s a better option than getting a VMware like Bootstrap or Parallels, how it can make your life 10x better making you more productive as a software developer, and how its knowledge can help you stand out from the crowd when you put it on your portfolio.

That’s it for today. PEACE.

Make sure to hit the HEART sign button below and share this.

Got questions? Loved it? Don’t agree? Talk to me in the comments below.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.