Rooot.net

  • Increase font size
  • Default font size
  • Decrease font size
Those who desire to give up freedom in order to gain security will not have, nor do they deserve, either one - Benjamin Franklin
Home Geek stuff Synology Seafile 3.1 on ARMv7-based Synology DiskStation NAS

Seafile 3.1 on ARMv7-based Synology DiskStation NAS

Seafile is an open source Dropbox alternative that offer encryption on client-side (data is stored encrypted on the server and server don't have password). Sadly there is no Seafile package for Synology. In order to lower maintenance I choosed to install Seafile in a Debian chroot running on the NAS.

Install packages

As a reference, Seafile documentation to install this software from source is available from https://github.com/haiwen/seafile/wiki/Build-and-deploy-seafile-server-from-source. This procedure follows the official documentation to install Seafile 3.0.x with details specific to Debian distribution and packages; it assume you already set up a Debian chroot on Synology.

Install development libraries

~$ aptitude install libevent-dev libcurl4-openssl-dev libglib2.0-dev uuid-dev intltool libsqlite3-dev libarchive-dev libtool libjansson-dev valac libfuse-dev

At time of writing some packages were not available in Debian stable. Add other packages from testing environment to apt sources file and set preferences to make sure testing isn't picked as default choice. Please check AptPreferences for more details about apt pinning.

~$ cat >> /etc/apt/sources.list << EOF
~$ deb http://ftp.fr.debian.org/debian/ jessie main contrib non-free
~$ deb-src http://ftp.fr.debian.org/debian/ jessie main contrib non-free
~$ EOF
~$ cat > /etc/apt/preferences.d/00preferStable << EOF
~$ Package: *
~$ Pin: release a=stable
~$ Pin-Priority: 900
~$
~$ Package: *
~$ Pin: release a=testing
~$ Pin-Priority: 800
~$ EOF
# Adding the packages from jessie (Debian testing)
~$ aptitude install libonig-dev -t jessie
~$ aptitude install libzdb-dev libsqlite3-dev sqlite3 -t jessie

Only exception is libevhtp: a special version of this library is required.

~$ mkdir libs
~$ cd libs
~$ wget https://github.com/ellzey/libevhtp/archive/1.1.6.zip

Decompress library and use cmake to compile and install it.

~$ aptitude install cmake
~$ cmake .
~$ make
~$ sudo make install

Next install packages for seahub, the Python web front end. Some python libraries aren't available from Debian packages and Seafile 3.0.x require Django 1.5.

~$ aptitude install python-simplejson python-chardet gunicorn python-imaging python-six
~$ # Some python lib aren't available from Debian.
~$ aptitude install python-pip
~$ pip install django==1.5
~$ pip install djblets==0.6

Prepare Seafile projects

Add user and prepare project layout. Fill ORGANIZATION_NAME with anything more suitable to describe your Seafile installation (company or domain name).

~$ ORGANIZATION_NAME=
~$ adduser seafile
~$ su seafile
~$ cd
~$ mkdir -p $ORGANIZATION_NAME/seafile-server
~$ cd $ORGANIZATION_NAME/seafile-server

Get the source. This time, replace VERSION with Seafile latest version.

~$ VERSION=3.0.3
~$ mkdir src
~$ cd src
~$ wget https://github.com/haiwen/libsearpc/archive/v${VERSION}-server.tar.gz
~$ tar xf v${VERSION}-server.tar.gz
~$ rm v${VERSION}-server.tar.gz
~$ wget https://github.com/haiwen/ccnet/archive/v${VERSION}-server.tar.gz
~$ tar xf v${VERSION}-server.tar.gz
~$ rm v${VERSION}-server.tar.gz
~$ wget https://github.com/haiwen/seafile/archive/v${VERSION}-server.tar.gz
~$ tar xf v${VERSION}-server.tar.gz
~$ rm v${VERSION}-server.tar.gz
~$ cd ..
~$ wget https://github.com/haiwen/seahub/archive/v${VERSION}-server.tar.gz
~$ tar xf v${VERSION}-server.tar.gz
~$ rm v${VERSION}-server.tar.gz
~$ mv seahub-${VERSION}-server seahub

Compile Seafile

Build and install seafile projects. Autogen, configure and make commands can be run as user seafile but "make install" command require root privileges.

~$ cd src/libsearpc-${VERSION}-server
~$ ./autogen.sh
~$ ./configure
~$ make
~$ make install
~$ ~$ cd ../ccnet-${VERSION}-server
~$ ./autogen.sh
~$ ./configure --disable-client --enable-server # `export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig` if libsearpc is not found
~$ make
~$ make install
~$
~$ cd ../seafile-${VERSION}-server

With Seafile 3.0.3, the seafile-controller executable require a small fix. At startup, this program define its configuration, bin and pids folders based on binary location. Being installed in /usr/local/bin instead of being in seafile-server subfolder, the startup fails. To fix it, edit init_seafile_path in controller/seafile-controller.c:

static void
init_seafile_path (char *config_dir)
{
topdir = g_path_get_dirname (config_dir);
installpath = g_build_filename (topdir, "seafile-server", NULL);
}

You also have to update the call to init_seafile_path in the first line of the seaf_controller_init function:

static int
seaf_controller_init (SeafileController *ctl,
char *config_dir,
char *seafile_dir,
char *logdir,
gboolean cloud_mode)
{
init_seafile_path (config_dir);

Now complete compilation of seafile-server with this small fix.

~$ ./autogen.sh
~$ ./configure --disable-client --enable-server
~$ make
~$ make install

Deploy Seafile

As seafile user, go to top directory and start Seafile setup script

~$ cd ~/$ORGANIZATION_NAME
~$ export PYTHONPATH=/home/seafile/$ORGANIZATION_NAME/seafile-server/seahub/thirdpart
~$ seafile-admin setup

Answer some questions and finally start seafile

~$ seafile-admin setup

Seafile should now be launched and accessible from your NAS

Seafile auto startup

The seafile-admin command must be launched by user seafile from the top directory. As seafile user, create a script to launch this command.

~$ cd ~/$ORGANIZATION_NAME/
~$ cat >> start_seafile.sh << EOF
~$ #!/bin/bash
~$ cd `dirname $0`
~$ seafile-admin start
~$ EOF
~$ chmod +x start_seafile.sh

Then as root install sudo

~$ aptitude install sudo

Latest part is to add this script to the Synology boot sequence. If you already have a S99chrootDebian.sh script, just append to it:

~$ cat >> /usr/local/etc/rc.d/S99chrootDebian.sh << EOF
~$ # Start seafile
~$ chroot \$CHROOT /usr/bin/sudo -u seafile /bin/bash /home/seafile/<organization_name>/start_seafile.sh
~$ EOF
~$ chmod 755 /usr/local/etc/rc.d/S99chrootDebian.sh

Comments
Add New Search
Franck  - Problème avec la fonction init_seafile_path   |82.231.6.xxx |2014-08-18 16:10:53
Bonjour,

Merci pour ce tuto détaillé. Je le suis avec comme variante de
travailler dans le Debian chroot de SynoCommunity (https://synocommunity.com), du coup j'ai pu installer libevhtp avec aptitude.

Mon problème est
ailleurs : lorsque je veux modifier la fonction init_seafile_path
comme indiqué, la mienne ne prend pas de paramètre, du coup, je ne
vois pas comment la modifier. Je pourrais modifier l'appel aussi, mais quoi
lui passer. Ci-dessous la fonction qui est dans le code source que
j'ai obtenu en suivant le tuto.

Tout aide sera la bienvenue ! Merci.
 :-)
Franck

Code:
static void
init_seafile_path ()
{
GError *error = NULL;
char
*exectuble = g_file_read_link ("/proc/self/exe", &error);

char *tmp = NULL;
if (error != NULL) {
seaf_warning
("failed to readlink: %sn", error->message);
 return;

}

bin_dir = g_path_get_dirname (exectuble);

tmp =
g_path_get_dirname (bin_dir);
installpath =
g_path_get_dirname (tmp);

topdir =
g_path_get_dirname (installpath);

g_free (exectuble);

g_free (tmp);
}
neo73   |88.178.190.xxx |2014-08-24 17:58:48
Bonjour Franck,
Effectivement petit oubli, je n'avais pas mentionné le
changement dans l'appel à init_seafile_path depuis seaf_controller_init. C'est
corrigé, il suffit normalement d'ajouter config_dir en paramètre lors de
l'appel.
Merci
Anonymous   |82.231.6.xxx |2014-08-25 16:02:35
Merci ! Je m'en étais tiré entre temps en codant topdir en dur lors de sa
déclaration et en supprimant son affectiation dans la fonction.
F.
Cutman2593  - Problème lors du build de la librairie ccnet   |176.131.240.xxx |2016-10-02 22:34:01
Bonjour !

Merci pour ce tutoriel bien complet !
Par contre, je rencontre un
problème au niveau du build de la librairie ccnet ...

Voici le bout de code
montrant l'erreur lors de l'éxécution de la commande 'make' dans le dossier
"ccnet-3.0.3-server"

-------------------- --------------

[libsearpc]:
done

make all-am

make[3]: Entering directory
'/home/seafile/seafile-server/src/ccnet-3.0.3-serv er/lib'

/bin/bash ../libtool
--mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -I/usr/include/glib-2.0
-I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I../include -I../include/ccnet
-I../lib -I../include -DG_LOG_DOMAIN="Ccnet" -pthread
-I(DESTDIR)/usr/local/include -I(DESTDIR)/usr/local/include/searpc
-I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -Wall
-DCCNET_LIB -g -O2 -MT libccnet_la-ccnet-client.lo -MD -MP -MF
.deps/libccnet_la-ccnet-client.Tpo -c -o libccnet_la-ccnet-client.lo `test -f
'ccnet-client.c' || echo './'`ccnet-client.c

/bin/bash: -c: line 0: syntax
error near unexpected token `('

/bin/bash: -c: line 0: `/bin/bash ../libtool
--mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -I/usr/include/glib-2.0
-I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I../include -I../include/ccnet
-I../lib -I../include -DG_LOG_DOMAIN="Ccnet" -pthread
-I(DESTDIR)/usr/local/include -I(DESTDIR)/usr/local/include/searpc
-I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -Wall
-DCCNET_LIB -g -O2 -MT libccnet_la-ccnet-client.lo -MD -MP -MF
.deps/libccnet_la-ccnet-client.Tpo -c -o libccnet_la-ccnet-client.lo `test -f
'ccnet-client.c' || echo './'`ccnet-client.c'

Makefile:563: recipe for target
'libccnet_la-ccnet-client.lo' failed

make[3]: *** [libccnet_la-ccnet-client.lo]
Error 1

make[3]: Leaving directory
'/home/seafile/seafile-server/src/ccnet-3.0.3-serv
er/lib'

-----------------

L'aut...
neo73   |81.57.93.xxx |2016-10-02 23:15:14
Bonjour,

Quelques pistes :
- Vérifies que la commande executée est make et
non make install (la présence de DESTDIR dans la ligne générant l'erreur est
étrange, cette variable étant généralement utilisée pour l'installation)
-
Relance les commandes autogen.sh et configure donnera peut-être des messages
d'erreurs permettant de comprendre ce qui ne va pas.
Si ces solutions ne donnent
rien :
- Edite le fichier Makefile et remplace (DESTDIR) par $(DESTDIR)
- Lance
make DESTDIR=/
cutman2593  - Autre problème ...   |176.131.240.xxx |2016-10-03 20:51:03
Re-bonjour !

Après avoir suivi tes conseils, j'ai modifié tous les
Makefile incorrects en corrigeant la syntaxe. Du coup la compilation
des librairies externes a fonctionné.

Par contre, je les
collectionne ... là, bug au niveau de la compilation de seafile-server,

Code:

repo-op.o: In
function `gen_new_commit':
/home/seafile/seafile-server/src /seafile-3
.0.3-server/server/repo-op.c:520: undefined reference
to `seaf_branch_manager_test_and_update_branch'

repo -op.o: In
function `seaf_repo_manager_revert_on_server':
/home/seafil e/seafile-
server/src/seafile-3.0.3-server/server/r epo-op.c:4320: undefined reference
to `seaf_branch_manager_test_and_update_branch'

../c ommon/rpc-servic
e.o: In
function `seafile_edit_repo':
/home/seafile/seafile-server/ src/seafil
e-3.0.3-server/server/../common/rpc-serv ice.c:1439: undefined reference
to `seaf_branch_manager_test_and_update_branch'

../c ommon/rpc-servic
e.o: In
function `seafile_change_repo_passwd':
/home/seafile/seafil e-server/s
rc/seafile-3.0.3-server/server/../common /rpc-service.c:1547: undefined
reference
to `seaf_branch_manager_test_and_update_branch'

proc essors/recvbranc
h-proc.o: In
function `update_repo':
/home/seafile/seafile-server/src/se afile-3.0.
3-server/server/processors/recvbranch-pr oc.c:198: undefined reference
to `seaf_branch_manager_test_and_update_branch'

coll ect2: error: ld
returned 1 exit status
Makefile:681: recipe for target 'seaf-server'
failed
make[3]: *** [seaf-server] Error 1
make[3]: Leaving
directory '/home/seafile/seafile-server/src/seafile-3.0.3-se rver/serv
er'



Il doit manquer un include quelque part pour qu'il fasse un 'undefined
reference', mais alors&nbs...
neo73   |81.57.93.xxx |2016-10-03 22:38:42
La fonction en question est common/branch-mgr.h et ce fichier est bien inclu par
common/rpc-service.c et autres fichiers... Je conseille de ne pas trop insister
sur les fix manuels, surtout puisqu'il y a potentiellement eu des erreurs lors
des étapes précédentes.

Comme la version 3 de seafile commence à dater il
vaudrait mieux recommencer une install à partir d'une version plus récente des
sources. J'avais fait une rapide update pour l'install de la version 4 (
http://www.rooot.net/fr/geek-stuff/synology/43-upg rade-seafile-synology.html ).
Seafile en est maintenant à la version 6 mais il devrait y avoir peu de
modifications ( https://manual.seafile.com/build_seafile/linux.htm l ).
Je
tâcherai de faire une install de cette nouvelle version prochainement sur mon
NAS.
neo73   |81.57.93.xxx |2017-03-13 15:18:49
J'ai finalement pris le temps de passer à Seafile 6.0.8 (
http://www.rooot.net/en/geek-stuff/synology/44-sea
file6-armv7-synology-diskstation-nas.html ) depuis un chroot Debian Jessie. En
reprenant les mêmes étapes pour compiler les projets je n'ai pas rencontré de
problème.

Peux-être la génération de libtool s'était mal passée, vérifie
que tu as bien les dernières versions d'autoconf, automake et libtool
installées et que l'éxécution d'autogen et configure ne remontent pas
d'erreur.
Write comment
Name:
Email:
 
Website:
Title:
UBBCode:
[b] [i] [u] [url] [quote] [code] [img] 
 
 
:angry::0:confused::cheer:B):evil::silly::dry::lol::kiss::D:pinch:
:(:shock::X:side::):P:unsure::woohoo::huh::whistle:;):s
:!::?::idea::arrow:
 
Please input the anti-spam code that you can read in the image.

3.26 Copyright (C) 2008 Compojoom.com / Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."