Installing Seafile on Ubuntu 24.04 Virtual Machine and Configuring OnlyOffice on Windows
Environment Setup
The setup involves Windows Server 2019 hosting OnlyOffice with MySQL 5.7 configured for Seafile's database. A virtual machine running Ubuntu 24.04 Server Edition hosts Seafile, as Ubuntu 22.04 installation methods are incompatible.
Seafile operates without Nginx initially (though Nginx was later added). Files are stored via shared folders from Windows rather than within the VM.
Installing Seafile
-
System Preparation
- Ubuntu 24.04 virtual machine installed with SSH server only for remote access.
- MySQL 5.7 already installed on the Windows host.
- Downloaded Seafile Pro Server version 11.0.6 for Linux (64-bit) from the official site.
-
Extract Installation Package
mkdir -p /opt/seafile/installed mv seafile-pro-server_* /opt/seafile/installed cd /opt/seafile/installed tar -xzf seafile-pro-server_* -C /opt/seafile -
Install Dependencies
sudo apt-get update sudo apt-get install -y python3 python3-dev python3-setuptools python3-pip libmysqlclient-dev ldap-utils libldap2-dev python3.12-venv sudo apt-get install -y memcached libmemcached-dev # Create virtual environment python3 -m venv python-venv source python-venv/bin/activate # Install Python packages pip3 install --timeout=3600 django==4.2.* future==0.18.* mysqlclient==2.1.* \ pymysql pillow==10.2.* pylibmc captcha==0.5.* markupsafe==2.0.1 jinja2 sqlalchemy==2.0.18 \ psd-tools django-pylibmc django_simple_captcha==0.6.* djangosaml2==1.5.* pysaml2==7.2.* pycryptodome==3.16.* cffi==1.16.0 lxml python-ldap==3.4.3 -
Database Configurasion
- Create a dedicated MySQL user:
CREATE USER 'seafile'@'%' IDENTIFIED BY 'seafile'; GRANT ALL PRIVILEGES ON *.* TO 'seafile'@'%'; FLUSH PRIVILEGES; - If using MySQL 8.4+, enable
mysql_native_passwordplugin:[mysqld] mysql_native_password=ON - Update password encryption:
ALTER USER 'seafile'@'%' IDENTIFIED WITH mysql_native_password BY 'seafile'; FLUSH PRIVILEGES; - Create required databases:
CREATE DATABASE `ccnet` CHARACTER SET utf8; CREATE DATABASE `seafile` CHARACTER SET utf8; CREATE DATABASE `seahub` CHARACTER SET utf8;
- Create a dedicated MySQL user:
-
Run Setup Script
cd /opt/seafile/seafile-pro-server_11.0.6 ./setup-seafile-mysql.shChoose option 2 if MySQL is pre-installed and non-local.
-
Post-Installation Steps
- Start services:
cd /opt/seafile/seafile-server-latest ./seafile.sh start ./seahub.sh start - Configure service URLs in the admin panel under "Settings".
- Start services:
-
Configure Shared Storage
- Create directories on Windows:
seafile-dataandseahub-data - Mount these shares in Ubuntu:
sudo apt-get install cifs-utils mount.cifs //192.168.xxx.xxx/seafile-data seafile-data -o user=administrator mount.cifs //192.168.xxx.xxx/seahub-data seahub-data -o user=administrator - Add to
/etc/fstabfor automatic mounting://192.168.xxx.xxx/seafile-data /opt/seafile/seafile-data cifs username=administrator,password=yourpass,iocharset=utf8 0 0 //192.168.xxx.xxx/seahub-data /opt/seafile/seahub-data cifs username=administrator,password=yourpass,iocharset=utf8 0 0
- Create directories on Windows:
Installing OnlyOffice
Install OnlyOffice on Windows Server 2019 with Erlang, RabbitMQ, and PostgreSQL using default settings. Pay special attention to PostgreSQL password configuration during setup.
Integratnig Both Systems
-
Update Seafile Settings In
/opt/seafile/conf/seahub_settings.py:ENABLE_ONLYOFFICE = True VERIFY_ONLYOFFICE_CERTIFICATE = False ONLYOFFICE_APIJS_URL = 'http://192.168.3.110/web-apps/apps/api/documents/api.js' ONLYOFFICE_FILE_EXTENSION = ('doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx', 'odt', 'fodt', 'odp', 'fodp', 'ods', 'fods') ONLYOFFICE_EDIT_FILE_EXTENSION = ('docx', 'pptx', 'xlsx', 'doc', 'xls', 'ppt') ONLYOFFICE_JWT_SECRET = 'your-secret-key' SERVICE_URL = "http://192.168.xxx.xxx:8000/" -
Modify Gunicorn Configuration Change
bind = "127.0.0.1:8000"tobind = "0.0.0.0:8000"in/opt/seafile/conf/gunicorn.conf.py -
Obtain JWT Secret Extract the secret key from
local.jsonin OnlyOffice config folder. -
Adjust OnlyOffice Settings In
default.json, modify:"request-filtering-agent": { "allowPrivateIPAddress": true, "allowMetaIPAddress": true }
Additional Considerations
- MySQL authentication method issues when creating new users
- Incorrect database creation with root user enstead of dedicated user
- Missing port specification in SERVICE_URL causing save errors
- PostgreSQL password setting oversight during installation
- Network restrictions preventing file downloads in OnlyOffice
- Chrome + IDM conflict where editor.bin is mistaken for downloadable file
Memcached and Nginx Configuration
-
Install Memcached
sudo apt install memcached libmemcached-dev -y pip3 install --timeout=3600 pylibmc django-pylibmc sudo systemctl enable --now memcached -
Configure Caching in seahub_settings.py
CACHES = { 'default': { 'BACKEND': 'django_pylibmc.memcached.PyLibMCCache', 'LOCATION': '127.0.0.1:11211', }, } -
Configure Nginx
sudo apt install nginx -y rm /etc/nginx/sites-enabled/default rm /etc/nginx/sites-available/default touch /etc/nginx/sites-available/seafile.confAdd the following content to the config file:
log_format seafileformat '$http_x_forwarded_for $remote_addr [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" $upstream_response_time'; server { listen 80; server_name seafile.example.com; proxy_set_header X-Forwarded-For $remote_addr; location / { proxy_pass http://127.0.0.1:8000; proxy_set_header Host $http_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; client_max_body_size 0; access_log /var/log/nginx/seahub.access.log seafileformat; error_log /var/log/nginx/seahub.error.log; } location /seafhttp { rewrite ^/seafhttp(.*)$ $1 break; proxy_pass http://127.0.0.1:8082; client_max_body_size 0; 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; access_log /var/log/nginx/seafhttp.access.log seafileformat; error_log /var/log/nginx/seafhttp.error.log; } location /media { root /opt/seafile/seafile-server-latest/seahub; } }Enable the site:
ln -s /etc/nginx/sites-available/seafile.conf /etc/nginx/sites-enabled/seafile.confFor large file uploads (>4GB), ensure:
location /seafhttp { ... ... proxy_request_buffering off; }