部署专业的开源云存储平台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  | stop | restart  }

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

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: [email protected]

你可能感兴趣的:(部署专业的开源云存储平台Seafile)