Monday, July 28, 2014

URBackup on FreeNAS

Ok, so I decided to create a cheap backup server.  Bought 4 - 3TB hard drives on Amazon.  Installed in a workstation that I already had.  Set it up in the server room.

The FreeNAS install process is really simple so I won't go into detail about that.  The URBackup install was somewhat easy as well, but I want to detail that here for anyone who wants to recreate.

Install FreeNAS and reboot.  Connect and set a root password.

I followed the instructions in this manual which is perfect.  I didn't have to adjust any of the steps, but for help to others I will outline the same steps here.

Create a Jail
-Add Jails
(fill in default gateway)
uncheck VIMAGE

Connect to FreeNAS via SSH (must be enabled in services)

Find the number of the jail you created above.
#jexec 1 tcsh

This enters you into the jail itself.  All commands from now on are specific to the jail itself and should not be run on the FreeNAS system.

#pkg install
#pkg install update
#pkg install nano wget
#portsnap fetch extract
#cd /usr/ports/security/cryptopp
#make CXXFLAGS="-fPIC" (accept all default questions and pop up boxes)
#make install
#pkg install curl

#cd /
#mkdir /urbackup
#cd /urbackup
#wget (download link for latest urbackup tar.gz source)

#tar zxvf urbackup*.tar.gz
#cd urbackup-server-x.y.z
#make install

(I had trouble with the install.  It said it was completed, but I had to run the command again to actually get it to install the program into the right folders.)

#adduser urbackup --system --quiet --group --home "/usr/local/var/urbackup" || true
(this is supposed to create the account, but it just brought up the account dialog for me, so I filled it in by hand)

#nano /etc/rc.d/urbackup_srv

Paste the below into the file:
. /etc/rc.subr
command_args="--plugin /usr/local/lib/ --plugin /usr/local/lib/ --plugin /usr/local/lib/ --plugin /usr/local/lib/ --plugin /usr/local/lib/ --plugin /usr/local/lib/ --http_root /usr/local/var/urbackup/www --workingdir /usr/local/var --user urbackup --http_port 55414 --logfile /var/log/urbackup_srv.log --daemon"
start_precmd="cd /usr/local/var"
load_rc_config $name
run_rc_command "$1"

The command args line should be one complete line.

#chmod +x /etc/rc.d/urbackup_srv

#nano /etc/rc.conf

Add this line to the end:

#mkdir /backups
#chown -R urbackup:urbackup /backups

#/etc/rc.d/urbackup_srv start

Access the web interface at http://[ipaddress]:55414
Go to Settings / General / Server
Adjust the [Backup Storage Path] from the default to /backups

#/etc/rc.d/urbackup_srv restart

From FreeNAS web click on the Jails -> Urbackup -> Storage -> Add Storage and connect the /backups folder with the FreeNAS volume created.  I want all of the storage space available to the backup jail, so I connected it straight.

Next is the client on the servers, for sending files to URBackup.  More on that process in another post.