Update README.md

This commit is contained in:
Lleialtat Sansenca 2019-01-17 11:50:51 +00:00
parent 6b92bc6609
commit 6b7254905d
1 changed files with 26 additions and 6 deletions

View File

@ -5,6 +5,7 @@ A backup solution. A server at your office behind your firewall that pulls data
# On your backup server
Create a partition from free space
```
cfdisk /dev/sda
apt-get install parted
partprobe
@ -12,24 +13,32 @@ apt-get install btrfs-tools
mkfs.btrfs /dev/sdaX
mkdir /backups
mount /dev/sdaX /backups
```
## Mount the partition on boot
Find the UUID of the new partition
blkid
`blkid`
Edit /etc/fstab
UUID=7ef18851-xxxx-yyyy-zzzz-53f7b88b6119 /backups btrfs defaults 0 0
`UUID=7ef18851-xxxx-yyyy-zzzz-53f7b88b6119 /backups btrfs defaults 0 0`
## Setup butterbackup
```
apt-get install git
cd /opt
git clone https://gitlab.com/lleialtec/butterbackup.git
```
Instalar python3 en un entorno virtual
```
apt-get install virtualenv
cd /opt/butterbackup
virtualenv venv --python=python3
```
# Setup users
@ -38,20 +47,23 @@ butterbackup runs on the backserver as root. root connects to the public server
We create a user on the public server and copy root@backup_server public key to keeper@public_server authorized_keys
On the public_server
```
adduser --disabled-password keeper
mkdir /home/keeper/.ssh
touch /home/keeper/.ssh/authorized_keys
```
## Create root@backup_server ssh keys on the backup_server
ssh-keygen -t ecdsa -b 521
`ssh-keygen -t ecdsa -b 521`
And add the new public key to keeper@public_server /home/keeper/.ssh/authorized_keys
Test to see if you can open a session on the public_server
ssh keeper@public_server
`ssh keeper@public_server`
## Permissions
Perhaps keeper@public_server does not have permission to read everything you want to backup.
@ -59,15 +71,23 @@ Let's say you want to backup /var/www on the public server.
You can add the keeper to the www-data group
# Create a config file
```
cd /opt/butterbackup/config
cp example.com my_server_domain_name.com
```
Edit the new config file.
# Make the first copy
You can run butterbackup manually
/opt/butterbackup/venv/bin/python3 /opt/butterbackup/butterbackup.py my_server_domain_name.com
`/opt/butterbackup/venv/bin/python3 /opt/butterbackup/butterbackup.py my_server_domain_name.com`
# Add an entry to root's crontab
`crontab -e`
# Inspect backups
cd /backups/my_server_domain_name.com
`cd /backups/my_server_domain_name.com`