Seafile (Linux): Unterschied zwischen den Versionen

Aus Tutorials
Zur Navigation springen Zur Suche springen
Zeile 14: Zeile 14:
sudo a2enmod proxy_fcgi
sudo a2enmod proxy_fcgi
sudo a2enmod proxy_http
sudo a2enmod proxy_http
sudo a2enmod mod_proxy_html
sudo a2enmod proxy_html
</pre>
</pre>



Version vom 18. Juni 2016, 14:28 Uhr

Voraussetzungen

MySQL-Server - siehe dazu MySQL installieren (Linux)

Erforfderliche Pakete installieren:

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

Apache-Module aktivieren:

sudo a2enmod rewrite
sudo a2enmod proxy
sudo a2enmod proxy_fcgi
sudo a2enmod proxy_http
sudo a2enmod proxy_html

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):

Für den Test OHNE Apache die Variable fastcgi auf false setzen

#!/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

Webdav

sudo nano /home/seafile/seafile/conf/seafdav.conf

Konfigurationsdatei folgendermaßen anpassen (Port eventuell ändern):

[WEBDAV]
enabled = true
port = 8085
fastcgi = false
share_name = /seafdav

Konfiguration

SSL-Zertifikat erstellen - dazu siehe SSL_Zertifikat

Apache

sudo nano /etc/apache2/sites-available/seafile.conf
<VirtualHost *:80>
        ServerName seafile.kirner.or.at
        ServerAlias seafile.kirner.or.at
        Redirect / https://seafile.kirner.or.at
</VirtualHost>
sudo nano /etc/apache2/sites-available/seafile-ssl.conf

<VirtualHost *:443>
    ServerName seafile.kirner.or.at
    DocumentRoot /var/www
    Alias /media  /home/seafile/seafile/seafile-server-latest/seahub/media

    SSLEngine On
    SSLCertificateFile /etc/ssl/certs/seafile.crt
    SSLCertificateKeyFile /etc/ssl/private/apache.key

    RewriteEngine On

    <Location /media>
        ProxyPass !
        Require all granted
    </Location>

    #
    # seafile fileserver
    #
    ProxyPass /seafhttp http://127.0.0.1:8082
    ProxyPassReverse /seafhttp http://127.0.0.1:8082
    RewriteRule ^/seafhttp - [QSA,L]

    #
    # seafile webdav
    #
    ProxyPass /seafdav http://127.0.0.1:8085/seafdav
    ProxyPassReverse /seafdav http://127.0.0.1:8085/seafdav

    #
    # seahub
    #
    SetEnvIf Request_URI . proxy-fcgi-pathinfo=unescape
    SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
    ProxyPass / fcgi://127.0.0.1:8000/

    ErrorLog ${APACHE_LOG_DIR}/seafile.kirner.or.at-error.log
    CustomLog ${APACHE_LOG_DIR}/seafile.kirner.or.at-access.log combined
</VirtualHost>

cd /etc/apache2/sites-available/
sudo a2ensite seafile.conf
sudo a2ensite seafile-ssl.conf
sudo service apache2 reload

ccnet.conf

sudo nano /home/seafile/seafile/conf/ccnet.conf

SERVICE_URL folgendermaßen anpassen:

SERVICE_URL = https://seafile.kirner.or.at

seahub_settings.py

sudo nano /home/seafile/seafile/conf/seahub_settings.py

Am Ende folgende Zeile einfügen:

FILE_SERVER_ROOT = 'https://seafile.kirner.or.at/seafhttp'

Alternativ

Required for alternative seafile-ssl.conf

FastCGIExternalServer /var/www/seahub.fcgi -host 127.0.0.1:8000
FastCGIExternalServer /var/www/seafdav.fcgi -host 127.0.0.1:9080

Links

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


Zurück zu Ubuntu