7 February 2025

In this setup, we are creating a Drupal core development environment using DDEV, a Docker-based local development tool. We start by configuring DDEV in a project directory, then clone the official Drupal core repository to work directly with its source code. After starting DDEV, we use Composer to install dependencies and Drush for command-line site management. We then install Drupal within the environment, launch the site in a browser, and access the container via SSH for further development. This setup allows developers to modify, test, and contribute to Drupal core efficiently in a controlled local environment.

Source code viewer
  1. # Navigate to the Drupal core development directory.
  2. mkdir drupal-dev
  3. cd drupal-dev/
  4.  
  5. # Initialize DDEV in this directory (sets up configuration interactively).
  6. ddev config
  7.  
  8. # Clone the official Drupal core repository (not just a site build, but the full core).
  9. # NB: Make sure you are on the correct branch.
  10. git clone https://git.drupalcode.org/project/drupal.git
  11.  
  12. # Start DDEV, which launches the necessary services (web server, database, etc.).
  13. ddev start
  14.  
  15. # Install dependencies defined in composer.json (Drupal core and libraries).
  16. ddev composer install
  17.  
  18. # Require Drush, the Drupal command-line tool (if not already included).
  19. ddev composer require drush/drush
  20.  
  21. # Install Drupal with a default configuration (creates database tables, admin user, etc.).
  22. ddev drush site:install -y
  23.  
  24. # Open the site in the default web browser.
  25. ddev launch
  26.  
  27. # SSH into the DDEV container to run commands inside the development environment.
  28. ddev ssh
Programming Language: Bash