Beginner's Guides

My Local: Getting Started with Laravel Homestead

Developers have their own way of working, and I’m no exception. With a half a dozen apps running at any given time to make my code structure, workflow, and deployments as smooth as possible, I depend on simple easy-to-use tools to get things done. However, the one thing that is constantly changing is the local work environment. This is all based on preference, personal tastes, and your job. I build websites on WordPress with Laravel Homestead.

My local development environment for this is Laravel Homestead. Homestead is free and runs in VirtualBox (or VMware), on Vagrant and includes, Ubuntu 16.04, Git, PHP 7.0, HHVM, Nginx, MySQL, MariaDB, Sqlite3, Postgres, Composer, Node (With PM2, Bower, Grunt, and Gulp), Redis, Memcached and Beanstalkd.

Setup Homestead

To start, let’s install VirtualBox or VMWare AND Vagrant. I prefer VirtualBox because it’s lightweight, comes with Vagrant out of the box, and most importantly, it’s free.

$ cd ~/home/vagrant/Code/wordpress-site 

Next, we’re going to clone homestead into our root user directory and initialize Homestead to create our configuration file and define our provider–in my case, VirtualBox.

$ git clone Homestead
$ bash

After you’re set up, we can setup our configuration file and local file structure. I’ll base this on how I work, but generally, how you organize your files are up to you.

Open your and type homestead edit which will open the homestead.yaml file in your favorite code editor.

ip: ""
memory: 2048
cpus: 1
provider: virtualbox

authorize: ~/.ssh/

    - ~/.ssh/id_rsa

    - map: ~/Dropbox/Private/Working
      to: /home/vagrant/Code

    - map:
      to: /home/vagrant/Code/wordpress-site
    - wp_1

    - key: APP_ENV
      value: local

# blackfire:
#     - id: foo
#       token: bar
#       client-id: foo
#       client-token: bar

# ports:
#     - send: 93000
#       to: 9300
#     - send: 7777
#       to: 777
#       protocol: udp

I’m not going to go over everything here, just the parts that make Homestead go. They’ve added some bells and whistles like ports, variables and Blackfire support—which makes it easy to test PHP performance—but you can Google those.

From the top:

  • ip is automatically pulled in from your machine – leave this alone.
  • memory is set to 2048 by default.
  • authorize and keys reference your SSH keys. You can learn more about that here.
  • folders contains two parts map and to. map is the relative location on your computer, in my case ~/Dropbox/Private/Working. I like having a good 24/7 backup of working files, hence Dropbox. to refers to the default vagrant folder location. You can use the default location, I just find it easier and nicer to work out of the folders I want to work out of. Ya know control!
  • sites here’s where the fun starts. These are my local WordPress installs.
  • databases are the matching databases for each of your sites. Name them whatever you’d like.
  • variables, blackfire and ports don’t need to be touched, but you can read more about those here.

Next thing you’ll want to do is map your new site URL to your ip in your hosts file so that you can use your URL.

$ sudo vim /etc/hosts


# Host Database
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##       localhost broadcasthost
::1             localhost

Save and you’re good to go.

Now, unlike MAMP (see below), one thing that Homestead doesn’t have is a visual phpMyAdmin interface—everything is command-line. However, here is where I recommend SequelPro for accessing, editing, and maintaining your Homestead databases. Access is super simple by using the configuration below:

Name: Homestead
Username: homestead
Password: secret
Database: (name optional)
Port: 33060

Homestead SequelPro Setup

From here, you can do anything you can do via ssh and command line with a simple GUI interface.

## Install WordPress
Easy as 1, 2, 3. I’ll do it with command-line, but you can just drag and drop files just the same.

$ cd ~/home/vagrant/Code/wordpress-site 
$ wp core download

? Boom–you’re ready to setup WordPress. Go to (or whatever you’ve named your website) and follow the WordPress setup the way you normally would.

Note: If you’re building static sites, you can just drop files into your root and you’re ready to rock–no 1, 2, 3 needed.

Some Extras

Good for all databases:

