Centos手动安装Seafile私有云(专业版)

Seafile 搭建可以参照官方服务手册

官方提供两个版本

  • 开源版
  • 专业版

部署方式主要有两种

相关文章

下载专业版安装包

专业版获取方法请咨询官方

登录 用户中心 - Downloads

1

安装MariaDB、Python、Nginx、java

安装Seafile服务器之前,请确认已安装以下软件,对比社区版,多了些内容

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)
#实际上比社区版就多了如下两个
 java 1.7 以上
poppler-utils

执行安装

yum -y install epel-release
yum update
yum -y install java-1.7.0-openjdk mariadb-server nginx poppler-utils python-setuptools
yum -y install python-imaging MySQL-python python-memcached python-ldap python-urllib3 ffmpeg ffmpeg-devel

若提示没有可用没有可用软件包ffmpeg ffmpeg-devel执行以下操作

rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-1.el7.nux.noarch.rpm
yum install -y ffmpeg ffmpeg-devel

继续

pip install pillow moviepy

若提示-bash: pip: 未找到命令,执行以下操作

yum install -y python-pip
pip install --upgrade pip
pip install pillow moviepy

至此依赖安装结束,建议再次执行命令确认没有漏掉

yum -y install java-1.7.0-openjdk mariadb-server nginx poppler-utils python-setuptools python-imaging MySQL-python python-memcached python-ldap python-urllib3 ffmpeg ffmpeg-devel

配置MariaDB

systemctl start mariadb.service
systemctl enable mariadb.service
mysql_secure_installation

按照提示配置

Enter current password for root (enter for none):回车  #初次运行直接回车
Set root password? [Y/n] 回车  #是否设置root用户密码
New password: ******  #设置root用户密码
Re-enter new password: ******  #再输入一次
Remove anonymous users? [Y/n] 回车  #是否删除匿名用户,生产环境建议删除,所以直接回车
Disallow root login remotely? [Y/n] 回车  #是否禁止root远程登录
Remove test database and access to it? [Y/n] 回车  #是否删除test数据库,直接回车
Reload privilege tables now? [Y/n] 回车  #是否重新加载权限表,直接回车

目录设计

mkdir haiwen
cd haiwen
#将之前下载的安装包上传至haiwen目录(scp,winscp随你)
tar -xzf seafile-pro-server_6.2.8_x86-64.tar.gz
mkdir installed
mv seafile-pro-server_* installed

现在,你的目录看起来应该像这样:

yum -y install tree
tree /root/haiwen -L 2

输出目录结构

/root/haiwen
├── installed
│   └── seafile-pro-server_6.2.8_x86-64.tar.gz
└── seafile-pro-server-6.2.8
    ├── check-db-type.py
    ├── check_init_admin.py
    ├── create-db
    ├── migrate.py
    ├── migrate.sh
    ├── migrate-to-ceph.sh
    ├── pro
    ├── reset-admin.sh
    ├── runtime
    ├── seaf-backup-cmd.py
    ├── seaf-backup-cmd.sh
    ├── seaf-encrypt.sh
    ├── seaf-fsck.sh
    ├── seaf-fuse.sh
    ├── seaf-gc.sh
    ├── seaf-gen-key.sh
    ├── seafile
    ├── seafile-background-tasks.sh
    ├── seafile.sh
    ├── seaf-import.sh
    ├── seafobj_migrate.py
    ├── seahub
    ├── seahub-extra
    ├── seahub.sh
    ├── setup-seafile-mysql.py
    ├── setup-seafile-mysql.sh
    ├── setup-seafile.sh
    └── upgrade

9 directories, 22 files

这样设计目录的好处在于

  • seafile相关的配置文件都可以放在haiwen目录下,便于集中管理.
  • 后续升级时,你只需要解压最新的安装包到haiwen目录下.

安装Seafile

cd /root/haiwen/seafile-pro-server-*
./setup-seafile-mysql.sh

安装过程会引导配置Seafile的各项参数

[ server name ]  seafile105
#服务器名称,随意设置

