In the age of computers and technology, the word ‘backup’ holds a very important value. There’s always a lingering risk of losing the data or compromising its security. To avoid such cases it is important to always have a backup ready in case anything goes awry. While Drupal is often touted as one of the most secure CMS out there, it too is susceptible to attacks.
In a previous post, I showed How To Backup A Drupal 8 Site. This time, I’ll show you how to avoid losing your data by maintaining backups. Here’s how you can make a backup of your Drupal 7 site easily using the Backup and Migrate Module.
Download and Install Backup and Migrate Module
The first thing that you’ll need to do is download and install the Backup and Migrate module from its project page on Drupal.org.
Create a Database Backup
Now, make a backup of your site’s database using the Backup and Migrate module. Navigate to admin->configuration->Backup and Migrate. Before you do this, make sure that you set a private file directory on your local storage that is not accessible by the web in the File System settings of Drupal.
After doing so, you can start making a backup of your database.
Copy Filesystem
Next, you will need to copy all the files including the .htaccess file in your Drupal site to the new location or server which will hold your copy of the site.
Delete and Replace settings.php
In this new site, delete settings.php in the sites/default directory. Now copy the settings.php from your old sites sites/default directory to the new one.
Install the New Drupal Site
Now, in your new location visit yoursitename.com/install and install Drupal as you normally would.
Enable Backup and Migrate
In your new site, go to admin/modules and enable the Backup and Migrate module. The module should be installed on the new site, since you had copied the entire filesystem of the original site to the new one.
Restore Database Using Backup and Migrate
Next, simply use the Backup and Migrate module to restore the database using the backup that you made earlier.
Conclusion
That’s it! You’ve successfully made a copy of your Drupal 7 site using the Backup and Migrate module. It’s important that you always maintain a backup of your database. Hope you found this guide useful. If you have any queries, please leave me a message in the comment section below and I’ll get back to you.
Hamza Zia
Hamza is a Drupal Community Manager at Cloudways - A Managed Drupal Hosting Platform. He loves to write about Drupal and related topics. During his free time, he can be seen obsessing over Football, Cars, Android and Gaming.