以下是官方教程:最后附上特别注意事项
部署 Seafile 服务器(使用 MySQL/MariaDB)
部署和目录设计
假设你公司的名称为 haiwen, 你也已经下载 seafile-server_1.4.0_* 到你的 home 目录下。 我们建议这样的目录结构:
mkdir haiwen
mv seafile-server_* haiwen
cd haiwen
#将 seafile-server_* 移动到 haiwen 目录下后
tar -xzf seafile-server_*
mkdir installed
mv seafile-server_* installed
现在,你的目录看起来应该像这样:
#tree haiwen -L 2
haiwen
├── installed
│ └── seafile-server_1.8.2_x86-64.tar.gz
└── seafile-server-1.8.2
├── reset-admin.sh
├── runtime
├── seafile
├── seafile.sh
├── seahub
├── seahub.sh
├── setup-seafile.sh
└── upgrade
这样设计目录的好处在于
-
和 seafile 相关的配置文件都可以放在 haiwen 目录下,便于集中管理.
-
后续升级时,你只需要解压最新的安装包到 haiwen 目录下.
安装 Seafile 服务器
安装前的准备工作
安装 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)
# 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 python-mysqldb python-memcache
pip install pillow moviepy
# on CentOS 7
yum -y install epel-release
yum -y install python-imaging MySQL-python python-memcached python-ldap python-urllib3 ffmpeg ffmpeg-devel
pip install pillow moviepy
安装
cd seafile-server-*
./setup-seafile-mysql.sh #运行安装脚本并回答预设问题
如果你的系统中没有安装上面的某个软件,那么 Seafile初始化脚本会提醒你安装相应的软件包.
该脚本会依次询问你一些问题,从而一步步引导你配置 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 数据库应该已经被你(或者其他人)提前创建。
如果安装正确完成,你会看到下面这样的输出 (新版本可能会有所不同)
现在你的目录结构看起来应该是这样:
#tree haiwen -L 2
haiwen
├── conf # configuration files
│ ├── ccnet.conf
│ └── seafile.conf
│ └── seahub_settings.py
│ └── seafdav.conf
├── ccnet
│ ├── mykey.peer
│ ├── PeerMgr
│ └── seafile.ini
├── installed
│ └── seafile-server_1.8.2_x86-64.tar.gz
├── seafile-data
├── seafile-server-1.8.2 # active version
│ ├── reset-admin.sh
│ ├── runtime
│ ├── seafile
│ ├── seafile.sh
│ ├── seahub
│ ├── seahub.sh
│ ├── setup-seafile.sh
│ └── upgrade
├── seafile-server-latest # symbolic link to seafile-server-1.8.2
├── seahub-data
│ └── avatars
seafile-server-latest
文件夹为指向当前 Seafile 服务器文件夹的符号链接. 将来你升级到新版本后, 升级脚本会自动更新使其始终指向最新的 Seafile 服务器文件夹.
启动 Seafile 服务器
启动 Seafile 服务器和 Seahub 网站
在 seafile-server-latest 目录下,运行如下命令
-
启动 Seafile:
./seafile.sh start # 启动 Seafile 服务
-
启动 Seahub
./seahub.sh start # 启动 Seahub 网站 (默认运行在8000端口上)
小贴士: 你第一次启动 seahub 时,seahub.sh
脚本会提示你创建一个 seafile 管理员帐号。
服务启动后, 打开浏览器并输入以下地址:
http://192.168.1.111:8000/
你会被重定向到登陆页面. 输入管理员用户名和密码即可。
(注意:7.0.x 版本之后,8000端口默认监听在127.0.0.1地址上,这意味着您无法直接通过8000端口访问Seafile服务。)
恭喜! 现在你已经成功的安装了 Seafile 服务器.
特别注意:上面一行红字的意思是“现在你只能在本地服务器通过http://127.0.0.1:8000访问”,接下来要改一个文件才能通过地址访问。
修改安装目录下的conf/gunicorn.conf文件
改过之后:
bind = "0.0.0.0:8000"
#原来是:bind = "127.0.0.1:8000"