Created
October 11, 2018 20:49
-
-
Save amanjuman/3fd59562db73daceafafba09fa312847 to your computer and use it in GitHub Desktop.
Full Linux Server Backup with Duplicity & S3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install Duplicity | |
sudo apt-get update | |
sudo apt-get install duplicity duply python-boto screen | |
#Create a profile of backup. | |
duply backupfullserver create | |
#Generate Secure Password for GPG | |
openssl rand -base64 20 | |
#Edit Profile Config | |
nano /root/.duply/backupfullserver/conf | |
#Uncomemnt GPG_PW and Put OpenSSL password in | |
GPG_PW='<the password you just got from openssl>' | |
#Comment GPG_KEY | |
#GPG_KEY='_KEY_ID_' | |
#Scroll down and set the TARGET options and replace according to your bucket and region | |
TARGET='s3://s3-region.amazonaws.com/bucker-name/folder/' | |
#Change Source with this | |
SOURCE='/' | |
#Add These Line | |
export AWS_ACCESS_KEY_ID='' | |
export AWS_SECRET_ACCESS_KEY='' | |
#Set a maximum time for keeping old backups. | |
MAX_AGE=1M | |
# Exclude Temp files | |
nano /root/.duply/backupfullserver/exclude | |
#Add these lines | |
- /dev | |
- /home/*/.cache | |
- /home/*/.ccache | |
- /lost+found | |
- /media | |
- /mnt | |
- /proc | |
- /root/.cache | |
- /root/.ccache | |
- /run | |
- /selinux | |
- /sys | |
- /tmp | |
- /u/apps/*/current/log/* | |
- /u/apps/*/releases/*/log/* | |
- /var/cache/*/* | |
- /var/log | |
- /var/run | |
- /var/tmp | |
# Start backup. Open Screen | |
screen | |
# Initiate the backup | |
sudo duply backupfullserver backup | |
# Deattach screen | |
Press Clt + A + D | |
# Reattach screen | |
screen -x | |
#Simple restores | |
sudo duply main restore /restored_files | |
or | |
# Might now work | |
sudo duply main restore / | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment