Installing CiviCRM and Drupal 10 on DDEV

Basic instructions
Image
CiviCRM homepage screengrab - Build, engage, and organize your constituents Get the powerful open source CRM used by more than 11,000 non-profits.

Playing about a bit with CiviCRM to look at use for some non-profit organisations I'm working with, and took me a while to set up a local test environment with DDEV. Drupal 11 has been out for a few months now, but at the time of writing CiviCRM only works with Drupal 10.3+.

Install Drupal 10 on DDEV


mkdir my-drupal-site && cd my-drupal-site
ddev config --project-type=drupal --php-version=8.3 --docroot=web
ddev start
ddev composer create drupal/recommended-project:^10
ddev config --update
ddev composer require drush/drush
ddev drush site:install --account-name=admin --account-pass=admin -y

Download CiviCRM Packages


ddev composer require civicrm/civicrm-{core,packages,drupal-8}
ddev composer require civicrm/cli-tools

Install CV CLI tools and CiviCRM within your D10 Site


ddev ssh
sudo curl -LsS https://download.civicrm.org/cv/cv.phar -o /usr/local/bin/cv
sudo chmod +x /usr/local/bin/cv
cv core:install --cms-base-url="https://civicrm.ddev.site"

This final bit took me a while to work out, as the database is not directly accessible outside the Docker (or whatever) container. Adjust the URL to your local site's address. It's recommended to install your CiviCRM in a separate database, but for the purposes of testing using a single combined database is fine.

Once you've run this, you should be able to go to https://civicrm.ddev.site/civicrm (or run ddev launch) and see a page like this:

Image
CiviCRM landing page in Drupal - screenshot