• Home
  • blog
  • Getting Started with Sulu CMS on Vagrant The Right Way™

Getting Started with Sulu CMS on Vagrant The Right Way™

In this tutorial, we’ll learn how to get started with Sulu CMS the right way – meaning, we’ll deploy a Sulu “Hello World” instance using Homestead Improved and be mindful of performance issues and configuration values while we’re at it. We’ll also cover some common pitfalls, all in an attempt to get a good base set up for future Sulu tutorials. It is recommended you follow along with the instructions in this post and drop a comment with any problems you might run into.

Many thanks to Daniel Rotter and Patrik Karisch for helping me iron this process out!

Note that it’s highly recommended to be familiar with Homestead Improved before starting out. If you’re not at that level yet, you should buy our amazing book about PHP Environment Basics.

[Sidenote] Enter your project’s name

This tutorial is dynamic in that it will replace all placeholders in the text below with the project name you define in the field under this paragraph. That way, the commands become very copy/paste friendly.

Generated slug: {{my_project}}

OS X Vagrant Folder Sharing Problems

When using the NFS folder-sharing mode on OS X hosts, the vagrant-bindfs plugin will be necessary. Install it alongside your Vagrant installation with vagrant install plugin vagrant-bindfs. This is a one-time thing that’ll prevent many, many headaches down the line if OS X is your main OS.

The rest is all automatic and already configured in the Homestead Improved instance, you don’t need to do anything else.

Vagrant up

The first thing we do is, of course, clone the HI repo.

git clone {{my_project}}
cd {{my_project}}

Next, let’s configure the shared folders:


This made the current working directory shared with the /Code directory inside the VM. That way, the changes made in this folder will be reflected inside the virtual machine and vice versa.

Like with any Symfony app, Sulu requires a custom virtualhost configuration for Nginx. We’ve made things easier by turning it into a “project type” in Homestead Improved, so all you need to do is the following modification on Homestead.yaml:

  • add the nfs folder sharing type (on OS X and Windows 10)
  • add the sulu project type and change its document root subfolder to web

The relevant sections should end up looking like this:


    - map: /Users/swader/vagrant_boxes/homestead/{{my_project}}
      to: /home/vagrant/Code
      type: nfs

    - map: {{my_project}}.app
      to: /home/vagrant/Code/{{my_project}}/web
      type: sulu

Finally, let’s fire up the VM.

vagrant up; vagrant ssh

Protip: Useful aliases to set up for future use:

alias vh='vagrant halt; cd ..'
alias vush='vagrant up; vagrant ssh'

Setting up Sulu

Creating the Project

Let’s install Sulu’s standard edition (the minimal edition is actually “standard” now, whereas the old “standard” is deprecated – they’re working on renaming this).

cd Code
composer create-project sulu/sulu-minimal {{my_project}}

Note that the docs currently suggest adding a -n flag at the end of that Composer command which means “No interactive questions”. I like it when an installer asks me about things I’m supposed to configure anyway, so I omitted it.

Continue reading %Getting Started with Sulu CMS on Vagrant The Right Way™%