There are numerous ways to put up a new Drupal or WordPress website locally to help with development, including using Xampp, Mamp, or Apache.
However, setting up and running the website locally for development will take some time and include numerous processes.
Fortunately, we currently have a program that can assist us in creating a simple configuration. We only need to follow a few command lines, and the tool will take care of the rest.
We must set up and adhere to each of the stages below in order to make it easy:
- Install requires software
- GET code From the Platform to your local
- Setup site on local by Lando
Install requires software
Install Platform CLI
curl -fsS https://platform.sh/cli/installer | php
Once done, it will ask you for a login and you can see all login info below.
2, Install Lando and Docker Desktop.
Install DMG via direct download (recommended)
- Download the latest .dmg package from GitHubopen in new window
- Mount the DMG by double-clicking it
- Double-click on the LandoInstaller.pkg
- Go through the setup workflow
- Enter your username and password when prompted
Install via HomeBrew on Mac
- Ensure homebrew is installed and up-to-date.
- Add the lando cask:
brew install --cask lando
Install via CLI on Ubuntu
Make sure you have wget installed.
sudo dpkg -i lando-x64-stable.deb
More information you can see here: https://docs.lando.dev/getting-started/installation.html
GET code From the Platform to your local
Get code from Platform:
There are 2 ways to pull code from Platform.sh are by git or Platform CLI (Make sure you have go to project you want to work.)
It will take a little time to get all code from the Platform to your local.
Setup site on local by Lando
The First step: Install the required packages.
You need to run composer to download all files we need to run the command to download all code require from the composer.json file.
lando composer install
and take a cup of coffee to wait for it done.
The second step: Setup Lando on local
Setup Lando to run on local by command below:
Once done it will provide us the information to access the site on local like below:
The Third Step: Sync data from Platform to your local.
We need to define the env variable on Drush/sites/self.site.yml file like below:
Once done we can easy to get the database and file from Prod to the local by following step by step the command below:
lando drush --yes sql:drop lando drush --yes sql-sync @prod @self lando drush --yes rsync @prod:sites/default/files/ @self:sites/default/files lando drush cr
when everything is finished, the website will run and we can develop on the local.
We also can set up Lando with other platforms like Pantheon, Acquia...