How to Install WordPress Bedrock on Your Local Machine Using Lando

How to Install WordPress Bedrock on Your Local Machine Using Lando

WordPress Bedrock is a modernized WordPress stack, and Lando is a powerful local development tool that provides easy containerization. Combining these tools can streamline your WordPress development workflow. This guide will show you how to install WordPress Bedrock using Lando on your local machine.


Prerequisites

Before starting, ensure you have the following:

  1. Lando installed on your system.
  2. Composer installed globally.
  3. A code editor like VS Code.

Step 1: Install Lando

  1. Download and install Lando from their official website.
  2. Confirm the installation by running: lando version

Step 2: Create a Project Directory

  1. Open your terminal and navigate to the directory where you want to set up your Bedrock project: mkdir bedrock-site && cd bedrock-site
  2. Initialize a new Bedrock project using Composer: composer create-project roots/bedrock .

Step 3: Configure Lando for Bedrock

  1. Inside the project directory, create a .lando.yml file: touch .lando.yml
  2. Add the following configuration to .lando.yml: name: bedrock-site recipe: lamp config: php: '8.0' via: nginx webroot: web database: mysql:5.7 services: appserver: overrides: environment: WP_ENV: development WP_HOME: http://bedrock-site.lndo.site WP_SITEURL: http://bedrock-site.lndo.site/wp

Step 4: Start Lando

  1. Start the Lando environment: lando start
  2. Lando will provide the URLs for your site and database. You should see output like: APPSERVER URLS http://bedrock-site.lndo.site https://bedrock-site.lndo.site

Step 5: Configure Environment Variables

  1. Edit the .env file in your Bedrock directory: nano .env
  2. Update the database credentials to match Lando’s environment: DB_NAME=lando DB_USER=lando DB_PASSWORD=lando DB_HOST=database WP_ENV=development WP_HOME=http://bedrock-site.lndo.site WP_SITEURL=http://bedrock-site.lndo.site/wp

Step 6: Install WordPress

  1. Visit the URL provided by Lando (e.g., http://bedrock-site.lndo.site) in your browser.
  2. Follow the on-screen instructions to set up WordPress.

Step 7: Develop and Test

You’re now ready to start developing with WordPress Bedrock on Lando! Use the following commands as needed:

  • Access the site: Visit the URL provided by Lando.
  • Access the database: Use lando db or connect with your preferred database tool.
  • Stop the environment: lando stop

Conclusion

Setting up WordPress Bedrock with Lando ensures a modern and flexible development workflow. This setup is ideal for developers looking for a structured, containerized, and scalable local environment. Happy coding!

Sunil Avatar

Leave a Reply

Your email address will not be published. Required fields are marked *