[HOWTO] urbackup @QNAP

Introduce yourself to us and other members here, or share your own product reviews, suggestions, and tips and tricks of using QNAP products.
Post Reply
esc-ctrl
First post
Posts: 1
Joined: Wed Aug 21, 2013 4:08 pm

[HOWTO] urbackup @QNAP

Post by esc-ctrl »

what i have:

--> QNAP TS-121

what we need:

- putty --> a terminal --> every time you see "#" you need putty
- winSCP --> an "file-explorer"

What we will do:

1. installing packages for compiling
1a) optware IPKG
1b) installing necessary packages for compiling
1c) edit the Optware.sh


2. installing missing packages for urbackup
2a) creating temp and install directory
2b) installing missing packages for urbackup
2bb) crypto++
2bbb) libcurl & libcurl-dev


3. installing urbackup-server
3a) download the source-code and unzip
3b) we set the "install-dir" with prefix
3c) compiling (make)
3d) edit the MAKEFILE
3e) make install
3f) edit the "start_urbackup_server"


4. Testing
4a) starting urbackup-server
4b) test if it works
4c) config the "backup-dir"

5. Autostart urbackup-server at startup
5a) create an "autorun.sh"
5b) edit the "qpkg.conf"#



---------------------------------------------LET US BEGIN-------------------------------

1. installing packages for compiling

1a) optware IPKG


--> go to the app-center on your qnap and install the optware IPKG
--> APP CENTER --> ALL APPS --> optware IPKG

1b) installing necessary packages for compiling

--> for compiling the source code for urbackup we need some packages
--> logon with putty on your nas and type the following:

Code: Select all

# ipkg update
# ipkg install libidn getopt unzip optware-devel

1c) edit the Optware.sh

Fix the $PATH in “/etc/profile”
--> you can edit the Optware.sh with winSCP --> go to
/etc/init.d/
and open the
Optware.sh
Look for the section of code which mentions
/opt/bin.
Replace it so that this part of the file looks like:

Code: Select all

# adding Ipkg apps into system path ...
/bin/cat /etc/profile | /bin/grep "PATH" | /bin/grep "/opt/bin" 1>>/dev/null 2>>/dev/null
# Bug fix for following: put IPKG first, per http://forum.qnap.com/viewtopic.php?f=124&t=15663
# was [ $? -ne 0 ] && /bin/echo "export PATH=$PATH":/opt/bin:/opt/sbin >> /etc/profile
[ $? -ne 0 ] && /bin/echo "export PATH=/opt/bin:/opt/sbin:\$PATH" >> /etc/profile
save the file.

reboot the QNAP NAS and check – in admin shell (putty) – the $PATH environment : variable “ /opt/bin” and “/opt/sbin” should come before “/bin” and “/usr/bin”. For instance:

Code: Select all

 # echo $PATH
/opt/bin:/opt/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/bin/X11:/usr/local/sbin


2. installing missing packages for urbackup

2a) creating temp and install directory

--> in the temp dir i will download the necessary source-code for compiling
--> Because my Qnap (121) has not enough space at "system-dir" i will use my "own" install dir for urbackup
--> the temp and install dir are now FIX!!! if you want anothe location for the temp and install dir you have adapt every time where you find my temp and install dir @ your own

temp dir:

with winSCP go to
/share/HDA_DATA/
create a
temp dir
install dir:

with winSCP got to
/share/HDA_DATA/
create
urbackup dir
in urbackup dir create an install dir and an backup dir

it shuld look like this:

/share/HDA_DATA/
..........................temp
..........................urbackup
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,install
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,backups



2b) installing missing packages for urbackup

--> for compiling the source-code of urbackup successful we need some package
--> the crypto++ package need do be compiled and installed


2bb) crypto++

with putty type the following:

Code: Select all

# cd /share/HDA_DATA/temp
# mkdir cryptopp
# cd cryptopp
download the source-code for crypto++ --> the make will take a while <--

Code: Select all

# wget http://prdownloads.sourceforge.net/cryptopp/cryptopp562.zip
# unzip cryptopp562.zip
# rm -r cryptopp562.zip
# make -f GNUmakefile     
# make libcryptopp.a libcryptopp.so
# make install
--> if there comes an error message, with cryptest.exe (not enough space) --> thats no problem
--> now you can delete the cryptopp folder in your temp

Code: Select all

# rm -r /share/HDA_DATA/temp/cryptopp

2bbb) libcurl & libcurl-dev

Code: Select all

# ipkg update
# ipkg install libcurl
# ipkg install libcurl-dev automake
REBOOT the system now

Code: Select all

# reboot


3. installing urbackup-server

3a) download the source-code and unzip

--> with putty go to the temp dir

Code: Select all

# cd /share/HDA_DATA/temp
download the source-code for urbackup

Code: Select all

