Hello everyone,
A FreeNAS user has messaged me requesting assistance on installing Seafile in a FreeBSD jail. Instead of keeping the setup private, I decided to post the process here to assist anyone else that may have an issue. I run this process before every minor and major version update to verify everything is working properly and hopefully this will help anyone else run Seafile without issues.
Before getting started, one thing that needs to be clarified is that net-mgmt/seafile-server is not the complete Seafile applet. www/seahub is the application most people are wanting. Installing www/seahub provides the full Seafile server application, including web frontend. Seafile-server is simply a dependency and by itself isn't very useful.
This guide only covers the SQLite setup. I do not suggest using MySQL unless you understand why one would use MySQL over SQLite. If you do understand, then I doubt you will need help with the MySQL route.
At the time of writing this, the most current version of seafile-server is 6.2.5 and Seahub is 6.2.12. This guide expects the user to know how to create a FreeBSD jail and will begin chrooted inside the jail in a shell.
Seafile/Seahub is now successfully installed.
At this point, Seafile and Seahub are setup and running properly. (probably =) The next step is setting up an http server. The docs can be followed on this part for setting up Nginx or Apache24, but I will provide a Nginx config as it is what I use.
You should now be able to access the Seafile server by opening your browser and going to.... http://seafile.example.com or http://<<my ip>>
This setup works for http, but I suggest using https for security, which this guide will not cover. There are plenty of guides and docs that provide the setup for https.
At this point you should be able to see the Seafile website and check out some of the features, however, its likely that uploading and downloading are broken. To fix this, you must fix a few settings in the admin area. Click on the top right avatar and get the drop-down menu. Next, Click System Admin. On the left the menu collum will have a few option, click settings. The SERVICE_URL should be set to the url http://seafile.example.com or http://<<my ip>> and FILE_SERVER_ROOT set to http://seafile.example.com/seafhttp or http://<<my ip>>/seafhttp
When changing to https, this will need to be changed again.
Seafile is now completely installed and working! congratulations! now go setup https and enjoy this great application.
A FreeNAS user has messaged me requesting assistance on installing Seafile in a FreeBSD jail. Instead of keeping the setup private, I decided to post the process here to assist anyone else that may have an issue. I run this process before every minor and major version update to verify everything is working properly and hopefully this will help anyone else run Seafile without issues.
Before getting started, one thing that needs to be clarified is that net-mgmt/seafile-server is not the complete Seafile applet. www/seahub is the application most people are wanting. Installing www/seahub provides the full Seafile server application, including web frontend. Seafile-server is simply a dependency and by itself isn't very useful.
This guide only covers the SQLite setup. I do not suggest using MySQL unless you understand why one would use MySQL over SQLite. If you do understand, then I doubt you will need help with the MySQL route.
At the time of writing this, the most current version of seafile-server is 6.2.5 and Seahub is 6.2.12. This guide expects the user to know how to create a FreeBSD jail and will begin chrooted inside the jail in a shell.
root@111amd64-test:~ # pkg info
pkg-1.10.5_1 Package manager
root@111amd64-test:~ # uname -a
FreeBSD 111amd64-test 11.1-RELEASE-p9 FreeBSD 11.1-RELEASE-p9 amd64
root@111amd64-test:~ # date
Thu May 31 04:50:53 UTC 2018
# pkg install seahub
...truncated...
Number of packages to be installed: 106
The process will require 386 MiB more space.
Proceed with this action? [y/N] y
...truncated...
Message from seahub-6.2.12:
To generate a new config,
cd /usr/local/www/haiwen/seafile-server
Then choose sqlite or mysql, mysql needs to be setup with root.
sqlite: ./setup-seafile.sh
mysql: ./setup-seafile-mysql.sh
Further instructions will be provided after the setup script is finished.
If a new config is created, run this to setup admin.
/usr/local/www/haiwen/seafile-server/reset-admin.sh
Don't forget to run update scripts after every minor and major update located in
/usr/local/www/haiwen/seafile-server/upgrade
Patch updates (5.1.x) don't require these scripts, however do required a restarted.
root@111amd64-test:~ # cd /usr/local/www/haiwen/seafile-server
root@111amd64-test:/usr/local/www/haiwen/seafile-server # ./setup-seafile.sh
-----------------------------------------------------------------
This script will guide you to config and setup your seafile server.
Make sure you have read seafile server manual at
https://github.com/haiwen/seafile/wiki
Note: This script will guide your to setup seafile server using sqlite3,
which may have problems if your disk is on a NFS/CIFS/USB.
In these cases, we sugguest you setup seafile server using MySQL.
Press [ENTER] to continue
-----------------------------------------------------------------
Checking packages needed by seafile ...
Checking python on this machine ...
Find python: python2.7
Checking python module: setuptools ... Done.
Checking python module: python-imaging ... Done.
Checking python module: python-sqlite3 ... Done.
Checking for sqlite3 ...Done.
Checking Done.
What would you like to use as the name of this seafile server?
Your seafile users will be able to see the name in their seafile client.
You can use a-z, A-Z, 0-9, _ and -, and the length should be 3 ~ 15
[server name]: Seafile
What is the ip or domain of this server?
For example, www.mycompany.com, or, 192.168.1.101
[This server's ip or domain]: seafile.example.com
Where would you like to store your seafile data?
Note: Please use a volume with enough free space.
[default: /usr/local/www/haiwen/seafile-data ]
What tcp port do you want to use for seafile fileserver?
8082 is the recommended port.
[default: 8082 ]
This is your config information:
server name: Seafile
server ip/domain: seafile.example.com
seafile data dir: /usr/local/www/haiwen/seafile-data
fileserver port: 8082
If you are OK with the configuration, press [ENTER] to continue.
Generating ccnet configuration in /usr/local/www/haiwen/ccnet...
done
Successly create configuration dir /usr/local/www/haiwen/ccnet.
Generating seafile configuration in /usr/local/www/haiwen/seafile-data ...
Done.
-----------------------------------------------------------------
Seahub is the web interface for seafile server.
Now let's setup seahub configuration. Press [ENTER] to continue
-----------------------------------------------------------------
Creating seahub database now, it may take one minute, please wait...
Done.
creating seafile-server-latest symbolic link ... done
-----------------------------------------------------------------
Your seafile server configuration has been completed successfully.
-----------------------------------------------------------------
run seafile server: sysrc seafile_enable=YES
service seafile { start | stop | restart }
run seahub server: sysrc seahub_enable=YES
fastcgi (optional): sysrc seahub_fastcgi=1
service seahub { start | stop | restart }
run reset-admin: ./reset-admin.sh
-----------------------------------------------------------------
If the server is behind a firewall, remember to open these tcp ports:
-----------------------------------------------------------------
port of seafile fileserver: 8082
port of seahub: 8000
When problems occur, refer to
https://github.com/haiwen/seafile/wiki
for more information.
root@111amd64-test:/usr/local/www/haiwen/seafile-server # sysrc seafile_enable=YES
seafile_enable: -> YES
root@111amd64-test:/usr/local/www/haiwen/seafile-server # sysrc seahub_enable=YES
seahub_enable: -> YES
root@111amd64-test:/usr/local/www/haiwen/seafile-server # service seafile start
[05/31/18 05:13:36] ../common/session.c(132): using config file /usr/local/www/haiwen/conf/ccnet.conf
Starting seafile server, please wait ...
Seafile server started
root@111amd64-test:/usr/local/www/haiwen/seafile-server # service seahub start
LANG is not set in ENV, set to en_US.UTF-8
LC_ALL is not set in ENV, set to en_US.UTF-8
Starting seahub at port 8000 ...
Seahub is started
root@111amd64-test:/usr/local/www/haiwen/seafile-server # ./reset-admin.sh
E-mail address: ultima@FreeBSD.org
Password:
Password (again):
Superuser created successfully.
Seafile/Seahub is now successfully installed.
At this point, Seafile and Seahub are setup and running properly. (probably =) The next step is setting up an http server. The docs can be followed on this part for setting up Nginx or Apache24, but I will provide a Nginx config as it is what I use.
root@111amd64-test:~ # pkg install nginx
Updating local repository catalogue...
pkg: Repository local load error: access repo file(/var/db/pkg/repo-local.sqlite) failed: No such file or directory
[111amd64-test] Fetching meta.txz: 100% 820 B 0.8kB/s 00:01
[111amd64-test] Fetching packagesite.txz: 100% 93 KiB 95.6kB/s 00:01
Processing entries: 100%
local repository update completed. 381 packages processed.
All repositories are up to date.
Updating database digests format: 100%
Checking integrity... done (0 conflicting)
The following 1 package(s) will be affected (of 0 checked):
New packages to be INSTALLED:
nginx: 1.14.0_3,2
Number of packages to be installed: 1
The process will require 1 MiB more space.
Proceed with this action? [y/N]: y
[111amd64-test] [1/1] Installing nginx-1.14.0_3,2...
===> Creating groups.
Using existing group 'www'.
===> Creating users
Using existing user 'www'.
[111amd64-test] [1/1] Extracting nginx-1.14.0_3,2: 100%
Message from nginx-1.14.0_3,2:
===================================================================
Recent version of the NGINX introduces dynamic modules support. In
FreeBSD ports tree this feature was enabled by default with the DSO
knob. Several vendor's and third-party modules have been converted
to dynamic modules. Unset the DSO knob builds an NGINX without
dynamic modules support.
To load a module at runtime, include the new `load_module'
directive in the main context, specifying the path to the shared
object file for the module, enclosed in quotation marks. When you
reload the configuration or restart NGINX, the module is loaded in.
It is possible to specify a path relative to the source directory,
or a full path, please see
https://www.nginx.com/blog/dynamic-modules-nginx-1-9-11/ and
http://nginx.org/en/docs/ngx_core_module.html#load_module for
details.
Default path for the NGINX dynamic modules is
/usr/local/libexec/nginx.
===================================================================
root@111amd64-test:~ # cat /usr/local/etc/nginx/nginx.conf
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
server_tokens off;
server {
listen 80;
listen [::]:80;
server_name seafile.example.com;
root /usr/local/www/nginx;
error_page 500 502 503 504 /50x.html;
location = 50x.html {
root /usr/local/www/nginx-dist;
}
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;
access_log /var/log/nginx/seahub.access.log;
error_log /var/log/nginx/seahub.error.log;
client_max_body_size 0;
}
location /seafhttp {
rewrite ^/seafhttp(.*)$ $1 break;
proxy_pass http://127.0.0.1:8082;
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
client_max_body_size 0;
proxy_connect_timeout 36000s;
proxy_read_timeout 36000s;
proxy_send_timeout 36000s;
send_timeout 36000s;
}
}
}
root@111amd64-test:~ # sysrc nginx_enable=YES
root@111amd64-test:~ # service nginx start
You should now be able to access the Seafile server by opening your browser and going to.... http://seafile.example.com or http://<<my ip>>
This setup works for http, but I suggest using https for security, which this guide will not cover. There are plenty of guides and docs that provide the setup for https.
At this point you should be able to see the Seafile website and check out some of the features, however, its likely that uploading and downloading are broken. To fix this, you must fix a few settings in the admin area. Click on the top right avatar and get the drop-down menu. Next, Click System Admin. On the left the menu collum will have a few option, click settings. The SERVICE_URL should be set to the url http://seafile.example.com or http://<<my ip>> and FILE_SERVER_ROOT set to http://seafile.example.com/seafhttp or http://<<my ip>>/seafhttp
When changing to https, this will need to be changed again.
Seafile is now completely installed and working! congratulations! now go setup https and enjoy this great application.