How to install Drupal using Lando and Composer on Ubuntu

By manish.sharma
Install Drupal using Lando and Composer on Ubuntu

Drupal is a highly flexible and powerful CMS, suitable for building anything from blogs to enterprise websites. In this guide, we will show you how to install Drupal 10 using Lando and Composer on Ubuntu, making the Drupal setup process smooth and efficient. Lando simplifies local development, and we will explore how to use the correct Lando PHP version and handle Lando install effectively.

 

Prerequisites

Before we dive into the installation, make sure you have the following prerequisites installed on your Ubuntu system:

  1. Composer
  2. Docker
  3. Lando

 

Install Docker

Lando operates as a wrapper around Docker, so you need Docker installed first.

To install Docker and Docker compose on Ubuntu refer to official documentation https://docs.docker.com/engine/install/ubuntu/

Verify if docker is installed successfully or not by running the following command:

docker-V

Refer to the attached screenshot for the output.

Docker Version

 

Install Lando 

Next, we will handle the Lando install. Lando is a powerful tool for managing local development environments, especially for Drupal. Download the latest stable .deb, .pacman or .rpm package from GitHub and install via Ubuntu’s software installer.

Verify if lando is installed successfully or not by running the following command:

Lando version

Refer to the attached screenshot for the output.

Lando version 2

 

Setup a new Drupal 10 project

You can set up Drupal 10 using Composer to manage dependencies. Start by creating a new Drupal setup project.

Open your terminal and navigate to the directory where you want to install Drupal 10. 

Run the following commands:

My Drupal project

Refer to the attached screenshot for the output. 

Drupal codebase

 

Configure Lando 

Now that you have your Drupal setup, let's configure Lando to manage it. Create a .lando.yml file in your Drupal project's root directory. Below is a basic configuration:

Webroot web

 

Start Lando 

Once Lando is configured run the following command to start Lando and set up the development environment: 

Lando start

Lando will spin up the necessary services, and you’ll see URLs to access your Drupal 10 site, including the database and other tools.

Refer to the attached screenshot for the output. 

 Lando PHP version for Drupal 10

To make sure you're using the appropriate Lando PHP version for Drupal 10, run: 

lando php

 

Install Drupal 

After starting Lando, you can proceed with the Drupal setup by running the installation commands.

lando drush sites install

To Install via Drupal UI follow below steps -  

Access your Drupal installation at https://my-drupal-app.lndo.site in your web browser. Follow the on-screen instructions to complete the Drupal installation.

Follow the on-screen instructions to complete the Drupal installation

Ensure you use the database credentials specified in your .lando.yml file. To check the database credentials or other information related to lando run the following command: 

lando info

Below screenshot shows the lando configurations. 

screenshot shows the lando configurations

 

Complete Installation

Once Drupal is installed, the final step is configuring the site according to your needs. You can:

  1. Set up additional modules and themes.
  2. Configure the database.
  3. Ensure the correct permissions and file settings.

 

Summary

In this guide, we successfully installed Drupal 10 using Lando and Composer on Ubuntu. This approach streamlines the local development process, making it easy to manage complex configurations and run your site efficiently. With Lando, you can also adjust your Lando PHP version and other services dynamically, further enhancing your development workflow.

By following this method, your Drupal setup is now complete and ready for further customization and development!

Share this blog:

Profile picture for user manish.sharma
manish.sharma
An experienced software developer driven by a passion for problem-solving, innovation, and making the tech world accessible through clear, practical, and engaging content.