8.2.14 Deploying and Configuring Seafile on a Server

The Host Banner SeaFile

Seafile is a high-performance, open-source file synchronization and collaboration platform. It enables you to deploy your own cloud storage solution—similar to Dropbox or Google Drive—with full control over your data.

Advantages of Seafile

  • High performance with support for large files;
  • Client-side and server-side encryption;
  • Collaboration and fine-grained access control;
  • File versioning and recovery;
  • Clients available for all major platforms.

Variables

This article uses variables that must be replaced with your own values.

  • <PASSWORD> – your secure password
  • INIT_SEAFILE_MYSQL_ROOT_PASSWORD — a strong root password
  • SEAFILE_MYSQL_DB_PASSWORD — password for the seafile DB user
  • SEAFILE_SERVER_HOSTNAME — domain or IP-address to access Your web interface
  • JWT_PRIVATE_KEY — generate with pwgen -s 40 1
  • INIT_SEAFILE_ADMIN_EMAIL and INIT_SEAFILE_ADMIN_PASSWORD — admin login credentials

Server Preparation

Requirements

Important: Be sure to install Docker before starting.

Seafile installation

Create a directory to store configuration files:

mkdir /opt/seafile
cd /opt/seafile

Download the environment and Docker Compose files:

wget -O .env https://manual.seafile.com/12.0/repo/docker/ce/env
wget https://manual.seafile.com/12.0/repo/docker/seadoc.yml
wget https://manual.seafile.com/12.0/repo/docker/ce/seafile-server.yml
wget https://manual.seafile.com/12.0/repo/docker/caddy.yml

wget

Edit the .env file:

nano .env

Set the following values:

  • INIT_SEAFILE_MYSQL_ROOT_PASSWORD — a strong root password;
  • SEAFILE_MYSQL_DB_PASSWORD — password for the seafile DB user;
  • SEAFILE_SERVER_HOSTNAME — your domain or IP address;
  • JWT_PRIVATE_KEY — generate with pwgen -s 40 1;
  • INIT_SEAFILE_ADMIN_EMAIL and INIT_SEAFILE_ADMIN_PASSWORD — admin login credentials.

Note: Make sure all required fields are filled in correctly.

Seafile configure

Launch Seafile in detached mode:

sudo docker compose up -d

dockercomposeup

Containers that will be created:

  • seafile-mysql
  • seafile
  • seafile-caddy (proxy / certificates)

Configure MySQL Access

By default, the seafile DB user is only accessible from inside the container. To allow remote access:

sudo docker exec -it seafile-mysql mysql -u root -p

MySQL

After entering the INIT_SEAFILE_MYSQL_ROOT_PASSWORD, run the following SQL:

CREATE USER 'seafile'@'%' IDENTIFIED BY '<PASSWORD>';
GRANT ALL PRIVILEGES ON *.* TO 'seafile'@'%';
FLUSH PRIVILEGES;
EXIT;

Exit the container:

exit

Initialize Seafile

Enter the seafile container:

sudo docker exec -it seafile bash

execseafile

Navigate to the server directory:

cd /opt/seafile/seafile-server-12.0.14

Start the setup script:

./setup-seafile-mysql.sh

serverconfseafile

During the wizard, specify:

  • Server name (arbitrary label);
  • IP or domain (must match SEAFILE_SERVER_HOSTNAME);
  • Seafile port — default is 8082;
  • MySQL host: seafile-mysql;
  • MySQL port: 3306;
  • MySQL user: seafile;
  • MySQL password: same as in .env;
  • Choose to create new databases ([1]).

initseafiledatabases

After completion, you will see confirmation that databases and configuration were created successfully.

successinstallation

Create Admin and Start Services

While still in the same directory, run:

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

On first launch, you will be prompted to create an admin account:

  1. Enter INIT_SEAFILE_ADMIN_EMAIL
  2. Enter INIT_SEAFILE_ADMIN_PASSWORD

successcreateadmin.png

After successful creation, press Ctrl+C to stop Seahub for further tuning.

Verifying Operation

To monitor all Seafile logs (outside the container), run:

sudo tail -f /opt/seafile-data/seafile.log

Open in your browser:

http://<SEAFILE_SERVER_HOSTNAME>/

Seafile welcome

Common Issues
Problem Cause Solution
Seafile won’t start Invalid .env or DB connection Check environment values and volume permissions
502 Bad Gateway Seahub not running Run docker logs seafile-server, restart if needed
Upload limit error Proxy config (Nginx/Caddy) Add client_max_body_size 0; in your proxy config
SMTP error Invalid email config Check seahub_settings.py and network connectivity