The following isDocker installation SeafileDetailed steps covering basic installation and common configurations:
1. Preparation
Install Docker and Docker Compose
- Make sure the system is installedDockerandDocker Compose。
Create a working directory
mkdir ~/seafile && cd ~/seafile
2. Use official simplified mirrors
Seafile provides precompiled simplified Docker images for fast testing and small-scale use.
1. Pull the mirror
docker pull seafile/seafile:latest
2. Run the container (basic version)
# Run Seafile core service (SQLite database storage)docker run -d \ --name seafile \ -p 8000:8000 \ -v ~/seafile/data:/data \ seafile/seafile:latest
-
-p 8000:8000
: Map the 8000 port of the container to the host. -
-v ~/seafile/data:/data
: Mount data volumes, persistent storage of files and databases.
3. Access the web interface
- Browser access
http://localhost:8000
, the first visit will guide the creation of an administrator account.
3. Recommended production environment solution (Nginx + PostgreSQL)
1. Pull component image
# Seafile Core Servicesdocker pull seafile/seafile:latest # Nginx reverse proxydocker pull nginx:alpine # PostgreSQL Databasedocker pull postgres:14
2. Create a configuration file
mkdir -p ~/seafile/conf/nginx && mkdir -p ~/seafile/conf/postgresql # PostgreSQL initialization script (create database and user)cat <<EOF > ~/seafile/conf/postgresql/ CREATE DATABASE seafile; CREATE USER seafile WITH PASSWORD 'your_password'; GRANT ALL PRIVILEGES ON DATABASE seafile TO seafile; EOF #Nginx configuration file ()cat <<EOF > ~/seafile/conf/nginx/ server { listen 80; server_name your_domain.com; location / { proxy_pass http://seafile:8000; proxy_set_header Host \$host; proxy_set_header X-Real-IP \$remote_addr; } } EOF
3. Run the container
# Start the PostgreSQL databasedocker run -d \ --name postgres \ -p 5432:5432 \ -v ~/seafile/conf/postgresql:/ \ -e POSTGRES_PASSWORD=your_password \ postgres:14 # Start Seafile Core Service (Connect PostgreSQL)docker run -d \ --name seafile \ -p 8000:8000 \ -v ~/seafile/data:/data \ -e DB_HOST=postgres \ -e DB_PORT=5432 \ -e DB_USER=seafile \ -e DB_PASSWORD=your_password \ seafile/seafile:latest # Start Nginx reverse proxydocker run -d \ --name nginx \ -p 80:80 \ -v ~/seafile/conf/nginx:/etc/nginx/ \ nginx:alpine
4. Configure HTTPS (recommended)
1. Obtain an SSL certificate
Use Let’s Encrypt Free Certificate:
# Install certbot and nginx-certbotsudo apt-get install certbot python3-certbot-nginx # Generate a certificatesudo certbot certonly --non-interactive --agree-tos --email your_email@ \ --domain your_domain.com --nginx
2. Update Nginx configuration
Add the generated certificate path to the Nginx configuration:
server { listen 443 ssl; server_name your_domain.com; ssl_certificate /etc/letsencrypt/live/your_domain.com/; ssl_certificate_key /etc/letsencrypt/live/your_domain.com/; location / { proxy_pass http://seafile:8000; ... } }
5. Data backup and recovery
1. Backup the data volume
# Backup Seafile datadocker exec seafile tar czvf /data/backup_$(date +%F). /data/ # Backup PostgreSQL datadocker exec postgres pg_dumpall -U seafile -f /data/postgres_backup.sql
2. Recover data
# Recover Seafile datadocker exec seafile tar xzvf /path/to/backup_*. -C /data/ # Recover PostgreSQL datadocker exec postgres psql -U seafile -d seafile < /path/to/postgres_backup.sql
6. Frequently Asked Questions
1. The web interface cannot be accessed
- Check port mapping:
docker ps
confirm8000
Whether the port is open. - View container log:
docker logs seafile
.
2. Database connection failed
- make sure
DB_HOST
、DB_PORT
、DB_USER
、DB_PASSWORD
correct. - Check if the PostgreSQL container is running:
docker ps | grep postgres
.
3. File synchronization exception
- Ensure that client and server time is consistent.
- Check firewall rules, open
8000
and443
port.
7. Advanced configuration (optional)
- Distributed Storage: Add multiple storage nodes to improve throughput.
- LDAP Integration: Use an enterprise user directory (such as Active Directory).
- Monitoring alarm: Integrated Prometheus + Grafana to monitor Seafile performance.
With the above steps, you can quickly deploy Seafile in Docker and configure it as a production environment. If you encounter any problems, please refer toSeafile official documentationGet more support.
The above is personal experience. I hope you can give you a reference and I hope you can support me more.