Are you familiar with MAMP on macOS? MAMP is a powerful local server option that allows you to create a local copy of website running Drupal, WordPress, or Joolma.  

This project plan walks you through how to copy a Drupal website from AWS Lightsail to a local MAMP server instance. Here’s how the project plan could look:

Project Plan: Copying a Drupal Website from AWS [[Lightsail]] to a Local [[MAMP]] Server Instance

1. Objective

The goal is to replicate a live Drupal website hosted on AWS Lightsail to a local MAMP server on a Mac for development and testing purposes.

2. Prerequisites

  • AWS Lightsail Access: SSH and access to the Lightsail instance hosting Drupal.
  • MAMP Installed: Local development environment (Apache, MySQL, PHP) installed on macOS.
  • Drupal Installed on AWS: Functional Drupal site running on the Lightsail instance.
  • Terminal/SSH Client: Used for SSH and file transfers.
  • SFTP Client (optional): Tool like FileZilla for transferring files.
  • Drupal Backup Tools: Modules like Backup and Migrate installed on Drupal (optional).

3. Step-by-Step Process

Step 1: Prepare the Local MAMP Environment

  1. Install MAMP:
    • Download and install MAMP from the MAMP official website.
    • Start the MAMP application, and ensure Apache and MySQL are running.
  2. Create a Local Drupal Directory:
    • Create a directory in the MAMP/htdocs folder for your Drupal site (e.g., /Applications/MAMP/htdocs/mydrupalsite).
  3. Set Up Database in MAMP:
    • Open MAMP and go to phpMyAdmin.
    • Create a new MySQL database for the Drupal site (e.g., mydrupalsite_db).
    • Note down the database name, username, and password (usually root for both).

Step 2: Back Up the Drupal Website on AWS Lightsail

  1. Access the AWS Lightsail Instance:
    • Open your terminal and SSH into your AWS Lightsail instance:

      ssh -i /path/to/your-key.pem bitnami@your-lightsail-public-ip

  2. Create a Backup of the Drupal Files:
    • Navigate to the Drupal directory (e.g., /opt/bitnami/apps/drupal/htdocs) and create a compressed archive of your files:

      cd /opt/bitnami/apps/drupal/htdocs sudo tar -czf drupal-files-backup.tar.gz *

  3. Export the Drupal Database:
    • Use mysqldump to create a backup of your database:

      mysqldump -u root -p bitnami_drupal > drupal-db-backup.sql

    • Enter your database password when prompted.

Step 3: Transfer Files to Your Local Machine

  1. Download the Drupal Files:
    • Use SCP to download the Drupal files from Lightsail to your local machine:

      scp -i /path/to/your-key.pem bitnami@your-lightsail-public-ip:/opt/bitnami/apps/drupal/htdocs/drupal-files-backup.tar.gz /path/to/local/folder

  2. Download the Database Backup:
    • Similarly, download the database backup:

      scp -i /path/to/your-key.pem bitnami@your-lightsail-public-ip:/opt/bitnami/apps/drupal/htdocs/drupal-db-backup.sql /path/to/local/folder

Step 4: Set Up Drupal Locally in MAMP

  1. Extract Drupal Files:
    • Extract the Drupal files backup to the directory created earlier in MAMP/htdocs:

      tar -xzf /path/to/local/folder/drupal-files-backup.tar.gz -C /Applications/MAMP/htdocs/mydrupalsite

  2. Import the Database:
    • Open phpMyAdmin in MAMP and navigate to the database you created earlier.
    • Click on the Import tab and upload the drupal-db-backup.sql file.
  3. Update the Drupal Settings File:
    • Open the settings.php file in the /sites/default directory of your local Drupal installation:

      /Applications/MAMP/htdocs/mydrupalsite/sites/default/settings.php

    • Update the database credentials to match the local MAMP environment:

      $databases['default']['default'] = array ( 'database' => 'mydrupalsite_db', 'username' => 'root', 'password' => 'root', 'host' => 'localhost', 'port' => '', 'driver' => 'mysql', 'prefix' => '', );

Step 5: Test the Local Site

  1. Access the Local Drupal Site:
    • Open your browser and navigate to:

      http://localhost:8888/mydrupalsite

    • Test to ensure that the Drupal site works as expected.

Step 6: Optional Adjustments

  1. Enable Clean URLs:
    • Ensure Clean URLs are enabled in Drupal settings and in the .htaccess file.
  2. Fix Missing Files:
    • If some files or images are missing, check that all directories and permissions were properly copied.

4. Milestones

  • MAMP Environment Setup (Complete by Date X).
  • Backup and Transfer from AWS Lightsail (Complete by Date Y).
  • Local Drupal Setup and Testing (Complete by Date Z).

5. Timeline

  • Day 1-2: Prepare MAMP environment, backup Drupal site, and transfer files.
  • Day 3: Set up Drupal locally and perform testing.

6. Risks and Mitigation

  • Risk: Incorrect file permissions on the local server.
    • Mitigation: Ensure correct file permissions are set on the MAMP server (chmod 755 for directories and 644 for files).
  • Risk: Missing dependencies or modules on local MAMP.
    • Mitigation: Install missing modules or dependencies based on the local setup.

 


Keywords:

1. Drupal migration

2. AWS Lightsail backup

3. MAMP server setup

4. Local Drupal development

5. Website cloning

6. MySQL database export

7. File transfer via SSH

8. MAMP htdocs directory

9. Drupal settings.php

10. Local environment testing

11. phpMyAdmin import

12. Drupal site replication

Primary Category
Confidentiality
No