Db Username: root
Db Password: secret

memory in the homestead.yaml files is set to 2048 by default, but I recommend 1024 to have a fast local machine without taking too many resources away from other tasks. On my Macbook Air 2011, I found that 2048 took too much away from other apps and slowed down my computer considerably if I was trying to use Adobe Photoshop or Chrome with ninety tabs side by side. 512 works just fine if you’re only running one or two sites.

Things I Learned Recently

I use Homestead for smaller projects, one-offs, and personal website tasks—it’s still much quicker for me than any other local environment setup.

Recently, however, I had to make a switch to MAMP for a project that was showing issues on my local environment. After all, Vagrant is notorious for being a tad buggy from time to time, so it made sense that the issue was caused locally. Despite resetting and spinning up a new local the problem persisted. Long story short the issue was in the code and not my local working environment, but by that time I’d made the switch to MAMP to ensure my local was the same as my coworkers.

Though I still swear by Homestead for simplicity and ease of use, I did notice a few things with MAMP to my surprise. MAMP v 4.0 upgrade was clean and easy to use. Most importantly, however, the CPU and memory load on my computer was almost half of what it was with Homestead running on Virtualbox. As a result, the little fans on my Macbook Air haven’t spun up once since I moved over to MAMP. I have a feeling that a more powerful computer might not have the same issues, but it was an interesting find considering my sordid past with MAMP 2.x.

The Alternatives

My colleagues tend to recommend MAMP Pro v 4.0 as a solid local work environment. Having played with it a little recently, I agree that it’s worth checking out. It is a paid program, and a solid platform with easy-to-use GUI features and easy to maintain databases. It provides everything you need to keep frameworks up to date and running smoothly.

Some friends of mine use Wamp Server, which is something akin to MAMP’s free option. Not as robust certainly, but it gets the job done.

ScotchBox is more or less like Homestead. It runs on Vagrant, and VirtualBox, but limits you to only one virtual machine or WordPress install at a time (unless you want to get into configuring Ubuntu). That doesn’t work for me, since I work on multiple web projects at once and often have to spin up a new one quickly. The actual setup and configuration is a bit more complicated than is necessary, so it requires some additional effort. If you’re into trying new things, it’s worth checking out, but after my own exploration, I determined it’s just not for me.

I’ve even known a dev or two to use services like DigitalOcean to spin up a quick WordPress install and go to town. This isn’t technically a local install as you’re running off of their servers, but it’s private and available anywhere from any computer with the right credentials. The downside to DigitalOcean can be its intense learning curve if you’re not familiar with backend server setups. These self-maintained droplets can quickly fly off the shelf if permissions get altered, or if security precautions aren’t properly executed.

If you’re looking for a local dev environment that, after setup, is super quick to spin up and maintain, my vote is Homestead. What’s your favorite local setup?


3 thoughts on “My Local: Getting Started with Laravel Homestead

  1. I’ve been using AMPPS. I wanted something free that was cross-platform (MacOs, Windows, or UNIX/Linux). I like the ability to easily switch php versions, use phpMyAdmin & SQLiteManager and use other script languages such as PERL, Python & Ruby. The Softalicious installer also enables 1-click installs for WordPress.

  2. I mostly use VVV since I do a heavy mix of WP Core, client, and personal dev work. I started trying out Pressmatic after it became Flywheel Local and have been really impressed so far.

Have a comment?

Your email address will not be published. Required fields are marked *

accessibilityadminaggregationanchorarrow-rightattach-iconbackupsblogbookmarksbuddypresscachingcalendarcaret-downcartunifiedcouponcrediblecredit-cardcustommigrationdesigndevecomfriendsgallerygoodgroupsgrowthhostingideasinternationalizationiphoneloyaltymailmaphealthmessagingArtboard 1migrationsmultiple-sourcesmultisitenewsnotificationsperformancephonepluginprofilesresearcharrowscalablescrapingsecuresecureseosharearrowarrowsourcestreamsupporttwitchunifiedupdatesvaultwebsitewordpress