开源的云存储软件其实不少,我也先后测试了好几款,最后确认Seafile是目前性能最佳、功能较全、安装最方便的。感谢海文互知团队令人钦佩的工作成果! 搭建指南 1. Docker环境
Docker运行的基本需求是Linux x64,内核版本2.6.32-431或更高版本。具体请按照你的系统参考官方文档。
本例中我使用的Docker版本是1.6.1,docker version运行结果如下。
root@iZ255y3f595Z:/home# docker version
Client version: 1.6.0
Client API version: 1.18
Go version (client): go1.4.2
Git commit (client): 4749651
OS/Arch (client): linux/amd64
Server version: 1.6.0
Server API version: 1.18
Go version (server): go1.4.2
Git commit (server): 4749651
OS/Arch (server): linux/amd642. 拉取jenserat/seafile镜像
jenserat/seafile镜像(查看详情)包含了Seafile运行的依赖环境和一些方便的脚本,使用docker pull jenserat/seafile:latest拉取该镜像的最新版本。下载完成后输入docker images命令可以查看下载到的镜像:
root@iZ255y3f595Z:/home# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
jenserat/seafile latest 8ef4348733ff 5 weeks ago 325.3 MB3. 下载Seafile
jenserat/seafile镜像中包含了下载Seafile的脚本,可惜其文件托管在Amazon ECS上,国内无法正常访问。
所以我们需要从官方网站上手动下载,撰写本文时最高版本是4.1.2。存放进一个目录并将Seafile解压缩,注意保证此目录所在分区有足够空间(其实也不用太在意,之后空间不足后可以很方便的迁移)。本例中我们把Seafile存放在/home/app/seafile。
root@iZ255y3f595Z:/home/app/seafile# ls -l
total 19836
-rw-r--r-- 1 root root 20308273 May 5 17:17 seafile-server_4.1.2_x86-64.tar.gz
root@iZ255y3f595Z:/home/app/seafile# tar -zxf seafile-server_4.1.2_x86-64.tar.gz
root@iZ255y3f595Z:/home/app/seafile# ls -l
total 19840
drwxrwxr-x 6 500 500 4096 Mar 29 08:35 seafile-server-4.1.2
-rw-r--r-- 1 root root 20308273 May 5 17:17 seafile-server_4.1.2_x86-64.tar.gz4. 配置
使用如下命令启动一个Docker容器来配置Seafile,注意将/home/app/seafile换成你的目录。
docker run -t -i --rm -p 10001:10001 -p 12001:12001 -p 8000:8000 -p 8080:8080 -p 8082:8082 -v /home/app/seafile:/opt/seafile jenserat/seafile -- /bin/bash容器启动后看到如下输出:
*** Running /etc/my_init.d/00_regen_ssh_host_keys.sh...
*** Running /etc/rc.local...
*** Booting runit daemon...
*** Runit started as PID 9
*** Running /bin/bash...
root@635064a090b9:/# May 10 08:37:40 635064a090b9 syslog-ng[20]: syslog-ng starting up; version='3.5.3'下面我们在容器中运行setup-seafile.sh脚本后按提示进行配置,本例中我们配置为通过域名sf.disksing.com访问,各种端口一路回车用默认的就行,因为我们可以在启动Docker容器时设置端口映射。
root@635064a090b9:/# cd /opt/seafile/seafile-server-4.1.2/
root@635064a090b9:/opt/seafile/seafile-server-4.1.2# ./setup-seafile.sh
You are running this script as ROOT. Are you sure to continue?
[yes|no] yes
-----------------------------------------------------------------
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 sugguest you setup seafile server using MySQL.
Press [ENTER] to continue
-----------------------------------------------------------------
Checking packages needed by seafile ...
Checking python on this machine ...
Find python: python2.7
Checking python module: setuptools ... Done.
Checking python module: python-imaging ... Done.
Checking python module: python-sqlite3 ... Done.
Checking for sqlite3 ...Done.
Checking Done.
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
What is the ip or domain of this server?
For example, www.mycompany.com, or, 192.168.1.101
[This server's ip or domain] : sf.disksing.com
What tcp port do you want to use for ccnet server?
10001 is the recommended port.
[default: 10001 ]
Where would you like to store your seafile data?
Note: Please use a volume with enough free space.
[default: /opt/seafile/seafile-data ]
What tcp port would you like to use for seafile server?
12001 is the recommended port.
[default: 12001 ]
What tcp port do you want to use for seafile fileserver?
8082 is the recommended port.
[default: 8082 ]
This is your config information:
server name: disksing
server ip/domain: sf.disksing.com
server port: 10001
seafile data dir: /opt/seafile/seafile-data
seafile port: 12001
fileserver port: 8082
If you are OK with the configuration, press [ENTER] to continue.
Generating ccnet configuration in /opt/seafile/ccnet...
done
Successly create configuration dir /opt/seafile/ccnet.
Generating seafile configuration in /opt/seafile/seafile-data ...
Done.
-----------------------------------------------------------------
Seahub is the web interface for seafile server.
Now let's setup seahub configuration. Press [ENTER] to continue
-----------------------------------------------------------------
Creating seahub database now, it may take one minute, please wait...
Done.
creating seafile-server-latest symbolic link ... done
-----------------------------------------------------------------
Your seafile server configuration has been completed successfully.
-----------------------------------------------------------------
run seafile server: ./seafile.sh { start | stop | restart }
run seahub server: ./seahub.sh { start <port> | stop | restart <port> }
-----------------------------------------------------------------
If the server is behind a firewall, remember to open these tcp ports:
-----------------------------------------------------------------
port of ccnet server: 10001
port of seafile server: 12001
port of seafile fileserver: 8082
port of seahub: 8000
When problems occur, refer to
https://github.com/haiwen/seafile/wiki
for more information.配置完成后启动Seafile的两个服务测试,seafile是文件管理引擎,seahub提供网页访问服务。seahub首次启动时会要求提供管理员邮箱及密码:
root@635064a090b9:/opt/seafile/seafile-server-4.1.2# ./seafile.sh start
Starting seafile server, please wait ...
Seafile server started
Done.
root@635064a090b9:/opt/seafile/seafile-server-4.1.2# ./seahub.sh start
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 ] admin@disksing.com
What is the password for the admin account?
[ admin password ]
Enter the password again:
[ admin password again ]
----------------------------------------
Successfully created seafile admin
----------------------------------------