Howto install Seafile + autostart + move to HTTPS with valid certificate

This howto describes the installation of seafile on Nethserver 7.
Installation is fully described on page https://download.seafile.com/published/seafile-manual/deploy/using_mysql.md
My howto adjust some Nethserver specifities.

You will need root access to Mariadb

1. Install dependencies

For Seafile 7.1.x

yum install python python-setuptools MySQL-python python-urllib3 python-ldap -y
pip3 install --timeout=3600 Pillow pylibmc captcha jinja2 sqlalchemy django-pylibmc django-simple-captcha python3-ldap

2. Create installation folder

mkdir /opt/seafile
cd /opt/seafile

3. Download and install

Download server package from https://www.seafile.com/en/download/

tar -xzf seafile-server_*
mkdir installed
mv seafile-server_* installed
cd seafile-server-*
./setup-seafile-mysql.sh  # run the setup script & answer prompted questions
./seahub.sh stop # stop Seahub website
./seafile.sh stop # stop Seafile processes

4. Adjust Firewall

On firewall we need create service object with ports 8000 and 8082

Now create rule to allow Seafile object in firewall.

After all is done, you have running seafile on http://your_server_ip:8000

5. Run seafile after boot

Don´t forget rename your seafileuser.

sudo vim /etc/systemd/system/seafile.service
[Unit]

Description=Seafile

# add mysql.service or postgresql.service depending on your database to the line below
After=network.target mysqld.service

[Service]

Type=oneshot
ExecStart=/opt/seafile/seafile-server-latest/seafile.sh start
ExecStop=/opt/seafile/seafile-server-latest/seafile.sh stop
RemainAfterExit=yes

User=seafileuser
Group=seafileuser

[Install]
WantedBy=multi-user.target
sudo vim /etc/systemd/system/seahub.service
[Unit]
Description=Seafile hub

After=network.target seafile.service

[Service]

# 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=seafileuser

Group=seafileuser

Type=oneshot

RemainAfterExit=yes

[Install]

WantedBy=multi-user.target
systemctl enable seafile.service
systemctl enable seahub.service

6. Enable https

Stop seafile service:

cd / opt/ seafile/seafile-server-latest/

./seafile.sh stop

./seahub.sh stop

Create new virtual host under Web server section

Request new certificate for you server.

Reverse proxy

nano /etc/e-smith/templates-custom/etc/httpd/conf.d/virtualhosts.conf/15_seafile

<VirtualHost *:443>

ServerName seafile.mycompany.sk

DocumentRoot /var/www

SSLEngine On

SSLCertificateFile /etc/letsencrypt/live/seafile.mycompany.sk/cert.pem

SSLCertificateKeyFile /etc/letsencrypt/live/seafile.mycompany.sk/privkey.pem

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]

#

# seahub

#

SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1

ProxyPreserveHost On

ProxyPass / http://127.0.0.1:8000/

ProxyPassReverse / http://127.0.0.1:8000/

</VirtualHost>

Modify settings

In this step when I changed ccnet.conf and seahub_settings.py, seafile was not running on https. I need also change settings in webpage of seafile under System admin section.

Ccnet.conf

SERVICE_URL = https://seafile.mycompany.sk

seahub_settings.py

FILE_SERVER_ROOT = 'https://www.myseafile.com/seafhttp'

Start Seafile

./seafile.sh start
./seahub.sh start

All done.

4 Likes

Thank you @Miko10 , going to try this soon!
(Because of the PHP requirements of nextcloud) I have been looking around for a web-based file sharing solution for arm-installations.
And never had the guts to take Seafile on…

Question up front:
Is there some kind of integration with the nethserver’s user-accounts?

If you talk about Nextcloud/Nethserver user account, Seafile is able to connect to LDAP
https://download.seafile.com/published/seafile-manual/deploy/using_ldap.md

But I don´t use it.

1 Like