Seafile (Linux)

Aus Tutorials
Zur Navigation springen Zur Suche springen

Voraussetzungen

MySQL-Server - siehe dazu MySQL installieren (Linux)

sudo apt-get install python2.7 libpython2.7 python-setuptools python-imaging python-ldap python-mysqldb python-memcache python-urllib3

Installation

Benutzer anlegen

Einen System-Benutzer seafile mit Homeverzeichnis, aber ohne Loginmöglichkeit, anlegen:

sudo addgroup --system --disabled-login --gid 1005 seafile
sudo adduser --system --disabled-login --uid 1005 --ingroup seafile seafile

Aktuelle Version runterladen

Auf https://www.seafile.com/en/download/ die letzte Serverversion suchen und runterladen:

sudo -u seafile mkdir /home/seafile/seafile
cd /home/seafile/seafile
sudo -u seafile wget https://bintray.com/artifact/download/seafile-org/seafile/seafile-server_5.1.3_x86-64.tar.gz

Entpacken und Installieren

sudo -u seafile tar -xzf seafile-server_*
sudo -u seafile mkdir installed
sudo -u seafile mv seafile-server_* installed

Datenbanken anlegen

Wenn der MySQL-Server auf eine bestimmte IP-Adresse hört, dann auch einen User mit Host % anlegen:

mysql -u root -p 
create user 'seafile'@'%' identified by '<password>';
grant all on `ccnet-db`.* to 'seafile'@'%';
grant all on `seafile-db`.* to 'seafile'@'%'; 
grant all on `seahub-db`.* to 'seafile'@'%'; 

Danach das Konfigurations-Skript starten:

sudo -u seafile ./seafile-server-5.1.3/setup-seafile-mysql.sh

Server testen

sudo -u seafile ./seafile.sh start
sudo -u seafile ./seahub.sh start

Danach sollte der Server unter http://10.0.0.120:8000/ erreichbar sein.

sudo -u seafile ./seahub.sh stop
sudo -u seafile ./seafile.sh stop

Server beim Booten starten

Ein Skript /etc/init.d/seafile-server erstellen:

sudo nano /etc/init.d/seafile-server

Und mit folgenden Inhalt befüllen (eventuell die Variablen user und seafile_dir anpassen):

#!/bin/bash

# Change the value of "user" to your linux user name
user=seafile

# Change the value of "seafile_dir" to your path of seafile installation
# usually the home directory of $user
seafile_dir=/home/seafile/seafile
script_path=${seafile_dir}/seafile-server-latest
seafile_init_log=${seafile_dir}/logs/seafile.init.log
seahub_init_log=${seafile_dir}/logs/seahub.init.log

# Change the value of fastcgi to false if fastcgi is not used
fastcgi=true
# Set the port of fastcgi, default is 8000. Change it if you need different.
fastcgi_port=8000
#
# Write a polite log message with date and time
#
echo -e "\n \n About to perform $1 for seafile at `date -Iseconds` \n " >> ${seafile_init_log}
echo -e "\n \n About to perform $1 for seahub at `date -Iseconds` \n " >> ${seahub_init_log}
case "$1" in
        start)
                sudo -u ${user} ${script_path}/seafile.sh ${1} >> ${seafile_init_log}
                if [ $fastcgi = true ];
                then
                        sudo -u ${user} ${script_path}/seahub.sh ${1}-fastcgi ${fastcgi_port} >> ${seahub_init_log}
                else
                        sudo -u ${user} ${script_path}/seahub.sh ${1} >> ${seahub_init_log}
                fi
        ;;
        restart)
                sudo -u ${user} ${script_path}/seafile.sh ${1} >> ${seafile_init_log}
                if [ $fastcgi = true ];
                then
                        sudo -u ${user} ${script_path}/seahub.sh ${1}-fastcgi ${fastcgi_port} >> ${seahub_init_log}
                else
                        sudo -u ${user} ${script_path}/seahub.sh ${1} >> ${seahub_init_log}
                fi
        ;;
        stop)
                sudo -u ${user} ${script_path}/seahub.sh ${1} >> ${seahub_init_log}
                sudo -u ${user} ${script_path}/seafile.sh ${1} >> ${seafile_init_log}
        ;;
        *)
                echo "Usage: /etc/init.d/seafile-server {start|stop|restart}"
                exit 1
        ;;
esac

Dieses Skript noch ausführbar machen:

sudo chmod +x /etc/init.d/seafile-server

Zusätzlich noch eine Datei /etc/init/seafile-server.conf erstellen:

sudo nano /etc/init/seafile-server.conf

Diese Datei mit folgenden Inhalt befüllen:

start on (started mysql
and runlevel [2345])
stop on (runlevel [016])

pre-start script
/etc/init.d/seafile-server start
end script

post-stop script
/etc/init.d/seafile-server stop
end script

fast-cgi ist momentan auf FALSE

Links

http://manual.seafile.com/deploy/using_mysql.html


Zurück zu Ubuntu