In part 2 of the back up Unraid series we will install restic and set it up to use a MinIO s3 backend.
There is no automatic or GUI method for installing restic so you need to be comfortable in the CLI and know some basic Linux commands. But don't worry, the install is not complicated.
First of all we need to download the latest version of Restic from their GitHub repo. Visit https://github.com/restic/restic/releases to find the latest release. At of the time of writing the latest release is 0.12.0.
There is no Unraid specific release but as Linux is just a modified version of slackware which is a Linux distro we can download the generic Linux version.
If you are running Unraid 6.x then you will need the package ending in "linux_amd64.bz2" as there is no 32 bit version of Unraid after version 6.
Once you have downloaded the package we need to get it onto your Unraid server. There are many ways to do this, you can just drop it onto one of your shares if you want but for this we are going to use sft to put it onto the server.
Open up a terminal. If you are on Windows the terminal app from the windows store is a great terminal simulator. If you are on macOS/Linux you can use the terminal app built into your OS. I'm on windows so I will be using the terminal app.
we need to open an sftp connection so in the terminal type:
This will likely ask you if you would like to add this to your known hosts file. Press y then enter, you will then be prompted for your password. Enter it and press enter.
once you are logged in type
put then drag the restic package y ou downloaded into the terminal window. This will auto fill the location of the file.
Hit enter and you will see the file transfer take place. As it is a small file it should only take a couple of seconds. Once it has finished type
exit then enter to exit the sftp.
From here we need to ssh into the unraid server to complete the rest of the install. The process is similar to connecting to the sftp. In the terminal window type:
ssh root@<your-unraid-ip> Where you will be asked for your password again.
Once you are in, if you type
ls we will see the file that we just transfered to the server.
As the file is still in a compressed folder we need to extract it.
bzip2 -d restic_0.12.0_linux_amd64.bz2
This will replace the compressed file with the extracted file.
Now we need to move this file so we can actually use it. First lets rename it so it's easier to use in the future.
mv restic_0.12.0_linux_amd64 restic
This will move the file to a new file called restic.
We also need to make sure that it is executable so before we move it we can do that by:
chmod +x restic
Now lets move it into it's final destination
cp restic /usr/local/bin/
restic version to see if the install has completed properly. You should be shown the version of restic you have just installed.
Making Restic survive a reboot
Now Restic is ready to use. But because Unraid runs from RAM this install won't survive a reboot. To make the install persist reboots we need to tell Unraid to install it each reboot. We need to make a copy of the restic file on the usb stick.
cp restic /boot/config
Now we need to tell unraid what to do when it starts. Luckily this is as simple as adding a couple of lines to the go file on the usb stick.
At the bottom of the file enter these two lines
# copy the restic file cp /boot/config/restic /usr/local/bin/ # Make it exectutable chmod +x /usr/local/bin/restic
Save the file by pressing CTRL + O and exit by pressing CTRL + X
That's it. Restic will now survive a reboot.
Setting Up a Repo
Restic storage backends are called repos, in this tutorial we are going to set up a repo hosted on an existing MinIO s3 server.
MinIO server installed and configured
Your access key
Your secret access key
Before you set up a repo you need to export your access credentials so restic can connecto tou your s3 server. Because you are entering passwords and key files it is important that they don't end up in your CLI history so we turn off the history.
unset HISTFILE export AWS_ACCESS_KEY_ID=<YOUR-MINIO-ACCESS-KEY-ID> export AWS_SECRET_ACCESS_KEY=<YOUR-MINIO-SECRET-ACCESS-KEY>
once you have done that you can set up the repo with the following
restic -r s3:<your-minio-server-address>/unraid init
You will be asked for a password. this will set the password for your backups and there is no way to recover it so make sure you keep it safe otherwise you will lose access to your backups forever!
That's it. Your repo is ready to use. In the next step we will go through creating a backup.