Ubuntu18.04 搭建开源Seafile云存储

Ubuntu18.04 搭建开源Seafile云存储

Seafile 是一个开源的文件云存储平台,解决文件集中存储、同步、多平台访问的问题,注重安全和性能,支持 Windows, Mac, Linux, iOS, Android 平台。支持文件同步或者直接挂载到本地访问。html

Seafile 包含如下系统组件: Seahub:网站界面,供用户管理本身在服务器上的数据和帐户信息。 Seafile服务器经过"gunicorn"(一个轻量级的Python HTTP服务器)来提供网站支持。Seahub做为gunicorn的一个应用程序来运行。 Seafile server (seaf-server): 数据服务进程, 处理原始文件的上传/下载/同步。 Ccnet server (ccnet-server): 内部 RPC 服务进程,链接多个组件。 Controller: 监控 ccnet 和 seafile 进程,必要时会重启进程。python

在这里插入图片描述 不知道有没有了解过Seafile,我也本身在Ubuntu下(固然Linux也能够)搭建了一下,发现是真的好用,不过有两个版本,一个免费版,虽然功能限制,但基本使用问题不大,要什么自行车哈;一种是专业版,最多支持三个用户使用,功能仍是很是齐全的,若是你是一个大企业,用户比较多的状况下,Seafile仍是国内的仍是要支持一下的,建议使用专业版服务器。官方提供两种部署方法一个Linux下,一个Ubuntu下,还能够在docker下部署,具体看我的状况吧!下面是我在Ubuntu部署的,期间也把官方有的没有的看不懂问题解释一下!!git

部署Seafile的用到的连接github

官方文档:https://cloud.seafile.com/published/seafile-manual-cn/overview/components.md 服务器手册中文版:https://www.seafile.com/download/ 下载服务器安装包:https://www.seafile.com/download/ 下载服务器专业版pro:https://download.seafile.com/d/6e5297246c/?p=/pro 安装onlyoffice在线编辑http://www.zhuodown.com/a/luyouqi/2020/0424/35965.htmlweb

若是你感受太麻烦,还可使用脚本安装。但脚本都是默认生成的用户名,密码,配置sql

1、部署 Seafile 服务器(使用 MySQL/MariaDB)若是安装使用SQLite,详见官方文档(部署目录结构 注意:这里建立目录名称无所谓,新建一个放里边就行。目的是用于管理,以及后续的升级)docker

mkdir haiwen
mv seafile-server_* haiwen
cd haiwen
  #将 seafile-server_* 移动到 haiwen 目录下后
tar -xzf seafile-server_*
mkdir installed
mv seafile-server_* installed

目录大体是这样子:数据库

#tree . -L 2
.
├── installed
│   └── seafile-server_1.4.0_x86-64.tar.gz
└── seafile-server-1.4.0
    ├── reset-admin.sh
    ├── runtime
    ├── seafile
    ├── seafile.sh
    ├── seahub
    ├── seahub.sh
    ├── setup-seafile.sh
    └── upgrade

2、安装前的准备工做 (注意:专业版7.1.X以上必须把python升级到3以上,看清楚下载的版本,避免出错) Seafile 7.0.xapache

#on Debian/Ubuntu 14.04 server
apt-get update
apt-get install python2.7 libpython2.7 python-setuptools python-imaging python-ldap python-urllib3 sqlite3
#on Ubuntu 16.04 server
#As the default python binary on Ubuntu 16.04 server is python 3, we need to install python (python 2) first.
apt-get update
apt-get install python
apt-get install python2.7 libpython2.7 python-setuptools python-imaging python-ldap python-urllib3 ffmpeg python-pip sqlite3
pip install pillow moviepy
#on CentOS 7
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 7.1 或者以上版本django

#on Debian 10/Ubuntu 18.04

apt-get update
apt-get install python3 python3-setuptools python3-pip python3-ldap -y

pip3 install --timeout=3600 Pillow pylibmc captcha jinja2 sqlalchemy psd-tools django-pylibmc django-simple-captcha
#on CentOS 8
yum install python3 python3-setuptools python3-pip python3-ldap -y

