Let's say that you need to spin up a new Drupal environment in... minutes. To quickly test a new patch to Drupal core, maybe, or to switch between 2 or more clients on the same day and thus to run multiple copies on several websites... In this case, how about taking the quick and easy way and set up a local Drupal site with Lando?

"What is Lando?" you might legitimately ask yourself.

A DevOps tool and Docker container-based technology enabling you to spin up all the services and tools that you need to develop a new Drupal project in no time.

"Why would I choose Lando as a method to set up a local Drupal site?"

Let me list here some of the strongest reasons:
 

  • it makes setting up a local Drupal site unexpectedly easy (and I'm talking about "minutes" here)
  • it makes getting started with Docker container technology a whole lot easier
  • it enables you to share your Drupal site's configuration within your team right on your Git repository (taking the form of a YAML file)
  • it puts several development environments (LEMP, MEAN, LAMP) at your disposal
     

Are these reasons strong enough for you?

If so, here's a quick step-by-step guide on how precisely to set up a Drupal site with Lando:
 

Step 1: First, Make Sure You Meet the System Requirements

If, as a web developer, you're not efficient with using the command line... well... then there are high chances that you find this tutorial here a bit discouraging.

And if being more than just familiar with the command line is not a strict requirement, then the following system requirements () are:
 

  • macOS 10.10+
  • Linux (with kernel version 4.x or higher)
  • Windows 10 Pro+ (or equivalent) with Hyper-V running
     

These are the 3 operating systems that Lando's currently compatible with. Now, let's move on...
 

Step 2: Download and Install Lando and Docker 

Go to Lando releases on Github and download the latest version for your OS. Just run the installer and let it "do the job" for you:
 

  • install Docker for Windows, Docker for Mac, Docker CE
  • install Lando: for Mac run brew cask install Lando and for other OS download the .rpm, .dmg, .exe or .deb
     

Step 3: Create a New Drupal Project

Luckily for you, there are several ways to get a Drupal codebase. Pick the one that you're most comfortable with as you set up a local Drupal site with Lando:
 

  1. install Drupal 8 the standard way (the first step there being "Get the Code"); next, grab the latest version of Drupal 8 navigating to "Download & Extend"
  2. or use Composer to create your new Drupal project: composer create-project drupal-composer/drupal-project:8.x-dev my_drupal_project --stability dev --no-interaction
  3. or just navigate somewhere on your PC and use GIT to clone itgit clone --branch 8.6.x https://goo.gl/Q3MoVu lando-d8
     

Step 4: Set Up a Local Drupal Site with Lando: Extract Drupal

To extract Drupal just:

  1. open up your terminal window
  2. enter the commands here below:
cd Sites
tar xzf /tmp/drupal-8.5.1.tar.gz
mv drupal-8.5.1 drupal-lando
cd drupal-lando

And thus set up the Sites/drupal-lando/ directory inside your home directory


Step 5: Set Up Lando   

Now's time to initialize Lando and enable it to create a basic configuration file for you.

And, again, you have more than just one option at hand:
 

  1. while still in your terminal window, run the following command and specify the Drupal 8 recipe and your web root as web, next name it "drupal-lando": lando init --recipe drupal8 --webroot=. --name="drupal-lando"
  2. or just launch the interactive session: run "lando init" interactively
     

Next, it's the following YAML file/ ".lando.yml", that it will create:

name: drupal-lando
recipe: drupal8
config:
  webroot: .

Note: feel free to ignore the "lando init" step and to jump straight to copying and pasting this file here.
 

Step 6: Start Your Environment & Wait for Your Docker Containers to Get Set Up

And here you are now, at that step from the whole process where you set up a local Drupal site with Lando where you start your Docker engine.

For this, just run the following command in your terminal window:

lando start 

If everything goes according to plan, this is where Lando starts Docker and sets up 2 containers.

Next, feel free to run:

lando composter install

It's going to use PHP/Composer inside the newly created Docker container for building Drupal's Composer dependencies.
 

Step 7: Browse to Your Site's URL and Walk Through the Drupal Installation Process

Time to install your new clean Drupal 8 site now.

Just visit your local site in the web browser and walk through the Drupal wizard install process (since your new site starts with an empty database, you will be automatically directed to the Install page)

Set Up a Local Drupal Site with Lando- Drupal Installation

Once you reach the step where you need to configure your database, enter these options here:
 

  • Database host: database
  • Database name, username, password: drupal8
     

Next, unfold the "Advanced Options" drop-down menu and:
 

  1. replace "localhost", currently showing up in the "Host" field, with "database"
  2. hit the "Save and Continue" button and let the Drupal installation process carry out
     

You'll set up a local Drupal site with Lando in... minutes! A brand new website that you can then easily:
 

  • test
  • debug
  • manage with Composer
     

Optionally, you can add a new service of your liking (e.g. MailHog, for catching outbound mails) and custom tune your setup right from your .lando.yml.file.

Set Up a Local Drupal Site with Lando- Welcome to Drupal Lando

The END! And this is how you do it... Told you it was just a matter of a few easy steps! 

Development

We do Drupal development

Go to our Drupal page!

Visit page!

Browse cities

Recommended Stories

Drupal: Age 1-11 in a Nutshell
For over two decades, Drupal has evolved from a simple message board to one of the most powerful and versatile… (Read more)
10 minutes /
Drupal Security Best Practices: Protecting Your Website from Common Threats
As Drupal and other technologies have grown, so have the stakes for keeping websites secure. Security isn’t a… (Read more)
10 minutes /
The Future of Drupal: What’s Next in Web Technologies
The digital world never sits still, and neither should your website. As users demand faster, smarter, and more… (Read more)
10 mins /