Seafile (Linux): Unterschied zwischen den Versionen
(→Links) |
|||
(66 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) | |||
Zeile 3: | Zeile 3: | ||
MySQL-Server - siehe dazu [[MySQL installieren (Linux)]] | MySQL-Server - siehe dazu [[MySQL installieren (Linux)]] | ||
Erforfderliche Pakete installieren: | |||
<pre> | <pre> | ||
sudo apt-get install python2.7 libpython2.7 python-setuptools python-imaging python-ldap python-mysqldb python-memcache python-urllib3 | sudo apt-get install python2.7 libpython2.7 python-setuptools python-imaging python-ldap python-mysqldb python-memcache python-urllib3 | ||
</pre> | |||
<pre> | |||
sudo apt-get install libapache2-mod-proxy-html | |||
</pre> | |||
Apache-Module aktivieren: | |||
<pre> | |||
sudo a2enmod rewrite | |||
sudo a2enmod proxy | |||
sudo a2enmod proxy_fcgi | |||
sudo a2enmod proxy_http | |||
sudo a2enmod proxy_html | |||
</pre> | |||
{{note|''proxy_html'' warns that ''mo_xml2enc'' is required for NON-ASCII characters - but currently it is not available within Ubuntu packages.}} | |||
<pre> | |||
sudo a2enmod mod_xml2enc | |||
</pre> | </pre> | ||
Zeile 36: | Zeile 56: | ||
=== Datenbanken anlegen === | === Datenbanken anlegen === | ||
Wenn der ''MySQL-Server'' auf eine bestimmte IP-Adresse hört, dann auch einen User mit Host '''%''' anlegen: | |||
<pre> | <pre> | ||
mysql -u root -p | mysql -u root -p | ||
create user 'seafile'@'%' identified by '<password>'; | create user 'seafile'@'%' identified by '<password>'; | ||
grant all on `ccnet-db`.* to 'seafile'@'%'; | grant all on `ccnet-db`.* to 'seafile'@'%'; | ||
grant all on `seafile`.* to 'seafile'@'%'; | grant all on `seafile-db`.* to 'seafile'@'%'; | ||
grant all on `seahub`.* to 'seafile'@'%'; | grant all on `seahub-db`.* to 'seafile'@'%'; | ||
</pre> | </pre> | ||
Danach das Konfigurations-Skript starten: | |||
<pre> | <pre> | ||
sudo -u seafile ./seafile-server-5.1.3/setup-seafile-mysql.sh | sudo -u seafile ./seafile-server-5.1.3/setup-seafile-mysql.sh | ||
</pre> | </pre> | ||
=== Server testen === | |||
<pre> | |||
sudo -u seafile ./seafile.sh start | |||
sudo -u seafile ./seahub.sh start | |||
</pre> | |||
Danach sollte der Server unter [http://10.0.0.120:8000/ http://10.0.0.120:8000/] erreichbar sein. | |||
<pre> | |||
sudo -u seafile ./seahub.sh stop | |||
sudo -u seafile ./seafile.sh stop | |||
</pre> | |||
=== Server beim Booten starten === | |||
Ein Skript ''/etc/init.d/seafile-server'' erstellen: | |||
<pre> | |||
sudo nano /etc/init.d/seafile-server | |||
</pre> | |||
Und mit folgenden Inhalt befüllen (eventuell die Variablen ''user'' und ''seafile_dir'' anpassen): | |||
{{note|Für den Test OHNE Apache die Variable ''fastcgi'' auf ''false'' setzen}} | |||
<pre> | |||
#!/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 | |||
</pre> | |||
Dieses Skript noch ausführbar machen: | |||
<pre> | |||
sudo chmod +x /etc/init.d/seafile-server | |||
</pre> | |||
Zusätzlich noch eine Datei ''/etc/init/seafile-server.conf'' erstellen: | |||
<pre> | |||
sudo nano /etc/init/seafile-server.conf | |||
</pre> | |||
Diese Datei mit folgenden Inhalt befüllen: | |||
<pre> | |||
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 | |||
</pre> | |||
=== Webdav === | |||
{{note|''fastcgi'' immer auf '''false''' belassen (auch bei ''Apache''-Konfiguration)}} | |||
<pre> | |||
sudo nano /home/seafile/seafile/conf/seafdav.conf | |||
</pre> | |||
Konfigurationsdatei folgendermaßen anpassen (Port eventuell ändern): | |||
<pre> | |||
[WEBDAV] | |||
enabled = true | |||
port = 8085 | |||
fastcgi = false | |||
share_name = /seafdav | |||
</pre> | |||
== Konfiguration == | |||
SSL-Zertifikat erstellen - dazu siehe [[SSL_Zertifikat]] | |||
=== Apache === | |||
Konfigurationsfile für Port ''80'' bearbeiten / anlegen: | |||
<pre> | |||
sudo nano /etc/apache2/sites-available/seafile.conf | |||
</pre> | |||
Für Port ''80'' wird ein ''Redirect'' auf Port ''443'' eingerichtet - dadurch ist ein unverschlüsselter Login nicht mehr möglich. | |||
<pre> | |||
<VirtualHost *:80> | |||
ServerName seafile.kirner.or.at | |||
ServerAlias seafile.kirner.or.at | |||
Redirect / https://seafile.kirner.or.at | |||
</VirtualHost> | |||
</pre> | |||
Konfigurationsfile für Port ''443'' bearbeiten / anlegen: | |||
<pre> | |||
sudo nano /etc/apache2/sites-available/seafile-ssl.conf | |||
</pre> | |||
Folgenden Inhalt einfügen: | |||
<pre> | |||
<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 | |||
ProxyRequests Off | |||
RewriteEngine On | |||
<Proxy *> | |||
Order deny,allow | |||
Allow from all | |||
</Proxy> | |||
<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> | |||
</pre> | |||
Danach Kofigurationen aktivieren und neu laden: | |||
<pre> | |||
cd /etc/apache2/sites-available/ | |||
sudo a2ensite seafile.conf | |||
sudo a2ensite seafile-ssl.conf | |||
sudo service apache2 reload | |||
</pre> | |||
=== ccnet.conf === | |||
<pre> | |||
sudo nano /home/seafile/seafile/conf/ccnet.conf | |||
</pre> | |||
''SERVICE_URL'' folgendermaßen anpassen: | |||
<pre> | |||
SERVICE_URL = https://seafile.kirner.or.at | |||
</pre> | |||
=== seahub_settings.py === | |||
<pre> | |||
sudo nano /home/seafile/seafile/conf/seahub_settings.py | |||
</pre> | |||
Am Ende folgende Zeile einfügen: | |||
<pre> | |||
FILE_SERVER_ROOT = 'https://seafile.kirner.or.at/seafhttp' | |||
</pre> | |||
== Log-Rotate == | |||
Im Verzeichnis ''/etc/logrotate.d/'' eine Datei ''seafile'' anlegen: | |||
<pre> | |||
sudo nano /etc/logrotate.d/seafile | |||
</pre> | |||
Folgenden Inhalt einfügen: | |||
<pre> | |||
/home/seafile/seafile/logs/seaf-server.log | |||
{ | |||
daily | |||
missingok | |||
rotate 52 | |||
compress | |||
delaycompress | |||
notifempty | |||
sharedscripts | |||
postrotate | |||
[ ! -f /home/seafile/seafile/pids/seaf-server.pid ] || kill -USR1 `cat /home/seafile/seafile/pids/seaf-server.pid` | |||
endscript | |||
} | |||
/home/seafile/seafile/logs/ccnet.log | |||
{ | |||
daily | |||
missingok | |||
rotate 52 | |||
compress | |||
delaycompress | |||
notifempty | |||
sharedscripts | |||
postrotate | |||
[ ! -f /home/seafile/seafile/pids/ccnet.pid ] || kill -USR1 `cat /home/seafile/seafile/pids/ccnet.pid` | |||
endscript | |||
} | |||
/home/seafile/seafile/logs/seafile.init.log | |||
{ | |||
monthly | |||
missingok | |||
rotate 24 | |||
compress | |||
delaycompress | |||
notifempty | |||
sharedscripts | |||
} | |||
/home/seafile/seafile/logs/seahub.init.log | |||
{ | |||
monthly | |||
missingok | |||
rotate 24 | |||
compress | |||
delaycompress | |||
notifempty | |||
sharedscripts | |||
} | |||
</pre> | |||
== Memcached == | |||
Installation: | |||
<pre> | |||
sudo apt-get install memcached python-memcache | |||
</pre> | |||
''seahub_settings.py'' öffnen: | |||
<pre> | |||
sudo nano /home/seafile/seafile/conf/seahub_settings.py | |||
</pre> | |||
Und am Ende folgende Zeilen einfügen: | |||
<pre> | |||
CACHES = { | |||
'default': { | |||
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', | |||
'LOCATION': '127.0.0.1:11211', | |||
} | |||
} | |||
</pre> | |||
== Mail-Versand == | |||
<pre> | |||
sudo nano /home/seafile/seafile/conf/seahub_settings.py | |||
</pre> | |||
Folgende Zeilen hinzufügen: | |||
<pre> | |||
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 | |||
</pre> | |||
== Benutzerpasswort zurücksetzen == | |||
[https://manual.seafile.com/maintain/account.html https://manual.seafile.com/maintain/account.html] | |||
== Links == | == Links == | ||
Zeile 53: | Zeile 401: | ||
Zurück zu [[Ubuntu]] | Zurück zu [[Seafile (unterschiedliche Versionen)#Ubuntu Versionen|Seafile]] |
Aktuelle Version vom 30. Mai 2020, 15:25 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
sudo apt-get install libapache2-mod-proxy-html
Apache-Module aktivieren:
sudo a2enmod rewrite sudo a2enmod proxy sudo a2enmod proxy_fcgi sudo a2enmod proxy_http sudo a2enmod proxy_html
proxy_html warns that mo_xml2enc is required for NON-ASCII characters - but currently it is not available within Ubuntu packages.
sudo a2enmod mod_xml2enc
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
fastcgi immer auf false belassen (auch bei Apache-Konfiguration)
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
Konfigurationsfile für Port 80 bearbeiten / anlegen:
sudo nano /etc/apache2/sites-available/seafile.conf
Für Port 80 wird ein Redirect auf Port 443 eingerichtet - dadurch ist ein unverschlüsselter Login nicht mehr möglich.
<VirtualHost *:80> ServerName seafile.kirner.or.at ServerAlias seafile.kirner.or.at Redirect / https://seafile.kirner.or.at </VirtualHost>
Konfigurationsfile für Port 443 bearbeiten / anlegen:
sudo nano /etc/apache2/sites-available/seafile-ssl.conf
Folgenden Inhalt einfügen:
<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 ProxyRequests Off RewriteEngine On <Proxy *> Order deny,allow Allow from all </Proxy> <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>
Danach Kofigurationen aktivieren und neu laden:
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'
Log-Rotate
Im Verzeichnis /etc/logrotate.d/ eine Datei seafile anlegen:
sudo nano /etc/logrotate.d/seafile
Folgenden Inhalt einfügen:
/home/seafile/seafile/logs/seaf-server.log { daily missingok rotate 52 compress delaycompress notifempty sharedscripts postrotate [ ! -f /home/seafile/seafile/pids/seaf-server.pid ] || kill -USR1 `cat /home/seafile/seafile/pids/seaf-server.pid` endscript } /home/seafile/seafile/logs/ccnet.log { daily missingok rotate 52 compress delaycompress notifempty sharedscripts postrotate [ ! -f /home/seafile/seafile/pids/ccnet.pid ] || kill -USR1 `cat /home/seafile/seafile/pids/ccnet.pid` endscript } /home/seafile/seafile/logs/seafile.init.log { monthly missingok rotate 24 compress delaycompress notifempty sharedscripts } /home/seafile/seafile/logs/seahub.init.log { monthly missingok rotate 24 compress delaycompress notifempty sharedscripts }
Memcached
Installation:
sudo apt-get install memcached python-memcache
seahub_settings.py öffnen:
sudo nano /home/seafile/seafile/conf/seahub_settings.py
Und am Ende folgende Zeilen einfügen:
CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', 'LOCATION': '127.0.0.1:11211', } }
Mail-Versand
sudo nano /home/seafile/seafile/conf/seahub_settings.py
Folgende Zeilen hinzufügen:
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
Benutzerpasswort zurücksetzen
https://manual.seafile.com/maintain/account.html
Links
http://manual.seafile.com/deploy/using_mysql.html
Zurück zu Seafile