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:
Step 1: Install Lando
- Download and install Lando from their official website.
- Confirm the installation by running:
lando version
Step 2: Create a Project Directory
- Open your terminal and navigate to the directory where you want to set up your Bedrock project:
mkdir bedrock-site && cd bedrock-site
- Initialize a new Bedrock project using Composer:
composer create-project roots/bedrock .
Step 3: Configure Lando for Bedrock
- Inside the project directory, create a
.lando.yml
file:touch .lando.yml
- 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
- Start the Lando environment:
lando start
- 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
- Edit the
.env
file in your Bedrock directory:nano .env
- 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
- Visit the URL provided by Lando (e.g.,
http://bedrock-site.lndo.site
) in your browser. - 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!
Leave a Reply