Overview
Below are steps to setup a local Drupal 9 composer based environment using Lando.
Prerequisites
You need to have Lando installed using these instructions.
Steps
Create a local folder. <app> will be the name of your application folder and Lando instance.
mkdir <app>
Position your working directory as your new folder
cd <app>
Initialize Lando and answer a few questions. This utility creates a .lando.yml file in your working directory. When you start Lando in the next step, this file is used to define the Lando configuration.
lando init
Choose: current working directory
Choose: Drupal9
Enter for webroot: web
Enter for app: <app>
Start Lando
lando start
Install Drupal code using composer. Note - Drupal is being install in a Docker container, not on your local computer.
lando composer create-project drupal/recommended-project blah -n
The above command uses composer to install Drupal, and it's dependencies into a folder called 'blah'. Now, the files/folders in 'blah' will be moved up one level into your directory and the 'blah' folder will be removed.
mv blah/* .
mv blah/.* .
rm -rf blah
Rebuild Lando containers.
lando rebuild -y
On a success rebuilt on Lando, it's time to install Drupal 8. Goto the local URL for your Drupal 8 website.
https://<app>.lndo.site
Follow the steps in the Drupal installation Wizard. When the database page appears, use 'drupal9' for the database name, username and password. Also, use 'database' for the host name (under the Advanced settings.
You should be up and running,