seafile的安装

一:简介

    Seafile 是一款开源的企业云盘,注重可靠性和性能。支持 Windows, Mac, Linux, iOS, Android 平台。支持文件同步或者直接挂载到本地访问

二:安装相关依赖包

1.系统环境:centos7.6
2.系统所需的环境依赖包

  • MariaDB 或者 MySQL 服务器 (MariaDB 是 MySQL 的分支)
  • python 2.7 (从 Seafile 5.1 开始,python 版本最低要求为2.7)
  • python-setuptools
  • python-imaging
  • python-mysqldb
  • python-ldap
  • python-urllib3
  • python-memcache (或者 python-memcached)
yum -y install epel-release
rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
yum -y install python-imaging MySQL-python python-memcached python-ldap python-urllib3 ffmpeg ffmpeg-devel
pip install pillow moviepy

三:安装seafile

1.创建文件目录并下载解压安装包

#seafile会在其安装包同级目录下创建其他多个文件夹,最好是新建一个文件进行存放
mkdir /usr/local/seaflie
cd /usr/local/seaflie
wget http://seafile-downloads.oss-cn-shanghai.aliyuncs.com/seafile-server_7.0.2_x86-64.tar.gz
tar -zxvf seafile-server_7.0.2_x86-64.tar.gz
cd seafile-server-7.0.2
./setup-seafile-mysql.sh

2.填写相关服务器的参数

#所需填的参数,
#按回车键
-----------------------------------------------------------------
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 suggest you setup seafile server using MySQL.

Press [ENTER] to continue
-----------------------------------------------------------------
#填写服务器名字(大小写字母,数字,-,长度3-15位)
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]:

#填写服务器绑定的域名或者服务器ip地址
What is the ip or domain of this server?
For example, www.mycompany.com, or, 192.168.1.101
[This server is ip or domain]: 127.0.0.1

#填写网盘存放文件的目录,由于里面存放的是文件数据比较大,所以需要找个比较大点的盘
Where would you like to store your seafile data? 
Note: Please use a volume with enough free space.
[default: /root/seafile/seafile-data ]

#ftp传输的端口号,默认是8082,用来上传或者下载文件
What tcp port do you want to use for seafile fileserver?
8082 is the recommended port.

3.填写数据库参数

#1.创建新的数据库,2.使用现有的数据库
-------------------------------------------------------                                 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 ] 1

#2.填写数据库服务器的地址
What is the host of mysql server?
[ default "localhost" ]

#3.设置哪台主机有权访问这个数据库,默认是都可以访问
From which hosts could the mysql account be used?
[ default "%" ]

#4.mysql的端口号,默认是3306
What is the port of mysql server?
[ default "3306" ]

#5.输入数据库root管理员的密码,用来创建先关的数据库信息
What is the password of the mysql root user?
[ root password ]

#6.新建seafile数据库的普通用户,并给新建的数据库用户设置密码
Enter the name for mysql user of seafile. It would be created if not exists.
[ default "seafile" ]
[ password for seafile ]

#7.创建相关的3个数据库
Enter the database name for ccnet-server:
[ default "ccnet-db" ]
Enter the database name for seafile-server:
[ default "seafile-db" ]
Enter the database name for seahub:
[ default "seahub-db" ]

4.他会让你确认下安装信息,同意按enter,要修改则按ctrl+c

5.启动和关闭seafile
./seahub.sh start|stop
./seafile.sh start|stop

6.开启防火墙的相关端口(如果用nginx等反向代理则不用)
firewall-cmd --zone=public --add-port=8082/tcp --permanent
firewall-cmd --zone=public --add-port=8000/tcp --permanent

四:用nginx做反向代理

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 $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;
         error_log       /var/log/nginx/seahub.error.log;
    }
    location /seafhttp {
        rewrite ^/seafhttp(.*)$ $1 break;
#注意,这个地址最好用netstat -nlpt确认下,填错可能会导致文件无法正常上传或者下载
        proxy_pass http://127.0.0.1:8082;
#Nginx 默认设置 "client_max_body_size" 为 1M。如果上传文件大于这个值的话,会报错,相关 HTTP 状态码为 423 ("Request Entity Too Large"). 你可以将值设为 0 以禁用此功能.
        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;
#如果要上传大于 4GB 的文件,默认情况下 Nginx 会把整个文件存在一个临时文件中,然后发给上游服务器 (seaf-server),这样容易出错。使用 1.8.0 以上版本同时在 Nginx 配置文件中设置以下内容能解决这个问题:
        proxy_request_buffering off;
    }
    location /media {
#seafile的安装目录
        root /home/user/haiwen/seafile-server-latest/seahub;
    }
}

五:seafile系统配置

这里面根据实际情况进行配置,不然可能会导致文件无法上传或者下载
seafile的安装_第1张图片

六:游览器后自动结束cookie

默认情况下,关闭游览器是不会自动借宿会话请求的,此时可以更改seahub_settings.py的参数,添加
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
注意:可能需要清理缓存seahub_settings.pyc,并重启服务才会生效

七:onlyoffice集成

# Enable Only Office
ENABLE_ONLYOFFICE = True
VERIFY_ONLYOFFICE_CERTIFICATE = False
ONLYOFFICE_APIJS_URL = 'http{s}://{your OnlyOffice server's domain or IP}/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')

然后重启服务

官方参考资料:https://manual-cn.seafile.com/deploy/deploy_with_nginx.html

你可能感兴趣的:(#,web建站,centos7)