An important part of being a developer is being able to efficiently set up a local development environment. There exists a multitude of local development options, however, I prefer using Lando, an open source local development environment built on Docker container technology.
Imagine having a development tool that not only sets up your local environment for you but also functions as a local dependency management and automation tool. The ability to configure and install your necessary dependencies in a simple config lando.yml file is what gives Lando the edge in local dev environments.
Below is a short list of the pros of Lando taken from their readme:
Creating a Lando project is as simple as running a few commands. I will show you the steps I use on my Linux Ubuntu distribution, however, these steps will work on most other Unix based operating systems.
First, let’s create a new directory to put our app in and name it “webapp”
mkdir webapp cd webapp
Next let’s initialize Lando in our directory
After running this command, Lando will want to know where it can find the working directory. We have a few options to choose from but since we are just starting this project from scratch we will select “current working directory”.
Now, Lando will give us a series of “recipe” choices for the kind of project we are building. Since we want to build a WordPress application, lets scroll down using the down arrow key and select “wordpress”.
Next, it will ask us what our root is going to be. We can call this whatever we like such as app or web. Let’s go with app.
Next we will have to name our application. Let’s name it webapp.
Now our terminal should look more or less like this depending on the naming choices one has made.
Next run the command
This will start spinning up all our necessary processes. After this is done, Lando will give you your local dev domain (highlighted in red) which will be empty. Now, we need to download and install WordPress so we can have something to work with.
Let’s download our necessary WordPress files by running
lando wp core download --path=app
Note that the path is set to what we named our root in the previous lando init step. You will know that you have successfully downloaded the files when Lando says “Success: WordPress downloaded”.
Now, we have to go ahead and install WordPress. Let’s scroll back up and visit the local domain that Lando created for us. This should be labeled “APPSERVER URLS”. If you have been following along step for step, this should be https://ericburt.us marked in green. If you cleared your terminal or cannot find this, simply run the command
Now that we are visiting our local domain, you will notice that WordPress is prompting for an install. I’m going to selected English (United States) as my language.
Now, we will set up and configure our database.
Now, we can finally go through with the famous 5 minute WordPress installation. Choose a site title, username, password, and email and install WordPress. After WordPress has finished installing, you will have the basics of your app running with the default theme.
Now that we have our Lando WordPress app up and running you can start developing or you can destroy this app and remake one with your own configurations and dependencies (lando.yml). This can be done by simply running the following two commands
lando destroy -y lando poweroff
to completely erase the test app from your machine.