Install local machine
With DDEV
DDEV is a local development tool that requires Docker and make it easy to setup and run the local Drupal site. Assuming you are all setup with Docker and Composer on your machine, here’s how I set it up.
Install DDEV on your machine
curl -L https://raw.githubusercontent.com/drud/ddev/master/scripts/install_ddev.sh | bash
Or with Homebrew:
brew tap drud/ddev && brew install ddev
To check your ddev
version:
ddev -v
Setting up with Composer and Drush
# Create project directory e.g. /web-app
mkdir web-app
# Go to directiry
cd web-app
#Configure the project type and document root
ddev config --project-type=drupal8 --docroot=web --create-docroot
# Start container
ddev start
# Create project
ddev composer create "drupal/recommended-project:^8"
#Install Drush
ddev composer require drush/drush
# Install site
ddev drush site:install -y
# Get the local login URL
ddev drush uli
# Or launch the local site
ddev launch
Other way to setup Use composer
to setup your Drupal project. Say we name this web-app
(replace with your own project name)
# Replace web-app!
export SITE_NAME=web-app
composer create-project drupal/recommended-project $SITE_NAME
cd $SITE_NAME
And setup your project:
ddev config --docroot=web --project-name=$SITE_NAME --project-type=drupal8
Start the container by running
ddev start
Install Drupal
And start intalling the site with your credentials:
ddev exec drush site-install --account-name=admin --account-pass=my-password
With this setup, you dont have to worry about creating database, database user etc it will be setup in Docker containers.