# wget http://sourceforge.net/projects/urbackup/files/Server/1.2.3/urbackup-server-1.2.3.tar.gz/download
# tar xzf urbackup-server-1.2.3.tar.gz
# rm urbackup-server-1.2.3.tar.gz
# cd urbackup-server-1.2.3.261/
3b) we set the "install-dir" with prefix

----------------------PREFIX----------------
--> we use the prefix to install urbackup on a place we want
--> because at my qnap is not enough space @ the "system directory"
--> this will install urbackup @ /share/HDA_DATA/urbackup/install/
--> the following command will check your qnap if all dependings are installed

Code: Select all

# ./configure --prefix /share/HDA_DATA/urbackup/install/
--> when there was NO ERROR-MESSAGE then we can compile the source-code


3c) compiling (make)

--> this will take a very long time--> go for lunch or coffe

Code: Select all

# make
3d) edit the MAKEFILE

--> we have to edit the make file, because the "adduser" command will not work
--> go with winSCP to
/share/HDA_DATA/temp/urbackup-server-1.2.3.261/
and edit the
MAKEFILE
--> go to the buttom and search for the following line:

Code: Select all

adduser urbackup --system --quiet --group --home "$(DESTDIR)$(localstatedir)/urbackup" || true
--> and comment it out with #, so that it look like this:

Code: Select all

###adduser urbackup --system --quiet --group --home "$(DESTDIR)$(localstatedir)/urbackup" || true


3e) make install

--> now we can "install" urbackup @ QNAP
--> All files shoud be installe @ /share/HDA_DATA/urbackup/install/

Code: Select all

# make install

3f) edit the "start_urbackup_server"

--> go with winSCP to
/share/HDA_DATA/urbackup/install/sbin/
--> edit the
"start_urbackup_server"

search for:

Code: Select all

 PREFIX=/usr
replace with:

Code: Select all

PREFIX=/share/HDA_DATA/urbackup/install
search for:

Code: Select all

DAEMON_DIR="/var"
replace with:

Code: Select all

DAEMON_DIR="/share/HDA_DATA/urbackup/install/var"
SAVE FILE!!!!



4. Testing

4a) starting urbackup-server

with putty go to the install dir

Code: Select all

# cd /share/HDA_DATA/urbackup/install/sbin
# ./start_urbackup_server

4b) test if it works

---> open your browser and type:
IP_of_Your_NAS:55414
--> now you should see the webAdminPagePage


4c) config the "backup-dir"

--> under Settung you should set the location where urbackup-server should save the "BACKUPS"
--> i set:
/share/HDA_DATA/urbackup/backups/
5. Autostart urbackup-server at startup

5a) create an "autorun.sh"
--> REMEMBER to adapt these lines if you use another location of your "install path"
--> I make some "variables" --> there you can place your "install path"

--> with winSCP go to:
/share/HDA_DATA/urbackup/install/sbin
--> create the file:
autorun.sh
--> enter the following line into the "autorun.sh" file

Code: Select all

#!/bin/sh
 
[color=#008000]PIDFILE="/var/run/urbackup_srv.pid"
LOGFILE="/var/log/urbackup.log"
HTTP_PORT=55414
FASTCGI_PORT=55413
INSTALL_DIR="/share/HDA_DATA/urbackup/install"
LIB_DIR="$INSTALL_DIR/lib"[/color]


start()
{

## go to the /var dir --> this is neccessary if you start urbackup_srv
cd /share/HDA_DATA/urbackup/install/var

## start the urbackp_srv with plugins
  /share/HDA_DATA/urbackup/install/sbin/urbackup_srv --daemon --http_port $HTTP_PORT --logfile $LOGFILE --pidfile $PIDFILE --plugin $LIB_DIR/liburbackupserver_urlplugin.so --plugin $LIB_DIR/liburbackupserver_cryptoplugin.so --plugin $LIB_DIR/liburbackupserver_downloadplugin.so --plugin $LIB_DIR/liburbackupserver_fsimageplugin.so --plugin $LIB_DIR/liburbackupserver_httpserver.so --plugin $LIB_DIR/liburbackupserver.so --http_root $INSTALL_DIR/var/urbackup/www --workingdir $INSTALL_DIR/var --user urbackup --snapshot_helper $INSTALL_DIR/bin/urbackup_snapshot_helper

}
 
stop()
{
   #echo "Shutting down "
   kill `cat $PIDFILE`
   rm -f $PIDFILE
   sleep 5
}
 
# you do not need to edit this lines
case "$1" in
       start)
        start
        ;;
    stop)
        stop
        ;;
    restart)
        # Restarting the Daemon
        $0 stop
        $0 start
     ;;
    
  *)
    echo "Usage: $0 {start|stop|restart}"
    exit 1
esac

exit 0

make the
"autorun.sh"
executable --> press
F9
and set the permission to
0755

5b) edit the "qpkg.conf"


