概述:
- Linux 下部署 Seafile 服务器
- 部署 Seafile 服务器(使用 MySQL)
官方链接:
系统实例:
- Linux ×64 centos7.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)
操作流程:
官方链接首页 -> 下载页面 ->选择服务器端(桌面同步客户端、挂载盘客户端、移动客户端、服务器端) -> 点击下载最新7.0.2 64bit (seafile-server_7.0.2_x86-64.tar.gz)->点击访问文档见 Seafile 服务器手册
也可以在下载页面的右下方下载PDF文件手册
部署过程:
./setup-seafile-mysql.sh
Checking python on this machine ...
Checking python module: python-mysqldb ... Done.
-----------------------------------------------------------------
This script will guide you to setup your seafile server using MySQL.
Make sure you have read seafile server manual at
https://github.com/haiwen/seafile/wiki
Press ENTER to continue
-----------------------------------------------------------------
What is the name of the server? It will be displayed on the client.
3 - 15 letters or digits
[ server name ] webserver
What is the ip or domain of the server?
For example: www.mycompany.com, 192.168.1.101
[ This server's ip or domain ] 192.168.1.166
Where do you want to put your seafile data?
Please use a volume with enough free space
[ default "/opt/seafile/seafile-data" ] /opt/seafile/seafile-data
Which port do you want to use for the seafile fileserver?
[ default "8082" ] 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
What is the host of mysql server?
[ default "localhost" ] localhost
What is the port of mysql server?
[ default "3306" ] 3306
What is the password of the mysql root user?
[ root password ]
verifying password of user root ... done
Enter the name for mysql user of seafile. It would be created if not exists.
[ default "seafile" ] seafile
Enter the password for mysql user "seafile":
[ password for seafile ]
Enter the database name for ccnet-server:
[ default "ccnet-db" ] ccnet-db
Enter the database name for seafile-server:
[ default "seafile-db" ]
Enter the database name for seahub:
[ default "seahub-db" ] seahub-db
---------------------------------
This is your configuration
---------------------------------
server name: webserver
server ip/domain: 192.168.1.166
seafile data dir: /opt/seafile/seafile-data
fileserver port: 8082
database: create new
ccnet database: ccnet-db
seafile database: seafile-db
seahub database: seahub-db
database user: seafile
---------------------------------
Press ENTER to continue, or Ctrl-C to abort
---------------------------------
[root@webserver seafile-server-7.0.2]# ./setup-seafile-mysql.sh
Checking python on this machine ...
Checking python module: python-mysqldb ... Done.
-----------------------------------------------------------------
This script will guide you to setup your seafile server using MySQL.
Make sure you have read seafile server manual at
https://github.com/haiwen/seafile/wiki
Press ENTER to continue
-----------------------------------------------------------------
What is the name of the server? It will be displayed on the client.
3 - 15 letters or digits
[ server name ] webserver
What is the ip or domain of the server?
For example: www.mycompany.com, 192.168.1.101
[ This server's ip or domain ] 192.168.1.166
Where do you want to put your seafile data?
Please use a volume with enough free space
[ default "/opt/seafile/seafile-data" ]
Which port do you want to use for the seafile fileserver?
[ default "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
What is the host of mysql server?
[ default "localhost" ] 192.168.1.166
From which hosts could the mysql account be used?
[ default "%" ]
What is the port of mysql server?
[ default "3306" ]
What is the password of the mysql root user?
[ root password ]
verifying password of user root ... done
Enter the name for mysql user of seafile. It would be created if not exists.
[ default "seafile" ] root
Using mysql "root" user is not allowed for security reasons. Please specify a different database user.
Enter the name for mysql user of seafile. It would be created if not exists.
[ default "seafile" ]
Enter the password for mysql user "seafile":
[ password for seafile ]
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" ]
---------------------------------
This is your configuration
---------------------------------
server name: webserver
server ip/domain: 192.168.1.166
seafile data dir: /opt/seafile/seafile-data
fileserver port: 8082
database: create new
ccnet database: ccnet-db
seafile database: seafile-db
seahub database: seahub-db
database user: seafile
---------------------------------
Press ENTER to continue, or Ctrl-C to abort
---------------------------------
Generating ccnet configuration ...
done
Successly create configuration dir /opt/seafile/ccnet.
Generating seafile configuration ...
Done.
done
Generating seahub configuration ...
----------------------------------------
Now creating ccnet database tables ...
----------------------------------------
----------------------------------------
Now creating seafile database tables ...
----------------------------------------
----------------------------------------
Now creating seahub database tables ...
----------------------------------------
creating seafile-server-latest symbolic link ... done
-----------------------------------------------------------------
Your seafile server configuration has been finished successfully.
-----------------------------------------------------------------
run seafile server: ./seafile.sh { start | stop | restart }
run seahub server: ./seahub.sh { start <port> | stop | restart <port> }
-----------------------------------------------------------------
If you are behind a firewall, remember to allow input/output of these tcp ports:
-----------------------------------------------------------------
port of seafile fileserver: 8082
port of seahub: 8000
When problems occur, Refer to
https://github.com/haiwen/seafile/wiki
for information.
[root@webserver seafile-server-7.0.2]# ./seahub.sh
Usage:
seahub.sh { start <port> | stop | restart <port> }
To run seahub in fastcgi:
seahub.sh { start-fastcgi <port> | stop | restart-fastcgi <port> }
<port> is optional, and defaults to 8000
[root@webserver seafile-server-7.0.2]#
[root@webserver seafile-server-7.0.2]# ./seahub.sh start
LC_ALL is not set in ENV, set to en_US.UTF-8
Starting seahub at port 8000 ...
----------------------------------------
It's the first time you start the seafile server. Now let's create the admin account
----------------------------------------
What is the email for the admin account?
[ admin email ]
What is the email for the admin account?
[ admin email ]
What is the email for the admin account?
[ admin email ] ***@163.com
What is the password for the admin account?
[ admin password ]
Enter the password again:
[ admin password again ]
----------------------------------------
Successfully created seafile admin
----------------------------------------
Seahub is started
Done.
浏览器访问失败问题解决:
1、编辑配置文件
vi /opt/seafile/conf/gunicorn.conf
由之前的
bind = "127.0.0.1:8000" 改为 bind = "0.0.0.0:8000"
2、查看进程和端口情况,默认查找 8082和8000
ps -ef | grep seafile
netstat -tunlp
3、停止服务
./opt/seafile/seafile-server-7.0.2/seafile.sh stop
./opt/seafile/seafile-server-7.0.2/seahub.sh stop
4、启动服务
./opt/seafile/seafile-server-7.0.2/seafile.sh start
./opt/seafile/seafile-server-7.0.2/seahub.sh start
5、重新查看进程和端口情况
tcp 0 0 0.0.0.0:8082 0.0.0.0:* LISTEN 16664/seaf-server
tcp 0 0 0.0.0.0:8000 0.0.0.0:* LISTEN 16709/python2.7
6、浏览器访问
http://ip:8000/
user:***@163.com
pwd:123456
常见问题解决
1、./seahub.sh start 启动失败原因,如下图:
经过多番排查研究,最终确定 未安装 MySQL-python
问题排查过程:
运行命令 ./seahub.sh start-fastcgi
报MySQL相关问题,然后查看是否与安装时没有安装MySQL相关软件,
运行命令: rpm -qa | grep python-mysqldb
又执行了下安装脚本: ./setup-seafile-mysql.sh
发现果不其然确实没有安装
按照提示执行安装命令: sudo yum install MySQL-python
启动命令:./seahub.sh start 大功告成