pip3 install --timeout=3600 Pillow pylibmc captcha jinja2 sqlalchemy psd-tools django-pylibmc django-simple-captcha

3、安装

cd seafile-server-*
./setup-seafile.sh           #运行安装脚本并回答预设问题

若是你的系统中没有安装上面的某个软件,那么 Seafile初始化脚本会提醒你安装相应的软件包.。(注意:若是没有MySQL库,还须要安装库,后续建立seafile用户会用到MySQL的root密码)该脚本会依次询问你一些问题,从而一步步引导你配置 Seafile 的各项参数: 在这里, 你会被要求选择一种建立 Seafile 数据库的方式:

Please choose a way to initialize seafile databases:


[1] Create new ccnet/seafile/seahub databases
[2] Use existing ccnet/seafile/seahub databases
............................................

若是选择1, 你须要提供根密码. 脚本程序会建立数据库和用户。 若是选择2, ccnet/seafile/seahub 数据库应该已经被你(或者其余人)提早建立。 若是安装正确完成,你会看到下面这样的输出 (新版本可能会有所不一样)

4、得到许可证书 (注意:专业版获取证书才能支持3人以上使用) 将您获得的许可证书放在顶层目录下。好比,在这篇文档页面里,咱们把 /data/haiwen/ 做为顶层目录。

5、启动 Seafile 服务器和 Seahub 网站 在 seafile-server-latest 目录下,运行以下命令

启动 Seafile:
./seafile.sh start # 启动 Seafile 服务
启动 Seahub
./seahub.sh start  # 启动 Seahub 网站 (默认运行在127.0.0.1:8000端口上)

注意:7.0.x 版本以后,8000端口默认监听在127.0.0.1地址上,这意味着您没法直接经过8000端口访问Seafile服务。建议您配置apache反向代理。

启用Apache反向代理模块

sudo a2enmod rewrite proxy_http

启用代理功能

sudo a2enmod rewrite proxy_http

增长防火墙规则

sudo ufw allow 8000
sudo ufw allow 8082

修改代理配置

cd /etc/apache2/sites-enabled
sudo cp 000-default.conf 000-default.conf.bak
sudo vim 000-default.conf

修改以下:

<VirtualHost *:80>
  # ServerName www.myseafile.com 
  ServerAdmin webmaster@localhost
  DocumentRoot /var/www/html
  Alias /media  /home/demo/haiwen/seafile-server-latest/seahub/media
  RewriteEngine On

  <Location /media>
   Require all granted
  </Location>

  #
  # seafile fileserver
  #
  ProxyPass /seafhttp http://127.0.0.1:8082
  ProxyPassReverse /seafhttp http://127.0.0.1:8082
  RewriteRule ^/seafhttp - [QSA,L]

  #
  # seahub
  #
  SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
  ProxyPass / http://127.0.0.1:8000/
  ProxyPassReverse / http://127.0.0.1:8000/
  
  ErrorLog ${APACHE_LOG_DIR}/error.log
  CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

修改完毕后重启apache服务

sudo /etc/init.d/apache2 restart

至此,已经能够用web登录Seafile。 恭喜! 如今你已经成功的安装了 Seafile 服务器. 若是你不想在默认的 8000 端口上运行 Seahub, 而是想自定义端口(好比8001)中运行,请按如下步骤操做: 6.3.0 及其以后的版本,咱们弃用了 ./seahub.sh start <port> 的方式使seahub进程监听在其余端口。可是,您能够经过修改 conf/gunicorn.conf 中的端口设置来指定seahub启动端口。 修改conf/gunicorn.conf

#default localhost:8000
bind = "0.0.0.0:8001"

重启 Seafile 服务器

./seafile.sh start # 启动 Seafile 服务
./seahub.sh start # 启动 Seahub 网站

部署过程当中若是遇到解决不了的问题,好比后边的在线文档,全文检索、集群等等,的均可以私信交流!!

相关文章
相关标签/搜索