[ This server's ip or domain ]  192.168.1.105
#域名或ip

[ default "/root/haiwen/seafile-data" ]  回车
#设置数据存放目录,默认就好

[ default "8082" ]  回车
#tcp端口,默认8082不能改

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
#选择创建数据库方式,1现在创建,2使用之前创建过的

What is the host of mysql server?
[ default "localhost" ]  回车
#数据库主机,默认就好

What is the port of mysql server?
[ default "3306" ]  回车
#数据库端口,默认就好

what is the password of the mysql root user?
[ root password ]  ******
#数据库root用户的密码

Enter the name for mysql user of seafile. It would be created if not exists.
[ default "seafile" ]  回车
#为数据库seafile创建用户,填写用户名,默认为seafile

Enter the password for mysql user "seafile":
[ password for seafile ]  ******
#为数据库用户seafile设置密码,随意设置,记住就好

Enter the database name for ccnet-server:
[ default "ccnet-db" ]  回车
#设置ccnet-server数据库名称,默认默认就好

Enter the database name for seafile-server:
[ default "seafile-db" ]  回车
#设置seafile-server数据库名称,默认就好

Enter the database name for seahub:
[ default "seahub-db" ]  回车
#设置seahub数据库名称,默认就好

---------------------------------
This is your configuration
---------------------------------

server name:            seafile105
server ip/domain:       192.168.1.105

seafile data dir:       /root/haiwen/seafile-data
fileserver port:        8082

database:               create new
ccnet database:         ccnet-db
seafile database:       seafile-db
seahub database:        seahub-db
database user:          seafile

#输出设置详情,回车继续安装,直至结束

配置防火墙

systemctl start firewalld
systemctl enable firewalld
firewall-cmd --zone=public --add-port=8000/tcp --permanent
firewall-cmd --zone=public --add-port=8082/tcp --permanent
firewall-cmd --reload

启动Seafile、Seahub服务

./seafile.sh start
./seahub.sh start

在执行./seafile.sh start时会输出

** Message: seafile-controller.c(1124): loading seafdav config from /var/www/haiwen/conf/seafdav.conf

[02/06/18 15:30:08] ../common/session.c(139): using config file /var/www/haiwen/conf/ccnet.conf
[02/06/18 15:30:08] ../common/license.c(440): Loading license file /var/www/haiwen/seafile-license.txt ..
[02/06/18 15:30:08] ../common/license.c(443): License file /var/www/haiwen/seafile-license.txt does not exist, allow at most 3 trial users
License file /var/www/haiwen/seafile-license.txt does not exist, allow at most 3 trial users
Starting seafile server, please wait ...
** Message: seafile-controller.c(1124): loading seafdav config from /var/www/haiwen/conf/seafdav.conf

Seafile server started

Done.

这段话的意思是指

seafile 专业版的授权文件不存在,最多允许3用户。

在执行seahub.sh过程中,会被要求设置seafile管理员帐号(邮箱注册)、密码。

What is the email for the admin account?
[ admin email ] [email protected]
#输入管理员邮箱

What is the password for the admin account?
[ admin password ] ******
#管理员密码
Enter the password again:
[ admin password again ] ******
#再次输入密码

完成后,可以在浏览器打开服务器地址192.168.1.105:8000,进行测试。

2

设置开机启动

需要先停止seafileseahub

./seafile.sh stop
./seahub.sh stop

创建seafile服务

vi /etc/systemd/system/seafile.service

内容如下

[Unit]
Description=Seafile
# add mysql.service or postgresql.service depending on your database to the line below
Before=seahub.service
After=network.target mariadb.service

[Service]
Type=oneshot
ExecStart=/root/haiwen/seafile-server-latest/seafile.sh start
ExecStop=/root/haiwen/seafile-server-latest/seafile.sh stop
RemainAfterExit=yes
# User 和 Group 如果未建立seafile用户和用户组,则修改为root,否则无法启动.
User=root
Group=root

[Install]
WantedBy=multi-user.target

创建seahub服务

vi /etc/systemd/system/seahub.service

内容如下

[Unit]
Description=Seafile hub
After=network.target seafile.service mariadb.service

[Service]
# change start to start-fastcgi if you want to run fastcgi
ExecStart=/root/haiwen/seafile-server-latest/seahub.sh start
ExecStop=/root/haiwen/seafile-server-latest/seahub.sh stop
User=root
Group=root
Type=oneshot
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

保存退出

使配置生效

systemctl daemon-reload
systemctl start seafile
systemctl enable seafile
systemctl start seahub
systemctl enable seahub