Seafile (Ubuntu 18.04)
Installation
Download
https://github.com/haiwen/seafile-rpi/releases
cd ~/temp wget https://github.com/haiwen/seafile-rpi/releases/download/v7.1.4/seafile-server_7.1.4_pi-bionic-stable.tar.gz
Entpacken
sudo mkdir -p /opt/seafile/installed sudo mv seafile-server_* /opt/seafile/ cd /opt/seafile/ sudo tar -xzf seafile-server_* sudo mv seafile-server_* installed
Datenbank anlegen
mysql -u root -p create user 'seafile'@'%' identified by '<password>'; create database `ccnet_db` character set = 'utf8'; create database `seafile_db` character set = 'utf8'; create database `seahub_db` character set = 'utf8'; GRANT ALL PRIVILEGES ON `ccnet_db`.* to 'seafile'@'%'; GRANT ALL PRIVILEGES ON `seafile_db`.* to 'seafile'@'%'; GRANT ALL PRIVILEGES ON `seahub_db`.* to 'seafile'@'%'; flush privileges; quit
Abhängigkeiten installieren
sudo apt-get install -y python3 python3-setuptools python3-pip libmemcached-dev zlib1g-dev sudo pip3 install --timeout=3600 Pillow pylibmc captcha jinja2 sqlalchemy django-pylibmc django-simple-captcha python3-ldap lxml
Seafile installieren
cd seafile-server-* sudo ./setup-seafile-mysql.sh
Server stoppen
sudo seafile-server-latest/seahub.sh stop sudo seafile-server-latest/seafile.sh stop
Konfiguration
/opt/seafile/conf/seafdav.conf
Um Konflikte mit Tomcat zu vermeiden, in der Konfigurationsdatei
sudo vi /opt/seafile/conf/seafdav.conf
den Wert für port auf
port = 8085
ändern.
Benutzer anlegen
Einen System-Benutzer seafile ohne Homeverzeichnis und ohne Loginmöglichkeit, anlegen:
sudo addgroup --system --no-create-home --disabled-login --gid 1005 seafile sudo adduser --system --no-create-home --disabled-login --uid 1005 --ingroup seafile seafile
/opt/seafile/seafile-data
sudo mkdir -p /mnt/synology/web1/seafile/backup/init/ sudo mkdir -p /mnt/synology/web1/seafile/ sudo rsync -av /opt/seafile/seafile-data /mnt/synology/web1/seafile/ sudo chmod 700 /mnt/synology/web1/seafile/seafile-data sudo mv /opt/seafile/seafile-data /mnt/synology/web1/seafile/backup/init/ cd /opt/seafile/ sudo ln -s /mnt/synology/web1/seafile/seafile-data seafile-data
/opt/seafile/seahub-data
sudo mkdir -p /mnt/synology/web1/seafile/seahub-data sudo rsync -av /opt/seafile/seahub-data /mnt/synology/web1/seafile/ sudo chmod 700 /mnt/synology/web1/seafile/seahub-data sudo mv /opt/seafile/seahub-data /mnt/synology/web1/seafile/backup/init/ sudo ln -s /mnt/synology/web1/seafile/seahub-data seahub-data
Besitzer ändern
sudo chown -R seafile:seafile /opt/seafile/ sudo chown -R seafile:seafile /mnt/synology/web1/seafile/
Server testen
Damit der Server von aussen erreichbar ist, muss die Datei
sudo vi conf/gunicorn.conf.py
geöffnet und folgende Zeilen angepasst werden:
#bind = "127.0.0.1:8000" bind = "0.0.0.0:8000"
Danach die Server mit folgenden Kommandos starten:
sudo -u seafile /opt/seafile/seafile-server-latest/seafile.sh start sudo -u seafile /opt/seafile/seafile-server-latest/seahub.sh start
Bei fehlerfreiem Start sollte der Server unter http://10.0.0.176:8000/ erreichbar sein.
Wenn alles geklappt hat, können die Server mit folgenden Kommandos wieder gestoppt werden:
sudo -u seafile /opt/seafile/seafile-server-latest/seahub.sh stop sudo -u seafile /opt/seafile/seafile-server-latest/seafile.sh stop
Links
https://download.seafile.com/published/seafile-manual/deploy/using_mysql.md
Autostart
Seafile
sudo vi /etc/systemd/system/seafile.service
[Unit] Description=Seafile After=network.target After=mariadb.service [Service] Type=forking ExecStart=/opt/seafile/seafile-server-latest/seafile.sh start ExecStop=/opt/seafile/seafile-server-latest/seafile.sh stop LimitNOFILE=infinity User=seafile Group=seafile [Install] WantedBy=multi-user.target
Seahub
sudo vi /etc/systemd/system/seahub.service
[Unit] Description=Seafile hub After=network.target seafile.service [Service] Type=forking Environment="LC_ALL=C" # change start to start-fastcgi if you want to run fastcgi ExecStart=/opt/seafile/seafile-server-latest/seahub.sh start ExecStop=/opt/seafile/seafile-server-latest/seahub.sh stop User=seafile Group=seafile [Install] WantedBy=multi-user.target
Aktivieren
sudo systemctl enable seafile.service sudo systemctl enable seahub.service
Links
https://download.seafile.com/published/seafile-manual/deploy/start_seafile_at_system_bootup.md
WebDAV
Für WebDAV-Support die Datei
sudo vi /opt/seafile/conf/seafdav.conf
bearbeiten und folgende Zeilen anpassen:
enabled = true port = 8085 share_name = /seafdav
Danach Seafile mittels dem Kommando
sudo systemctl stop seahub.service sudo systemctl restart seafile.service sudo systemctl start seahub.service
neustarten.
Links
https://download.seafile.com/published/seafile-manual/extension/webdav.md
Domain Name
Apache
sudo a2enmod rewrite sudo a2enmod proxy sudo a2enmod proxy_http sudo a2enmod proxy_html
sudo vi /etc/apache2/sites-available/seafile.conf
<VirtualHost *:80> ServerName seafile.kirner.or.at Redirect / https://seafile.kirner.or.at </VirtualHost>
sudo vi /etc/apache2/sites-available/seafile-ssl.conf
<VirtualHost *:443> ServerName seafile.kirner.or.at DocumentRoot /var/www SSLEngine On SSLCertificateFile /etc/ssl/certs/seafile.crt SSLCertificateKeyFile /etc/ssl/private/apache.key Alias /media /opt/seafile/seafile-server-latest/seahub/media <Location /media> Require all granted </Location> RewriteEngine On # # seafile fileserver # ProxyPass /seafhttp http://127.0.0.1:8082 ProxyPassReverse /seafhttp http://127.0.0.1:8082 RewriteRule ^/seafhttp - [QSA,L] # # WebDAV # We use http proxy, since SeafDAV is incompatible with FCGI proxy in Apache 2.4. # ProxyPass /seafdav http://127.0.0.1:8085/seafdav ProxyPassReverse /seafdav http://127.0.0.1:8085/seafdav # # seahub # SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1 ProxyPreserveHost On ProxyPass / http://127.0.0.1:8000/ ProxyPassReverse / http://127.0.0.1:8000/ </VirtualHost>
ccnet.conf
sudo vi /opt/seafile/conf/ccnet.conf
SERVICE_URL = https://seafile.kirner.or.at
seahub_settings.py
sudo vi /opt/seafile/conf/seahub_settings.py
FILE_SERVER_ROOT = 'https://seafile.kirner.or.at/seafhttp'
Links
https://download.seafile.com/published/seafile-manual/deploy/https_with_apache.md
Logrotate
/etc/logrotate.d/seafile
sudo vi /etc/logrotate.d/seafile
/opt/seafile/logs/seafile.log { daily missingok rotate 15 compress delaycompress notifempty sharedscripts postrotate [ ! -f /opt/seafile/pids/seaf-server.pid ] || kill -USR1 `cat /opt/seafile/pids/seaf-server.pid` endscript } /opt/seafile/logs/ccnet.log { daily missingok rotate 15 compress delaycompress notifempty sharedscripts postrotate [ ! -f /opt/seafile/pids/ccnet.pid ] || kill -USR1 `cat /opt/seafile/pids/ccnet.pid` endscript } /opt/seafile/logs/seahub.log { daily missingok rotate 15 compress delaycompress notifempty sharedscripts postrotate [ ! -f /opt/seafile/pids/seahub.pid ] || kill -USR1 `cat /opt/seafile/pids/seahub.pid` endscript } /opt/seafile/logs/seafdav.log { daily missingok rotate 15 compress delaycompress notifempty sharedscripts postrotate [ ! -f /opt/seafile/pids/seafdav.pid ] || kill -USR1 `cat /opt/seafile/pids/seafdav.pid` endscript } /opt/seafile/logs/controller.log { daily missingok rotate 15 compress delaycompress notifempty sharedscripts }
Test
siehe logrotate
Links
https://download.seafile.com/published/seafile-manual/deploy/using_logrotate.md
Mail-Versand
seahub_settings.py
sudo vi /opt/seafile/conf/seahub_settings.py
EMAIL_USE_TLS = True EMAIL_HOST = 'mail.<domain>' # smpt server EMAIL_HOST_USER = '<user>@<domain>' # username and domain EMAIL_HOST_PASSWORD = '<password>' # password EMAIL_PORT = 587 DEFAULT_FROM_EMAIL = EMAIL_HOST_USER SERVER_EMAIL = EMAIL_HOST_USER
Links
https://download.seafile.com/published/seafile-manual/config/sending_email.md
Cache
Installation
sudo apt-get install -y memcached libmemcached-dev sudo systemctl enable --now memcached
Konfiguration
Die Datei
sudo vi /opt/seafile/conf/seahub_settings.py
bearbeiten und am Ende folgende Zeilen hinzufügen:
CACHES = { 'default': { 'BACKEND': 'django_pylibmc.memcached.PyLibMCCache', 'LOCATION': '127.0.0.1:11211', }, }
Links
https://download.seafile.com/published/seafile-manual/deploy/add_memcached.md
Zwei-Faktor-Authentifizierung
Links
https://manual.seafile.com/deploy_pro/two_factor_authentication/
Probleme
ImportError: cannot import name '_imaging' from 'PIL' (/opt/seafile/seafile-server-7.1.4/seahub/thirdpart/PIL/__init__.py)
Mitgelieferte Bibliothek PIL umbenennen (wird durch pillow ersetzt):
cd /opt/seafile/seafile-server-latest/seahub/thirdpart/ sudo -u seafile mv PIL/ PIL.bak
Links
https://forum.seafile.com/t/ubuntu-upgrade-to-20-04-broke-seahub-arm/12072
Mitgelieferte Bibliothek Crypto umbenennen (wird durch pycrypto ersetzt):
cd /opt/seafile/seafile-server-latest/seahub/thirdpart/ sudo -u seafile mv Crypto/ Crypto.bak
Links
https://www.gitmemory.com/vmario89
Links
https://download.seafile.com/published/seafile-manual/home.md
https://www.raspberry-pi-geek.de/ausgaben/rpg/2019/02/seafile-cloud-auf-dem-raspberry-pi/
Zurück zu Seafile