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:
-
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.
- Enter a unique name for your lab or instance (e.g.,
-
Updates the Hostname:
- Automatically sets your machine's hostname to the sanitized instance name.
-
Installs Required Tools:
- Ensures
rsyncis installed on your machine.
- Ensures
-
Generates SSH Key:
- Creates an SSH key for secure communication with the backup server (if not already present).
-
Prompts for Backup Server Details:
- Enter the username and IP address or hostname of the backup server.
-
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.
-
Copies SSH Key:
- Automatically transfers the SSH key to the backup server to enable passwordless communication.
-
Creates Backup Script:
- Sets up a script to back up
/var/www/vlsmto the backup server.
- Sets up a script to back up
-
Schedules Backups:
- Configures automatic backups to run every 6 hours and on reboot using cron jobs.