树莓派基于seafile搭建私有云网盘

摘要:

网盘是现在人们生活中经常使用的互联网工具。大家经常可能需要使用到百度网盘,微云,onedrive等等。这些网盘大多数用户体验不好,一个是网盘上传和下载限速,另一个是空间提供有限。

在家庭和工作中,我们或者一个小的团队经常在一个局域网内办公和工作,不可避免的要使用到共享文件等服务。此时我们可以来搭建一个局域网内的私有网盘。

目前有一些开源平台提供了私有网盘搭建的服务,比如seafile、nextcloud等。关于seafile(https://baike.baidu.com/item/seafile/14688048?fr=aladdin),可以进行跨平台使用。我们在电脑上,安卓手机上都可以使用这个服务。关于nextcloud,有兴趣的朋友可以尝试搭建。

在我的实验室中,有一个树莓派。所以,我尝试在树莓派上搭建基于seafile的私有网盘,下面开始实操了。

步骤1:更新源和安装python环境

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install python2.7 libpython2.7 python-setuptools python-pil python-ldap python-urllib3 sqlite3 python-requests

步骤2:下载seafile的linux包

当前目录为:/home/pi:

sudo mkdir seafile
sudo wget https://github.com/haiwen/seafile-rpi/releases/download/v6.2.5/seafile-server_6.2.5_stable_pi.tar.gz
sudo tar -xzf seafile-server_6.2.5_stable_pi.tar.gz

步骤3:执行seafile安装程序

cd seafile-server-6.2.5
sudo ./setup-seafile.sh

其中的安装过程如下:后面的工作目录都在/home/pi/seafile-server-6.2.5/

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
[server name]: zhdisk
# seafile服务器的名字,自己按规则起一个就行了
 
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]: 192.168.1.60
# 树莓派机器的IP或域名,我这里是局域网内,所以为局域网的IP地址。
 
Where would you like to store your seafile data?
Note: Please use a volume with enough free space.
[default: /home/pi/seafile/seafile-data ]
# seafile数据的存放位置,按照默认即可
 
What tcp port do you want to use for seafile fileserver?
8082 is the recommended port.
[default: 8082 ]
# seafile服务器的端口号,默认8082
 
This is your config information:
 
server name:        zhdisk
server ip/domain:   192.168.1.60
seafile data dir:   /home/pi/seafile/seafile-data
fileserver port:    8082
 
If you are OK with the configuration, press [ENTER] to continue.
# 这里确认你的seafile服务器配置,没问题继续回车
 
Generating ccnet configuration in /home/pi/seafile/ccnet...
 
done
Successly create configuration dir /home/pi/seafile/ccnet.
 
Generating seafile configuration in /home/pi/seafile/seafile-data ...
 
Done.
 
-----------------------------------------------------------------
Seahub is the web interface for seafile server.
Now let's setup seahub configuration. Press [ENTER] to continue
-----------------------------------------------------------------
# 这里开始安装seahub,回车继续
 
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 seafile fileserver:   8082
port of seahub:               8000
 
When problems occur, refer to
 
      https://github.com/haiwen/seafile/wiki
 
for more information.

步骤3:启动seafile服务和seahub服务

#./seafile.sh start
 
[07/05/18 13:58:26] ../common/session.c(132): using config file /home/pi/seafile/conf/ccnet.conf
Starting seafile server, please wait ...
Seafile server started
 
Done.
#./seahub.sh start
 
LC_ALL is not set in ENV, set to en_US.UTF-8
./seahub.sh: line 209: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8): No such file or directory
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 ] xxxxxx@126.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.

步骤4:设置开机自启动seafile服务和seahub服务

创建脚本:seafile_start.sh

#sudo vim seafile_start.sh

#seafile_start.sh 写入以下内容
sudo ./seafile.sh start
sudo ./seahub.sh start

在/etc/rc.local中添加启动脚本

sudo vim /etc/rc.local

#添加内容 注意 在 exit 0这一行之前 否则不会执行

cd /home/pi/seafile-server-6.2.5/
sudo ./seafile_start.sh

步骤五:验证

windows端:打开浏览器,输入http://192.168.1.60:8000,其中192.168.1.60换成相应的IP

安卓端:应用市场搜索seafile云盘,下载应用。配置服务器IP,账户,密码,即可使用。

 

参考文献:

http://blog.bossma.cn/raspberrypi/raspberry-3b-plus-deploy-personal-cloud-storage-seafile/

(我是参考这个写的,修改了一些错误,添加了自己的一些其他理解和操作)

https://manual.seafile.com/build_seafile/rpi.html

(官网的搭建过程,很麻烦)

已标记关键词 清除标记
相关推荐
©️2020 CSDN 皮肤主题: 像素格子 设计师:CSDN官方博客 返回首页