Skip to main content

Backing up LIS or STS to a remote Backup server

Follow these steps to set up automatic backups to a remote Ubuntu machine:

Step 1: Download the Script

Open a terminal on your Ubuntu machine and run the following command to download the backup setup script:

cd ~
wget -O remote-backup.sh https://raw.githubusercontent.com/deforay/vlsm/master/scripts/remote-backup.sh

Step 2: Make the Script Executable

To allow the script to run, change its permissions using the following command:

sudo chmod u+x remote-backup.sh

Step 3: Run the Script

Execute the script with superuser privileges to begin the setup process:

sudo ./remote-backup.sh

What the Script Does:
  1. Prompts for the Instance Name:

    • Enter a unique name for your lab or instance (e.g., lab1, centerA).
    • The script will sanitize the name to ensure compatibility.
  2. Updates the Hostname:

    • Automatically sets your machine's hostname to the sanitized instance name.
  3. Installs Required Tools:

    • Ensures rsync is installed on your machine.
  4. Generates SSH Key:

    • Creates an SSH key for secure communication with the backup server (if not already present).
  5. Prompts for Backup Server Details:

    • Enter the username and IP address or hostname of the backup server.
  6. Verifies Connectivity:

    • Tests the connection to the backup server.
    • If the connection fails, it will prompt you to re-enter the credentials until the connection succeeds.
  7. Copies SSH Key:

    • Automatically transfers the SSH key to the backup server to enable passwordless communication.
  8. Creates Backup Script:

    • Sets up a script to back up /var/www/vlsm to the backup server.
  9. Schedules Backups:

    • Configures automatic backups to run every 6 hours and on reboot using cron jobs.