Network/Procedures/Set up borg backups

From Makers Local 256
< Network
Revision as of 22:03, 21 April 2016 by Hfuller (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This is how to start backing up a box via borg to newbackup.

  • Bring the box up to Debian 8 or newer.
  • Install borgbackup from backports.
mail:~# apt-get install borgbackup -t jessie-backports
Setting up borgbackup (1.0.1-1~bpo8+1) ...
mail:~#
  • As root, on the box, generate an ssh key with no passphrase. This will be used for backup transit.
mail:~# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
  • Copy the key to your clipboard.
mail:~# cat .ssh/id_rsa.pub 
ssh-rsa ... root@mail.256.makerslocal.org
  • On newbackup, you will need to add a line that looks like this to ~borg/.ssh/authorized_keys:

command="cd /srv/backup/borg/repos/mail; borg serve --restrict-to-path /srv/backup/borg/repos/mail",no-port-forwarding,no-X11-forwarding,no-pty,no-agent-forwarding,no-user-rc ssh-rsa ... mail.256.makerslocal.org

You need to replace "mail" in the directories with the name of the box you are adding (mail, web, newvpn, etc.). Also, everything beginning with "ssh-rsa" all the way to the end should be replaced with the key from the file that you copied to your clipboard earlier. All of this needs to be on one line! You are only adding one line to the file.

  • Now create that directory on newbackup.
hfuller@newbackup:~$ sudo su -c "mkdir /srv/backup/borg/repos/mail" borg