Over the past couple of months, I have been facing a similar situation where many developers are unable to set up a local dev box for Drupal 8 on Pantheon server. Pantheon plays a significant role in hosting a website as it has fast set-up to local and best use of drush command to accelerate administrative and development tasks for Drupal sites.
For an introduction to drush command, you can check our previous blog post where we have explained about writing custom Drush commands in Drupal and installing Drupal with Drush. In this post, I will show you how to set up local dev box for Drupal 8. This blog will be helpful for all industry types and individuals, and after completing it you will find yourself at a moderate level of expertise.
Let’s follow the process step-by-step to set up our own local dev box:
Step 1
- To set up local dev box for Drupal 8 on Pantheon server, go to dev environment of given site
- Click on code
- Click on git and copy below command
git clone ssh://codeserver.dev.463157b8-419d-482f-b571-xxxxxxxxx@codeserver.dev.463157b8-419d-482f-b571-3504bb893903.drush.in:2222/~/repository.git nishant-drupal-8
Step 2
- Then go to your web root i.e. /var/www/html/ and paste the copied command
git clone ssh://codeserver.dev.463157b8-419d-482f-b571-xxxxxxxxx@codeserver.dev.463157b8-419d-482f-b571-3504bb893903.drush.in:2222/~/repository.git nishant-drupal-8
Step 3
- Meanwhile, create a database for the site in local
mysql -u root -p
Enter the administrator password you set-up during installation
CREATE DATABASE drupal8;
Step 4
- Download the Pantheon Drush alias from Pantheon Dashboard (https://dashboard.pantheon.io) and place that file to .drush folder
i.e. /home/
Place below code in .drush folder file name as local.aliases.drushrc.php
After clone is done, go to /var/www/html/nishant-drupal-8/sites/default/ Create new settings.local.php should be an settings.local.php of Drupal 8 Note: Add below code snippet
Create files folder in sites/all/default/ Give permission to file folder Chmod 777 -R files/ Go to ./drush folder through terminal and type drush cc drush Now on terminal, type drush sa
Eg:- @local.nishant-drupal-8 ← local aliases @pantheon.nishant-drupal-8.dev ← pantheon dev aliases @pantheon.nishant-drupal-8.live ← pantheon live aliases @pantheon.nishant-drupal-8.test ← pantheon live aliases
How to sync database from dev to local
drush sql-sync drush sql-sync @pantheon.nishant-drupal-8.dev @local.nishant-drupal-8
How to sync files from dev to local
Drush rsync
Publishing companies are constantly transforming, and so is development, we, at Valuebound, are one of those companies who specifically help organizations in their path to Digital Transformation. We enhance digital experience for end users, with tailored web applications.