Seafile Installation Notes in Arch Linux
These are my notes about installing Seafile in my Arch Linux home server.
Note: I have reviewed and added to these notes several times.
I’m using:
- Seafile
- A NUC with Arch Linux as my home server
- A WD My Cloud NAS
Setup a NAS share
Create a new share
seafileCreate a new directory in the server
1sudo mkdir /home/nas/seafile
2sudo chmod 750 /home/nas/seafile
3sudo chown seafile:seafile /home/nas/seafile
- Setup a mountpoint in the server
1sudo vi /etc/fstab
1nas:/nfs/seafile /home/nas/seafile nfs users,noauto,x-systemd.automount,x-systemd.device-timeout=10,timeo=14,soft,intr,noatime,file_mode=0640,dir_mode=0750 0 0
- Set NO_ROOT_SWASH in the WD My Cloud NFS exports configuration (when I restart my NAS I have to do this again…)
1ssh -oHostKeyAlgorithms=+ssh-dss sshd@192.168.0.99
1vi /etc/exports
1"/nfs/seafile" *(rw,no_root_squash,sync,no_wdelay,insecure_locks,insecure,no_subtree_check,anonuid=501,anongid=1000)
1exportfs -r
Server installation
Pre-requisites
1sudo pacman -S python-imaging mysql-python
2
3mkdir /tmp/cower
4cd /tmp/cower
5cower -d libsearpc
6cd /tmp/cower/libsearpc
7makepkg -sri
8cower -d libsepol
9cd /tmp/cower/libsepol
10makepkg -sri
11cower -d libselinux
12cd /tmp/cower/libselinux
13makepkg -sri
Download Seafile
https://www.seafile.com/en/download/
1sudo useradd -m -r -d /srv/seafile -s /usr/bin/nologin seafile
2
3sudo -u seafile -s /bin/sh
4
5mkdir seafile/seafile-data
6chown -R seafile:users seafile/seafile-data
7
8echo $HOME
9
10cd $HOME
11wget https://bintray.com/artifact/download/seafile-org/seafile/seafile-server_6.0.9_x86-64.tar.gz
12
13mkdir seafile
14mv seafile-server_* seafile
15cd seafile
16tar -xzf seafile-server_*
17mkdir installed
18mv seafile-server_* installed
MySQL setup for Seafile
1sudo -u seafile -s /bin/sh
2
3cd $HOME/seafile/seafile-server-latest
4./setup-seafile-mysql.sh
5
6./seafile.sh start
7./seahub.sh start
8./seahub.sh stop
9./seafile.sh stop
Move to NAS
1cd $HOME/seafile
2mv seafile-data /home/nas/seafile/
3ln -s /home/nas/seafile/seafile-data $HOME/seafile/seafile-data
Email configuration
1sudo -u seafile -s /bin/sh
2
3cd $HOME/seafile/conf
4vi seahub_settings.py
1EMAIL_USE_TLS = True
2EMAIL_HOST = 'smtp.mail.com'
3EMAIL_HOST_USER = 'your_user@mail.com'
4EMAIL_HOST_PASSWORD = 'XXXXXXXXX'
5EMAIL_PORT = 587
6DEFAULT_FROM_EMAIL = "your_user@mail.com"
7SERVER_EMAIL = "your_user@mail.com"
Apache configuration
1cd /etc/httpd/conf
2sudo vi httpd.conf
1Include conf/extra/httpd-vhosts.conf
2LoadModule rewrite_module modules/mod_rewrite.so
3LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
4LoadModule proxy_http_module modules/mod_proxy_http.so
1sudo vi extra/httpd-vhosts.conf
1<VirtualHost *:80>
2 ServerName my_domain.ddns.net
3 DocumentRoot /etc/httpd
4 Alias /media /srv/seafile/seafile/seafile-server-latest/seahub/media
5
6 RewriteEngine On
7
8 <Location /media>
9 Require all granted
10 </Location>
11
12 #
13 # seafile fileserver
14 #
15 ProxyPass /seafhttp http://127.0.0.1:8082
16 ProxyPassReverse /seafhttp http://127.0.0.1:8082
17 RewriteRule ^/seafhttp - [QSA,L]
18
19 #
20 # WebDAV
21 # We use http proxy, since SeafDAV is incompatible with FCGI proxy in Apache 2.4.
22 #
23 ProxyPass /seafdav http://127.0.0.1:8080/seafdav
24 ProxyPassReverse /seafdav http://127.0.0.1:8080/seafdav
25
26 #
27 # seahub
28 #
29 SetEnvIf Request_URI . proxy-fcgi-pathinfo=unescape
30 SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
31 ProxyPass / fcgi://127.0.0.1:8000/
32</VirtualHost>
1sudo -u seafile -s /bin/sh
2cd $HOME/seafile/conf
3vi ccnet.conf
1SERVICE_URL = http://my_domain.ddns.net
1vi seahub_settings.py
1FILE_SERVER_ROOT = 'http://my_domain.ddns.net/seafile/seafhttp'
1vi seafdav.conf
1[WEBDAV]
2enabled = true
3port = 8080
4fastcgi = false
5share_name = /seafdav
1exit
2sudo systemctl restart httpd
3sudo -u seafile -s /bin/sh
4cd /srv/seafile/seafile/seafile-server-latest
5./seafile.sh restart
6./seahub.sh stop
7./seahub.sh start-fastcgi
Create systemd services
1cat << EOF | sudo tee /etc/systemd/system/seafile.service
2[Unit]
3Description=Seafile server
4After=network.target mysqld.service
5
6[Service]
7Type=oneshot
8ExecStart=/srv/seafile/seafile/seafile-server-latest/seafile.sh start
9ExecStop=/srv/seafile/seafile/seafile-server-latest/seafile.sh stop
10RemainAfterExit=yes
11User=seafile
12Group=nogroup
13
14[Install]
15WantedBy=multi-user.target
16EOF
1sudo systemctl start seafile
2sudo systemctl status seafile
3sudo systemctl enable seafile
1cat << EOF | sudo tee /etc/systemd/system/seahub.service
2[Unit]
3Description=Seahub server
4After=network.target mysqld.service seafile.service
5
6[Service]
7Type=oneshot
8ExecStart=/srv/seafile/seafile/seafile-server-latest/seahub.sh start
9ExecStop=/srv/seafile/seafile/seafile-server-latest/seahub.sh stop
10RemainAfterExit=yes
11User=seafile
12Group=nogroup
13
14[Install]
15WantedBy=multi-user.target
16EOF
1sudo systemctl start seahub
2sudo systemctl status seahub
3sudo systemctl enable seahub
Setup Apache with SSL
1cd /etc/httpd/conf
2
3sudo openssl genrsa -out privkey_seafile.pem 2048
4sudo openssl req -new -x509 -key privkey_seafile.pem -out cacert_seafile.pem -days 1095
1sudo vi httpd.conf
1Include conf/extra/httpd-vhosts.conf
2LoadModule ssl_module modules/mod_ssl.so
3LoadModule log_config_module modules/mod_log_config.so
1sudo vi extra/httpd-vhosts.conf
1<VirtualHost *:443>
2 ServerName my_domain.ddns.net
3 DocumentRoot /etc/httpd
4
5 SSLEngine On
6 SSLCertificateFile /etc/httpd/conf/cacert_seafile.pem
7 SSLCertificateKeyFile /etc/httpd/conf/privkey_seafile.pem
8
9 Alias /media /srv/seafile/seafile/seafile-server-latest/seahub/media
10
11 <Location /media>
12 Require all granted
13 </Location>
14
15 RewriteEngine On
16
17 #
18 # seafile fileserver
19 #
20 ProxyPass /seafhttp http://127.0.0.1:8082
21 ProxyPassReverse /seafhttp http://127.0.0.1:8082
22 RewriteRule ^/seafhttp - [QSA,L]
23
24 #
25 # WebDAV
26 # We use http proxy, since SeafDAV is incompatible with FCGI proxy in Apache 2.4.
27 #
28 ProxyPass /seafdav http://127.0.0.1:8080/seafdav
29 ProxyPassReverse /seafdav http://127.0.0.1:8080/seafdav
30
31 #
32 # seahub
33 #
34 # BEFORE 6.3
35 #SetEnvIf Request_URI . proxy-fcgi-pathinfo=unescape
36 #SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
37 #ProxyPass / fcgi://127.0.0.1:8000/
38 # AFTER 6.3
39 SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
40 ProxyPass / http://127.0.0.1:8000/
41 ProxyPassReverse / http://127.0.0.1:8000/
42</VirtualHost>
1sudo -u seafile -s /bin/sh
2cd $HOME/seafile/conf
3vi ccnet.conf
1SERVICE_URL = https://my_domain.ddns.net
1vi seahub_settings.py
1FILE_SERVER_ROOT = 'https://my_domain.ddns.net/seafhttp'
1vi seafdav.conf
1[WEBDAV]
2enabled = true
3port = 8080
4fastcgi = false
5share_name = /seafdav
1exit
2sudo systemctl restart httpd
3
4sudo -u seafile -s /bin/sh
5cd /srv/seafile/seafile/seafile-server-latest
6./seafile.sh restart
7./seahub.sh stop
8./seahub.sh start-fastcgi
SSL Certificate using certbot
https://manual.seafile.com/deploy/https_with_apache.html
https://certbot.eff.org/lets-encrypt/arch-apache
1sudo pacman -S certbot-apache
2
3cd /etc/httpd/conf
4sudo vi extra/httpd-vhosts.conf
1(...)
2<VirtualHost *:80>
3 ServerAdmin admin@example.com
4 ServerName my_domain.ddns.net
5 ServerAlias my_domain.ddns.net
6 DocumentRoot /etc/httpd
7</VirtualHost>
8(...)
1sudo certbot --apache
2sudo certbot renew
3sudo systemctl restart httpd
Systemd (SSL version)
1cat << EOF | sudo tee /etc/systemd/system/seafile.service
2[Unit]
3Description=Seafile server
4After=network.target mysqld.service
5
6[Service]
7Type=oneshot
8ExecStart=/srv/seafile/seafile/seafile-server-latest/seafile.sh start
9ExecStop=/srv/seafile/seafile/seafile-server-latest/seafile.sh stop
10RemainAfterExit=yes
11User=seafile
12Group=nogroup
13
14[Install]
15WantedBy=multi-user.target
16EOF
1sudo systemctl start seafile
2sudo systemctl status seafile
3sudo systemctl enable seafile
1cat << EOF | sudo tee /etc/systemd/system/seahub.service
2[Unit]
3Description=Seahub server
4After=network.target mysqld.service seafile.service
5
6[Service]
7Type=oneshot
8ExecStart=/srv/seafile/seafile/seafile-server-latest/seahub.sh start-fastcgi
9ExecStop=/srv/seafile/seafile/seafile-server-latest/seahub.sh stop
10RemainAfterExit=yes
11User=seafile
12Group=nogroup
13
14[Install]
15WantedBy=multi-user.target
16EOF
1sudo systemctl daemon-reload
2sudo systemctl start seahub
3sudo systemctl status seahub
4sudo systemctl enable seahub
seafile.conf
1sudo -u seafile -s /bin/sh
2cd $HOME/seafile
3vi conf/seafile.conf
1[fileserver]
2port = 8082
3
4[database]
5type = mysql
6host = 127.0.0.1
7port = 3306
8user = seafile
9password = ***********
10db_name = seafile-db
11connection_charset = utf8
12
13[history]
14# Number of days to keep version history
15keep_days = 30
16
17[library_trash]
18# How often trashed libraries are scanned for removal, default 1 day.
19scan_days = 1
20# How many days to keep trashed libraries, default 30 days.
21expire_days = 30
Desktop Installation
1mkdir /tmp/cower
2cd /tmp/cower
3
4cower -d libsearpc
5cd /tmp/cower/libsearpc
6makepkg -sri
7cower -d ccnet-server
8cd /tmp/cower/ccnet-server
9makepkg -sri
10cower -d ccnet
11cd /tmp/cower/ccnet
12makepkg -sri
13cower -d seafile
14cd /tmp/cower/seafile
15makepkg -sri
16cower -d seafile-client
17cd /tmp/cower/seafile-client
18makepkg -sri
Migrate to Pro version
https://customer.seafile.com/downloads/
https://download.seafile.com/d/XXXXXXXXX/?p=/pro
1sudo pacman -S python2-memcached python2-ldap python-urllib3 poppler python-boto jre7-openjdk
2
3sudo -u seafile -s /bin/sh
4cd $HOME
5wget "https://download.seafile.com/d/XXXXXXXXX/files/?p=/pro/seafile-pro-server_6.0.13_x86-64.tar.gz&dl=1" -O seafile-pro-server_6.0.13_x86-64.tar.gz
6
7mv seafile-pro-server_* seafile
8cd seafile
9tar -xzf seafile-pro-server_*
10mv seafile-pro-server_*.tar.gz installed
11
12cd seafile-pro-server-6.0.13/
13
14vi pro/pro.py
1#!/usr/bin/env python2
1./pro/pro.py setup --migrate
2exit
3sudo systemctl stop seahub
4sudo systemctl stop seafile
5sudo systemctl start seafile
6sudo systemctl start seahub
Two Factor Authentication
- Activate in the admin account
- Enable in each user Settings
Web Resumable File Upload
1sudo -u seafile -s /bin/sh
2cd $HOME/seafile/conf
1vi seahub_settings.py
1ENABLE_RESUMABLE_FILEUPLOAD = True
1exit
2sudo systemctl stop seahub
3sudo systemctl stop seafile
4sudo systemctl start seafile
5sudo systemctl start seahub
Office integration
1sudo pacman -S libreoffice
2
3sudo systemctl stop seahub
4sudo systemctl stop seafile
5sudo systemctl start seafile
6sudo systemctl start seahub
conf/seafevents.conf
1sudo -u seafile -s /bin/sh
2cd $HOME/seafile/conf
1vi seafevents.conf
1[DATABASE]
2type = mysql
3host = 127.0.0.1
4port = 3306
5username = seafile
6password = *****************
7name = seahub-db
8
9[Audit]
10enable = true
11
12[INDEX FILES]
13enabled = true
14interval = 10m
15
16## If true, indexes the contents of office/pdf files while updating search index
17## Note: If you change this option from "false" to "true", then you need to clear the search index and update the index again. See the FAQ for details.
18index_office_pdf = true
19
20## AFTER 6.3
21highlight = fvh
22
23[OFFICE CONVERTER]
24enabled = true
25workers = 1
26
27## how many pages are allowed to be previewed online. Default is 50 pages
28max-pages = 50
29
30## the max size of documents allowed to be previewed online, in MB. Default is 10 MB
31## Previewing a large file (for example >30M) online is likely going to freeze the browser.
32max-size = 10
33
34[SEAHUB EMAIL]
35enabled = true
36
37## interval of sending Seahub email. Can be s(seconds), m(minutes), h(hours), d(days)
38interval = 30m
1exit
2sudo systemctl stop seahub
3sudo systemctl stop seafile
4sudo systemctl start seafile
5sudo systemctl start seahub
Cleanup and Maintenance
1sudo -u seafile -s /bin/sh
2cd $HOME/seafile/seafile-server-latest
- Garbage collection
1./seaf-gc.sh --dry-run
2./seaf-gc.sh
- Check integrity
1./seaf-fsck.sh
2./seaf-fsck.sh --repair
- Clean Database
1./seahub.sh clearsessions
2exit
3mysql -u seafile -p;
4use seahub-db;
5DELETE FROM Event WHERE to_days(now()) - to_days(timestamp) > 90;
Minor version upgrades (like from 5.0.x to 5.1.y)
https://customer.seafile.com/downloads/
https://download.seafile.com/d/XXXXXXXXX/?p=/pro
1sudo systemctl stop seahub
2sudo systemctl stop seafile
3
4sudo -u seafile -s /bin/sh
5cd $HOME
6wget "https://download.seafile.com/d/XXXXXXXXX/files/?p=/pro/seafile-pro-server_6.1.1_x86-64.tar.gz&dl=1" -O seafile-pro-server_6.1.1_x86-64.tar.gz
7
8mv seafile-pro-server_* seafile
9cd seafile
10tar -xzf seafile-pro-server_*
11mv seafile-pro-server_*.tar.gz installed
12
13cd seafile-pro-server-6.1.1/
14ls upgrade/upgrade_*
15upgrade/upgrade_6.0_6.1.sh
16
17exit
18sudo systemctl start seafile
19sudo systemctl start seahub
Maintenance version upgrades (like from 5.1.2 to 5.1.3)
https://customer.seafile.com/downloads/
https://download.seafile.com/d/XXXXXXXXX/?p=/pro
1sudo systemctl stop seahub
2sudo systemctl stop seafile
3
4sudo -u seafile -s /bin/sh
5cd $HOME
6wget "https://download.seafile.com/d/XXXXXXXXX/files/?p=/pro/seafile-pro-server_6.1.4_x86-64.tar.gz&dl=1" -O seafile-pro-server_6.1.4_x86-64.tar.gz
7
8mv seafile-pro-server_* seafile
9cd seafile
10tar -xzf seafile-pro-server_*
11mv seafile-pro-server_*.tar.gz installed
12
13cd seafile-pro-server-6.1.4/
14upgrade/minor-upgrade.sh
15
16exit
17sudo systemctl start seafile
18sudo systemctl start seahub
If you get this error starting: ccnet-server: symbol lookup error: /usr/lib/libnssutil3.so: undefined symbol: PR_GetEnvSecure
1sudo -u seafile -s /bin/sh
2cd $HOME/seafile/seafile-pro-server-6.1.7/seafile/lib
3mv libnspr4.so libnspr4.so.old
Major version upgrades (like from 6 to 7)
https://download.seafile.com/published/support/server-upgrade/pro-7.0.md
1java -version
2 java version "1.7.0_171"
3sudo pacman -S jre8-openjdk
4archlinux-java get
5 java-7-openjdk/jre
6sudo archlinux-java set java-8-openjdk/jre
7java -version
8 openjdk version "1.8.0_212"
9archlinux-java get
10 java-8-openjdk/jre
11
12sudo systemctl stop seahub
13sudo systemctl stop seafile
14
15sudo -u seafile -s /bin/sh
16cd $HOME
17wget "https://download.seafile.com/d/XXXXXXXXX/files/?p=/pro/seafile-pro-server_7.0.3_x86-64.tar.gz&dl=1" -O seafile-pro-server_7.0.3_x86-64.tar.gz
18
19mv seafile-pro-server_* seafile
20cd seafile
21tar -xzf seafile-pro-server_*
22mv seafile-pro-server_*.tar.gz installed
23
24cd seafile-pro-server-7.0.3
25upgrade/upgrade_6.3_7.0.sh
1cd $HOME/seafile/conf
2vi seahub_settings.py
1ENCRYPTED_LIBRARY_VERSION = 3
1vi seafevents.conf
1[FILE HISTORY]
2enabled = true
3suffix = md,txt,ppt,pptx,doc,docx,xls,xlsx
1exit
2sudo systemctl start seafile
3sudo systemctl start seahub