部署专业的开源云存储平台Seafile

本文介绍在CentOS6系列下使用MySQL部署Seafile服务器

1.下载服务器版本的安装包


  • 可以在这个页面中下载最新的服务器安装包 Seafile官方下载页面

  • 也可以使用wget命令直接下载:

wget http://download-cn.seafile.com/seafile-server_4.4.1_x86-64.tar.gz

2.创建服务根目录


mkdir -p /FileCloud/installed
cd /FileCloud/installed
wget http://download-cn.seafile.com/seafile-server_4.4.1_x86-64.tar.gz
tar -xvzf seafile-server_4.4.1_x86-64.tar.gz

3.依赖包


3.1升级Python

默认的Python为2.6.6版本,这里将其升级至2.7以上版本

升级Python过程详见此篇文档

3.2 依赖包

安装MySQL服务并开机自启动

yum install mysql-server
service mysqld start
chkconfig mysqld on

为MySQL中的的root用户设置密码

mysql -u root
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('password');
mysql> quit

其他依赖包的安装

yum install MySQL-python python-setuptools python-imaging

4.安装Seafile组件


cd /FileCloud/installed/seafile-server-4.4.1
./setup-seafile-mysql.sh

进入到文本交互界面,如下仅供参考:

Press ENTER to continue
Enter

What is the name of the server? It will be displayed on the client.
3 - 15 letters or digits
[ server name ] xxFileCloud

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.3.131

Where do you want to put your seafile data?
Please use a volume with enough free space
[ default "/FileCloud/installed/seafile-data" ] Enter

Which port do you want to use for the seafile fileserver?
[ default "8082" ] Enter

------------------------------------------------------------------
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" ] Enter

What is the port of mysql server?
[ default "3306" ] Enter

What is the password of the mysql root user?
[ root password ] "root's password of mysql"

verifying password of user root ...  done

Enter the name for mysql user of seafile. It would be created if not exists.
[ default "root" ] `Enter`

Enter the database name for ccnet-server:
[ default "ccnet-db" ] `Enter`

Enter the database name for seafile-server:
[ default "seafile-db" ] `Enter`

Enter the database name for seahub:
[ default "seahub-db" ] `Enter`

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

    server name:            xxFileCloud
    server ip/domain:       192.168.3.131

    seafile data dir:       /FileCloud/installed/seafile-data
    fileserver port:        8082

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

------------------------------------------------------------------
Press ENTER to continue, or Ctrl-C to abort
------------------------------------------------------------------
Generating ccnet configuration ...

done
Successly create configuration dir /kfc/installed/ccnet.
Generating seafile configuration ...

Done.
done
Generating seahub configuration ...

-------------------------------------------------------------
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.

开启Seafile服务


设置打开文件描述符的最大数量

ulimit -n 65535
echo "ulimit -n 65535" >> /etc/rc.local

启动 Seafile 服务器和 Seahub 网站

  • 启动Seafile服务

cd /FileCloud/installed/seafile-server-4.4.1 && ./seafile.sh start

[root@localhost seafile-server-4.4.1]# ./seafile.sh start

Starting seafile server, please wait ...
Seafile server started

Done.
  • 启动Seahub服务(不加端口号默认运行在8000端口,可改配置文件)

cd /FileCloud/installed/seafile-server-4.4.1 && ./seahub.sh start 80

[root@kfc seafile-server-4.4.1]# ./seahub.sh start 80

LC_ALL is not set in ENV, set to en_US.UTF-8
Starting seahub at port 80 ...

----------------------------------------
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 ] polarsnow@20150509.cn  #这里的账号最好填写能收到邮件的邮箱用于忘记密码后找回密码使用

What is the password for the admin account?  #这里的密码是自定义的Seafile的密码
[ admin password ] 

Enter the password again:
[ admin password again ] 



----------------------------------------
Successfully created seafile admin
----------------------------------------




Seahub is started

Done.

PS:你第一次启动 seahub 时,seahub.sh 脚本会提示你创建一个 seafile 管理员帐号

访问云存储页面


使用浏览器打开http://192.168.3.131输入刚刚创建的用户名的密码即可。

Seafile的关闭和重启


关闭

./seahub.sh stop # 停止 Seahub
./seafile.sh stop # 停止 Seafile 进程

重启

./seafile.sh restart # 停止当前的 Seafile 进程,然后重启 Seafile
./seahub.sh restart  # 停止当前的 Seahub 进程,并在 8000 端口重新启动 Seahub

在另一端口上运行 Seahub


如果你不想在默认的 8000 端口上运行 Seahub, 而是想自定义端口(比如8001)中运行,请按以下步骤操作:

  • 关闭 Seafile 服务器
./seahub.sh stop # 停止 Seafile 进程
./seafile.sh stop # 停止 Seahub
更改haiwen/ccnet/ccnet.conf文件中SERVICE_URL 的值(假设你的 ip 或者域名时192.168.1.100), 如下:
SERVICE_URL = http://192.168.1.100:8001
  • 重启 Seafile 服务器
./seafile.sh start # 启动 Seafile 服务
./seahub.sh start 8001 # 启动 Seahub 网站 (运行在8001端口上)

如果停止/重启的脚本运行失败


大多数情况下 seafile.sh seahub.sh 脚本可以正常工作。如果遇到问题:

使用pgrep命令检查 seafile/seahub 进程是否还在运行中

pgrep -f seafile-controller # 查看 Seafile 进程
pgrep -f "manage.py run_gunicorn" # 查看 Seahub 进程

使用pkill命令杀掉相关进程

pkill -f seafile-controller # 结束 Seafile 进程
pkill -f "manage.py run_gunicorn" # 结束 Seafile 进程

The End


  • 至此你已经成功掌握了Seafile最基本的搭建和使用
  • 本文参考Seafile官方文档搭建Seafile官网
  • 如需下载客户端,可登陆Seafile官网进行下载

also you can connnect me: polarsnow@20150509.cn

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 157,198评论 4 359
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 66,663评论 1 290
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 106,985评论 0 237
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 43,673评论 0 202
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 51,994评论 3 285
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 40,399评论 1 211
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 31,717评论 2 310
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 30,407评论 0 194
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 34,112评论 1 239
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 30,371评论 2 241
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 31,891评论 1 256
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 28,255评论 2 250
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 32,881评论 3 233
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 26,010评论 0 8
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 26,764评论 0 192
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 35,412评论 2 269
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 35,299评论 2 260

推荐阅读更多精彩内容