Linux System Admins Blog

System admins of Promet – an e-commerce, high availability Open Source web shop – share their findings

Linux System Admins Blog header image 2

Drupal HowTo: Duplicate / Copy Drupal Site

April 3rd, 2009 · 4 Comments

This post cover the steps to copy, transfer, or duplicate a Drupal site to new domain or from development/test site to live/production server. This requires shell/command line access to the server/accounts. I attached (below) some bash/shell scripts below that i used to perform these task.

Backup: In case the destination site or account have existing contents, you need to backup them first or moved to separate location.

Copy/Transfer Procedures

Database:

1.) Create an sql dump of your source database (use mysqldump)
2.) Update references to domain/url and path or home directory (you can user perl/sed commands)
3.) Import to your destination database (using mysql).

Files/Codes:

1.) Copy all files from your source directory or account to the destination site.
2.) Update references to database name, database user, database password, home directory of drupal installation, and domain name or url.
3.) Update permission and ownership of files and directories, like the sites/default/files to 777.

Notes. If you have CiviCRM installed and on a separate database, then you can use this guide but do not perform or update the references to url and paths. This guide is not applicable if you have CiviCRM installation which uses the same database as the Drupal database. CiviCRM recommended install is to use a separate database.

Shell / Bash Scripts:

1.)  Copy Drupal Site with CiviCRM.  Download here!

2.)  Copy Drupal Site without CiviCRM.  Download here!

Note: You can modify these scripts to work with sub-domains. Let me know if you have questions or suggestions or if you need help.

Random Posts

Tags: Installation · drupal

4 responses so far ↓

  • 1 Simon // Jun 1, 2009 at 4:54 am

    Is there another way of moving the files directory without assigning 777 to these folders?

  • 2 gerold // Jun 1, 2009 at 5:02 am

    @Simon – files directory is required by Drupal to be writable.

  • 3 Moving Drupal/Civicrm Sites | Linux System Admins Blog // Jun 29, 2009 at 7:36 am

    [...] so feel free to ask if you need any clarifications. Also, refer to my previous guide on “HowTo Duplicate or Copy Drupal Site” for detailed instructions, commands, and sample shell [...]

  • 4 العاب // May 2, 2010 at 5:11 am

    Notes. If you have CiviCRM installed and on a separate database, then you can use this guide but do not perform or update the references to url and paths. This guide is not applicable if you have CiviCRM installation which uses the same database as the Drupal database. CiviCRM recommended install is to use a separate database.

Leave a Comment