--> with winSCP goto
/etc/config/
--> edit the
"qpkg.conf"
--> the SHELL and the INSTALL_PATH are the important lines
--> at the end of the line enter these following lines!! REMEMBER to adapt these lines if you use anothe location of your "install path"

Code: Select all

[urbackup]
Name = urbackup
Version = 0.1
Author = escctrl
Date = 2013-20-08
Shell = /share/HDA_DATA/urbackup/install/sbin/autorun.sh      
Install_Path = /share/HDA_DATA/urbackup/install/sbin
Enable = TRUE
--> now reboot your QNAP and urbackup server shuld be autostart

-->FINISH<---
User avatar
forkless
Experience counts
Posts: 1907
Joined: Mon Nov 23, 2009 6:52 am
Location: The Netherlands

Re: [HOWTO] urbackup @QNAP

Post by forkless »

Nice job, I would however remove the bb code from the init script. Bash doesn't do the [color] tag very well ;)
konrad8
New here
Posts: 7
Joined: Fri Jun 01, 2012 4:12 am

Re: [HOWTO] urbackup @QNAP

Post by konrad8 »

Hi,
what is your experience on urbackup after a few weeks of using it? Do you also use it to backup data from the NAS to the NAS, like a backup of the Multimedia folder on NAS. When reading urbackup CLIENT docu I see for Linux wxWidget is used which is a no way on the non-graphical login of the NAS.
I'm currently using bacula and I do not like the way to configure it as it usese either extra tools or is just editor work on config files. I urbackup providing full configuration by webinterface on server side? For the WinPCs, what is your experience on the "tray" icon, is it sufficient?
konrad8
New here
Posts: 7
Joined: Fri Jun 01, 2012 4:12 am

Re: [HOWTO] urbackup @QNAP

Post by konrad8 »

Hi,
added the urbackup 1.2.4 and cryptopp 5.6.2 to a TS-559 Pro II QTS 4.0.2.

I am using a different set of locations for the resulting installation, but basically it follows what esc-ctrl did.
To get the compiles work for the Intel Atom on the server I had to do a few changes beside the previous given ones, just to record here

details on the compile actions, all is done locally on the QNAP

[/share/MD0_DATA/urbackup/backups] # g++ -v
Using built-in specs.
Target: i686-unknown-linux-gnu
Configured with: ../gcc-4.2.1/configure --build=i386-pc-linux-gnu --host=i686-unknown-linux-gnu --target=i686-unknown-linux-gnu --prefix=/opt --disable-nls --disable-static --with-as=/home/slug/optware/ts509/toolchain/i686-unknown-linux-gnu/bin/i686-unknown-linux-gnu-as --with-ld=/home/slug/optware/ts509/toolchain/i686-unknown-linux-gnu/bin/i686-unknown-linux-gnu-ld --enable-languages=c,c++ --disable-multilib
Thread model: posix
gcc version 4.2.1
[/share/MD0_DATA/urbackup/backups] # ld -v
GNU ld version 2.17
[/share/MD0_DATA/urbackup/backups] #

for cryptopp
[/share/Download/cryptopp562] # diff GNUmakefile GNUmakefile.org
1,2c1
< CXXFLAGS = -DNDEBUG -g -fPIC
< #CXXFLAGS = -DNDEBUG -g -O2
---
> CXXFLAGS = -DNDEBUG -g -O2
23c22
< PREFIX = /opt
---
> PREFIX = /usr
43,44c42
< #CXXFLAGS += -march=native
< CXXFLAGS += -march=i486
---
> CXXFLAGS += -march=native

building cryptopp takes some time, even after removing optimitzation switch. Please be really patient :)

calling urbackup configure, setting target architecture,
CXXFLAGS="-march=i486 -g" CFLAGS="-march=i486 -g" ./configure --prefix /share/MD0_DATA/urbackup/

I have a different way to start private addons, I did not update the QPKG configuration. Instead my autorun.sh adds some links to start scripts in /opt/etc/init.d to the respective start/stop sections in /etc/init.d/rcS and rcK. As autorun.sh runs before the QS... scripts are started this works fine fpor me and is quite a local activity which can be easily removed by just adding an little "exit" at the bgin of my autorun.sh at /opt/etc/init.d/autorun.sh. In the NVR partion the autorun.sh entry is just a link to this autorun.sh on /opt.
yamez
First post
Posts: 1
Joined: Thu Feb 13, 2014 5:13 pm

Re: [HOWTO] urbackup @QNAP

Post by yamez »

I have a QNAP TS-212P. I've got as far as testing the urbackup server. When I run "./start_urbackup_server" I get a segmentation fault. My log file shows the following.

2014-02-22 16:13:27: Changing user...
2014-02-22 16:13:27: done.
2014-02-22 16:13:27: Loaded -url- plugin
2014-02-22 16:13:27: Loaded -cryptoplugin- plugin
2014-02-22 16:13:27: Loaded -download- plugin

Great guide but I'm stumped. Thanks.
Post Reply

Return to “Users' Corner”