Dies ist eine alte Version des Dokuments!
How To Configure Seafile Server on Debian 11 / Debian 10 → By Klinsmann Öteyo- December 24, 2021 Modified date: December 24, 202127040
Welcome to this guide on how to install and configure Seafile Server on Debian 11 / Debian 10. Seafile is a self-hosted, open-source, and highly reliable file synchronization and sharing platform. Using Seafile, you can easily share files using the cross-platform syncing and password-protected links with expiration dates. Files can be put in a separate own server and allow other devices to sync and access it.
Features associated with Seafile are:
It is easy to upgrade – upgrading Seafile can be done by running a simple script and takes a few seconds Highly reliable with high performance as it is built in C programming. Drive Client: it allows one to access files in the cloud in local S: drive without syncing them. File Locking File Versioning and Snapshot that allows files and folders to be restored to older versions Easily integrates with other applications. File Sharing and Permission Control It offers backup and data Recovery Cross Platform File Syncing with mobile file access through android and iOS devices. Faster data retrieval and knowledge management. It offers online editing and co-authoring
Getting Started
For this guide, ensure that your system meets the below requirements:
Database server – MySQL / MariaDB server Python Tools HTTP Server – Nginx or Apache
First, we will begin by fulfilling the stated requirements before we dive into the crux of the matter. 1. Install and Configure MariaDB Database Server
In this guide, we will use MariaDB as our database server. MariaDB can be installed on Debian 11 / Debian 10 as below.
sudo apt update sudo apt install mariadb-server mariadb-client
Harden the MariaDB instance on your system.
sudo mysql_secure_installation
Proceed as below.
Enter current password for root (enter for none): Press Enter …. Switch to unix_socket authentication [Y/n] n ……. Change the root password? [Y/n] y New password: Enter Password Re-enter new password: Re-Enter Password …… Remove anonymous users? [Y/n] y … Disallow root login remotely? [Y/n] y … Remove test database and access to it? [Y/n] y …. Reload privilege tables now? [Y/n] y ….. Thanks for using MariaDB!
Now login to the MariaDB shell using the created root password.
$ mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 48 Server version: 10.3.11-MariaDB-1:10.3.11+maria~bionic-log mariadb.org binary distribution
Copyright © 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
We now ant to configure the Seafile database. There are 3 components of Seafile that need their own database:
seafile server ccnet server seahub server
We will proceed and create a database for each of these components as below.
CREATE DATABASE seafile_server; CREATE DATABASE ccnet_server; CREATE DATABASE seahub_server;
Create a Seafile database user with the appropriate grants to the databases above.
CREATE USER 'seafile'@'localhost' IDENTIFIED BY 'Passw0rd'; GRANT ALL ON seafile_server.* TO 'seafile'@'localhost'; GRANT ALL ON ccnet_server.* TO 'seafile'@'localhost'; GRANT ALL ON seahub_server.* TO 'seafile'@'localhost'; QUIT;
Confirm if you can log in using the created Seafile user.
$ mysql -u seafile -pPassw0rd Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 55 Server version: 10.5.12-MariaDB-0+deb11u1 Debian 11
Copyright © 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
On successful login, show available databases:
MariaDB [(none)]> SHOW DATABASES; +——————–+
| Database |
+——————–+
| ccnet_server |
| information_schema |
| seafile_server |
| seahub_server |
+——————–+ 4 rows in set (0.000 sec)
MariaDB [(none)]> QUIT Bye
2. Install Python and Dependencies.
Python and its modules are also required for Seafile to run on Debian 11 / Debian 10.
Install Python and its dependencies on Debian 11 / Debian 10.
sudo apt update sudo apt install python3 python3-{pip,pil,ldap,urllib3,setuptools,mysqldb,memcache,requests} sudo apt install ffmpeg memcached libmemcached-dev sudo pip3 install –upgrade pip sudo pip3 install –timeout=3600 Pillow pylibmc captcha jinja2 sqlalchemy==1.4.3 sudo pip3 install –timeout=3600 django-pylibmc django-simple-captcha python3-ldap mysqlclient
3. Install Seafile Server on Debian 11 / Debian 10
Seafile is downloaded by visiting the official Seafile release page. From the page, download Seafile Server for Linux.
Alternatively, you can download the file using Wget by first exporting the latest version available as below.
export VER=„9.0.2“
Now pull the Seafile archive as below.
wget https://download.seadrive.org/seafile-server_${VER}_x86-64.tar.gz
Once the download is successful, extract the archive and move it to the /srv directory.
tar -xvf seafile-server_${VER}_x86-64.tar.gz sudo mv seafile-server-${VER} /srv/seafile
Now to execute the setup-seafile-mysql.sh script.
cd /srv/seafile/ sudo ./setup-seafile-mysql.sh
Proceed and set up Seafile with MySQL as shown.
Checking python on this machine …
This script will guide you to setup your seafile server using MySQL. Make sure you have read seafile server manual at
https://download.seafile.com/published/seafile-manual/home.md
Press ENTER to continue
What is the name of the server? It will be displayed on the client. 3 - 15 letters or digits [ server name ] seafile-server
What is the ip or domain of the server? For example: www.mycompany.com, 192.168.1.101 [ This server's ip or domain ] seafileserver.example.com Which port do you want to use for the seafile fileserver? [ default „8082“ ]
Please choose a way to initialize seafile databases:
[1] Create new ccnet/seafile/seahub databases [2] Use existing ccnet/seafile/seahub databases
[ 1 or 2 ] 2 What is the host of mysql server? [ default „localhost“ ] Press Enter
What is the port of mysql server? [ default „3306“ ] Press Enter
Which mysql user to use for seafile? [ mysql user for seafile ] seafile What is the password for mysql user „seafile“? [ password for seafile ] Passw0rd
verifying password of user seafile … done
Enter the existing database name for ccnet: [ ccnet database ] ccnet_server
verifying user „seafile“ access to database ccnet_server … done
Enter the existing database name for seafile: [ seafile database ] seafile_server
verifying user „seafile“ access to database seafile_server … done
Enter the existing database name for seahub: [ seahub database ] seahub_server
verifying user „seafile“ access to database seahub_server … done
This is your configuration
server name: seafile-server server ip/domain: seafileserver.example.com
seafile data dir: /srv/seafile-data fileserver port: 8082
database: use existing ccnet database: ccnet_server seafile database: seafile_server seahub database: seahub_server database user: seafile
Press ENTER to continue, or Ctrl-C to abort
Generating ccnet configuration …
Generating seafile configuration …
done Generating seahub configuration …
Now creating ccnet database tables …
Now creating seafile database tables …
Now creating seahub database tables …
creating seafile-server-latest symbolic link … done
Your seafile server configuration has been finished successfully.
run seafile server: ./seafile.sh { start | stop | restart } run seahub server: ./seahub.sh { start <port> | stop | restart <port> }
If you are behind a firewall, remember to allow input/output of these tcp ports:
port of seafile fileserver: 8082 port of seahub: 8000
When problems occur, Refer to
https://download.seafile.com/published/seafile-manual/home.md
for information.
Now Seafile server has been configured to run on port 8082 and the Web UI will be available on port 8000. 4. Manage Seafile Services on Debian 11 / Debian 10
Now we will start the Seafile Server daemon that allows us to upload, download and sync files.
$ cd /srv/seafile $ sudo ./seafile.sh start Starting seafile server, please wait … ** Message: 03:34:20.884: seafile-controller.c(536): No seafevents.
Seafile server started
Done.
Proceed and start the Frontend(Seahub Web Interface)
$ sudo ./seahub.sh start LC_ALL is not set in ENV, set to en_US.UTF-8 Starting seahub at port 8000 …
It's the first time you start the seafile server. Now let's create the admin account
What is the email for the admin account? [ admin email ] admin@techviewleo.com
What is the password for the admin account? [ admin password ] Enter Password here
Enter the password again: Re-Enter Password here [ admin password again ]
Successfully created seafile admin
Seahub is started
Done.
Incase you have any problems with setting the Locale settings, proceed as below.
echo „export LC_ALL=en_US.UTF-8“ »~/.bashrc echo „export LANG=en_US.UTF-8“ »~/.bashrc echo „export LANGUAGE=en_US.UTF-8“ »~/.bashrc source ~/.bashrc
Manage Seafile as a Sytemd Service.
Seafile can be managed just like any other systemd service. This will allow us to start, enable,restart Seafile server.
For the Backend server.
sudo tee /etc/systemd/system/seafile.service«EOF [Unit] Description=Seafile After= mysql.service After=network.target
[Service] Type=forking ExecStart=/srv/seafile-server-latest/seafile.sh start ExecStop=/srv/seafile-server-latest/seafile.sh stop
[Install] WantedBy=multi-user.target EOF
For the Frontend server(Seahub)
sudo tee /etc/systemd/system/seahub.service«EOF [Unit] Description=Seafile After= mysql.service After=network.target
[Service] Type=forking ExecStart=/srv/seafile-server-latest/seahub.sh start ExecStop=/srv/seafile-server-latest/seahub.sh stop
[Install] WantedBy=multi-user.target EOF
The services will fail to start, unless you stop the already running services.
cd /srv/seafile sudo ./seafile.sh stop sudo ./seahub.sh stop
Reload system daemons.
sudo systemctl daemon-reload
Start and enable Seafile and Seahub to run automatically on boot.
sudo systemctl start seafile && sudo systemctl enable seafile sudo systemctl start seahub && sudo systemctl enable seahub
Check the status of seafile:
$ systemctl status seafile ● seafile.service - Seafile
Loaded: loaded (/etc/systemd/system/seafile.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2021-12-08 04:22:13 EST; 10s ago
Process: 13695 ExecStart=/srv/seafile-server-latest/seafile.sh start (code=exited, status=0/SUCCESS)
Main PID: 13713 (seafile-control)
Tasks: 1 (limit: 4663)
Memory: 988.0K
CPU: 65ms
CGroup: /system.slice/seafile.service
└─13713 /srv/seafile/seafile/bin/seafile-controller -c /srv/ccnet -d /srv/seafile-data -F /srv/conf
Dec 08 04:22:10 debian systemd[1]: Starting Seafile… Dec 08 04:22:10 debian seafile.sh[13695]: Starting seafile server, please wait … Dec 08 04:22:10 debian seafile-control[13711]: seafile-controller.c(536): No seafevents. Dec 08 04:22:13 debian seafile.sh[13695]: Seafile server started Dec 08 04:22:13 debian seafile.sh[13695]: Done. Dec 08 04:22:13 debian systemd[1]: Started Seafile.
Also check the status of Seahub.
$ systemctl status seahub ● seahub.service - Seafile
Loaded: loaded (/etc/systemd/system/seahub.service; disabled; vendor preset: enabled)
Active: active (running) since Wed 2021-12-08 04:26:45 EST; 15s ago
Process: 14200 ExecStart=/srv/seafile-server-latest/seahub.sh start (code=exited, status=0/SUCCESS)
Main PID: 14213 (python3)
Tasks: 6 (limit: 4663)
Memory: 58.8M
CPU: 503ms
CGroup: /system.slice/seahub.service
├─14213 python3 /srv/seafile/seahub/thirdpart/bin/gunicorn seahub.wsgi:application -c /srv/conf/gunicorn.conf.py --preload
├─14214 python3 /srv/seafile/seahub/thirdpart/bin/gunicorn seahub.wsgi:application -c /srv/conf/gunicorn.conf.py --preload
├─14215 python3 /srv/seafile/seahub/thirdpart/bin/gunicorn seahub.wsgi:application -c /srv/conf/gunicorn.conf.py --preload
├─14216 python3 /srv/seafile/seahub/thirdpart/bin/gunicorn seahub.wsgi:application -c /srv/conf/gunicorn.conf.py --preload
├─14217 python3 /srv/seafile/seahub/thirdpart/bin/gunicorn seahub.wsgi:application -c /srv/conf/gunicorn.conf.py --preload
└─14218 python3 /srv/seafile/seahub/thirdpart/bin/gunicorn seahub.wsgi:application -c /srv/conf/gunicorn.conf.py --preload
Dec 08 04:26:39 debian systemd[1]: Starting Seafile…
5. Configure Nginx Reverse Proxy
Install Nginx web server on Debian 11 / Debian 10.
sudo apt -y install nginx
Then create a vitualhost file for Seafile server.
sudo vim /etc/nginx/conf.d/seafile.conf
In the file, add the contents below.
server {
listen 80; listen [::]:80; server_name seafileserver.example.com; autoindex off; client_max_body_size 100M; access_log /var/log/nginx/seafile.com.access.log; error_log /var/log/nginx/seafile.com.error.log;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_read_timeout 1200s;
}
location /seafhttp {
rewrite ^/seafhttp(.*)$ $1 break;
proxy_pass http://127.0.0.1:8082;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 36000s;
proxy_read_timeout 36000s;
proxy_send_timeout 36000s;
send_timeout 36000s;
}
location /media {
root /srv/seafile-server-latest/seahub;
}
}
Remove the deafult nginx file
sudo mv /etc/nginx/sites-enabled/default{,.bak}
Restart nginx service by running the following commands:
sudo systemctl restart nginx
6. Access Seafile Web UI
Now proceed and access the Seafile web interface using the URL http://domain_name. You will be granted the login page below.
Enter the set admin username and password and proceed to the Seafile dashboard.
Incase you have a problem “Sorry, but the requested page is unavailable due to a server hiccup” Dont worry, just proceed as below.
sudo systemctl stop seafile sudo systemctl stop seahub sudo rm -rf /tmp/seahub_cache sudo reboot -i
Then proceed and access the dashboard on reboot.
Now you can start adding new files by clicking New Library, give it a name, you can as well encrypt it for added security.
Once the new library has been created, there are several options available for you. You can create and edit PPT, EXCEL, Word files e.t.c 7. Configure Seafile Client
For this guide, I will demonstrate how to configure Seafile client on Debian 11/debian 10. Login to the Debian 11/Debian 10 server and install Seafile client as below.
Firt add the Seafile Client repo.
sudo wget https://linux-clients.seafile.com/seafile.asc -O /usr/share/keyrings/seafile-keyring.asc sudo bash -c „echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/seafile-keyring.asc] https://linux-clients.seafile.com/seafile-deb/focal/ stable main' > /etc/apt/sources.list.d/seafile.list“
Install Seafile client on Debian 11/Debian 10.
sudo apt update sudo apt install -y seafile-gui
The commandline Seafile client can be installed as well using the command:
sudo apt install seafile-cli -y
Now launch the client from the App Menu.
Set the location to store Seafile libraries.
Provide information for the Seafile server to connect to i.e seafile server URL, login username and password
On successful authentication, you will see this:
That is it!