首页
关于本博客
友情链接
推荐
linux/shell
Search
1
LEDE官方固件安装中文语言包的方法
11,087 阅读
2
LEDE固件踢出弱信号客户端,实现WiFi无缝漫游脚本
9,183 阅读
3
基于CloudFlare API的纯Shell动态DNS(DDNS)脚本
8,153 阅读
4
一次OpenVPN交叉编译笔记
6,664 阅读
5
利用iptables的string模块来屏蔽域名(关键词匹配)
6,111 阅读
study
OpenWrt/LEDE
网络技术
数通
HCNP/CCNP
linux
shell
CentOS
Ubuntu/Debian
php
Linux应用
C#
C/C++
虚拟化
IDC
杂项
MySQL
运维笔记
zabbix
seafile
openvpn
QEMU/KVM
windows
html
nginx
互联网应用
IP地址段汇总
登录
Search
标签搜索
nginx
OpenWrt
openvpn
SSH
seafile
cloudflare
iptables
openssl
linux
letsencrypt
CentOS
反向代理
ftp
openvpn配置模板
vsftpd
seafile网盘
Linux启动脚本
ddns
nas
seafile服务器
自渡
累计撰写
75
篇文章
累计收到
1
条评论
首页
栏目
study
OpenWrt/LEDE
网络技术
数通
HCNP/CCNP
linux
shell
CentOS
Ubuntu/Debian
php
Linux应用
C#
C/C++
虚拟化
IDC
杂项
MySQL
运维笔记
zabbix
seafile
openvpn
QEMU/KVM
windows
html
nginx
互联网应用
IP地址段汇总
页面
关于本博客
友情链接
推荐
linux/shell
搜索到
1
篇与
CentOS搭建seafile
的结果
2018-11-24
在CentOS7下搭建私有云存储Seafile服务器
关于私有云存储系统,有基于PHP的OwnCloud,NextCloud等等,然而这些基于PHP的网盘系统,它们的运行效率是远远不及底层基于C语言的seafile,并且在上传大文件时,经常会中断。我个人之前一直是使用NextCloud,在发现Seafile之后,我果断抛弃了它,改用Seafile。Seafile社区版产品特性:1、支持端到端加密技术来保证数据的安全。用户可创建加密数据库,密钥不保存在服务器,所有数据在服务器上均是加密,就算有服务器的root权限也无法读取。2、内核是由C语言编写,运行速度快,并且稳定。3、数据在服务器上被分块存储,支持增量同步。4、支持在线预览mp4电影,支持在线编辑txt、Markdown。安装过程介绍:系统环境操作系统:centos7,不要使用CentOS6,因为涉及到glibc的更新,一不小心可能导致系统崩溃。内存要求:最好是1G以上,因为要用到mysql,如果内存过于低,可能导致mysql进程被系统自动杀死。用到的程序:MySQL/MariaDB,Seafile主程序,nginx(可选)。安装MariaDBSeafile的数据库可以用自行编译的MySQL,这里就不再讲编译MySQL的过程,因为在https://www.zavierlab.com/post/49.html都有说明编译过程。在这里直接使用了yum安装MariaDB。yum -y install mariadb mariadb-server安装完毕后,启动mariadb服务器systemctl start mariadb将mariadb加入开机启动项systemctl enable mariadb默认数据库root密码为空,为了安全应该为mariadb服务器设置root密码。系统会提示输入两次密码,密码不会在命令行中显示,输完直接回车即可。mysqladmin -u root password安装Seafile主程序首先安装依赖包yum -y install epel-release yum -y install wget python-imaging MySQL-python python-memcached python-ldap python-urllib3 python2-pip安装pillow和moviepypip install pillow moviepy安装ffmpeg和ffmpeg-develwget http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm rpm -Uvh nux-dextop-release*rpm yum -y install ffmpeg ffmpeg-devel创建seafile工作目录并下载seafile源码和解压mkdir -p /usr/local/seafile wget http://seafile-downloads.oss-cn-shanghai.aliyuncs.com/seafile-server_6.2.5_x86-64.tar.gz tar -zxvf seafile-server_6.2.5_x86-64.tar.gz解压后目录如下├── ccnet │ ├── ccnet.sock │ ├── misc │ ├── mykey.peer │ └── seafile.ini ├── conf │ ├── ccnet.conf │ ├── seafdav.conf │ ├── seafile.conf │ ├── seahub_settings.py │ └── seahub_settings.pyc ├── logs │ ├── ccnet.log │ ├── controller.log │ ├── seafile.log │ ├── seahub_django_request.log │ └── seahub.log ├── pids │ ├── ccnet.pid │ └── seaf-server.pid ├── seafile-data │ ├── commits │ ├── fs │ ├── httptemp │ ├── library-template │ ├── storage │ └── tmpfiles ├── seafile-server-6.2.5 │ ├── check_init_admin.py │ ├── reset-admin.sh │ ├── runtime │ ├── seaf-fsck.sh │ ├── seaf-fuse.sh │ ├── seaf-gc.sh │ ├── seafile │ ├── seafile.sh │ ├── seahub │ ├── seahub.sh │ ├── setup-seafile-mysql.py │ ├── setup-seafile-mysql.sh │ ├── setup-seafile.sh │ └── upgrade ├── seafile-server-latest -> seafile-server-6.2.5 └── seahub-data └── avatars执行安装脚本,并回答问题cd seafile-server-latest && ./setup-seafile-mysql.sh What is the name of the server? It will be displayed on the client. 3 - 15 letters or digits #自定义服务器名 [ server name ] seafile What is the ip or domain of the server? For example: www.mycompany.com, 192.168.1.101 #可以是你的服务器IP或者你的域名 [ This server's ip or domain ] Where do you want to put your seafile data? Please use a volume with enough free space #数据目录,这里一般保持默认 [ default "/usr/local/seafile/seafile-data" ] Which port do you want to use for the seafile fileserver? #seafile文件服务器监听端口,一般是默认,有冲突自行更改 [ default "8082" ] ------------------------------------------------------- Please choose a way to initialize seafile databases: ------------------------------------------------------- #1是在mariadb里创建seafile新用户和数据库,2是使用已有的数据库,这里使用的是1 [1] Create new ccnet/seafile/seahub databases [2] Use existing ccnet/seafile/seahub databases [ 1 or 2 ] #数据库地址,一般是本地,保持默认 What is the host of mysql server? [ default "localhost" ] #端口号,保持默认 What is the port of mysql server? [ default "3306" ] #输入root密码(不会显示) What is the password of the mysql root user? [ root password ] verifying password of user root ... done #自定义seafile数据库用户,默认用户名是seafile Enter the name for mysql user of seafile. It would be created if not exists. [ default "seafile" ] #为seafile数据库用户设置密码 Enter the password for mysql user "seafile": [ password for seafile ] verifying password of user seafile ... done #以下三项保持默认即可 Enter the database name for ccnet-server: [ default "ccnet-db" ] Enter the database name for seafile-server: [ default "seafile-db" ] Enter the database name for seahub: [ default "seahub-db" ] #到这里数据库都已经创建完毕,确认无误后按ENTER即可开始安装 --------------------------------- This is your configuration --------------------------------- server name: 你的服务器名 server ip/domain: 你的IP或域名 seafile data dir: /usr/local/seafile/seafile-data fileserver port: 8082 database: create new ccnet database: ccnet-db seafile database: seafile-db seahub database: seahub-db database user: seafile --------------------------------- Press ENTER to continue, or Ctrl-C to abort安装完毕后便是启动seafile进程,为了安全,seafile不能以root身份运行,所以应该先在系统里面创建一个名为seafile的普通用户,并以普通用户的身份运行。useradd -s /sbin/nologin seafile启动seafile以及seahub,首次启动会要求创建管理员帐号,根据提示输入即可。cd /usr/local/seafile/seafile-server-latest sudo -u seafile ./seafile.sh start sudo -u seafile ./seahub.sh start如果配置无误,seafile应该已经成功启动,这时,在浏览器上输入IP或者域名加端口号的格式即可访问。http://你的IP地址:8000因为文件服务器seahub和seafile端口号分别为8000,8082用起来不是很方便,所以可以用Nginx反向代理的形式,并且绑定域名,实现单一端口访问网盘。下面附上参考官方给出的Nginx反向代理的配置。server { listen 80; server_name seafile.yourdomain.com; proxy_set_header X-Forwarded-For $remote_addr; location / { proxy_pass http://127.0.0.1:8000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Host $server_name; proxy_read_timeout 1200s; # used for view/edit office file via Office Online Server client_max_body_size 0; access_log /var/log/nginx/seahub.access.log; error_log /var/log/nginx/seahub.error.log; } location /seafhttp { rewrite ^/seafhttp(.*)$ $1 break; proxy_pass http://127.0.0.1:8082; client_max_body_size 0; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_connect_timeout 36000s; proxy_read_timeout 36000s; proxy_send_timeout 36000s; send_timeout 36000s; } location /media { root /usr/local/seafile/seafile-server-latest/seahub; } }前端使用SSL的配置。后端因为是反代本地,因此不需要SSL。server { listen 443; ssl on; ssl_certificate SSL证书目录; ssl_certificate_key SSL密钥; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; server_name seafile.yourdomain.com; proxy_set_header X-Forwarded-For $remote_addr; location / { proxy_pass http://127.0.0.1:8000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Host $server_name; proxy_read_timeout 1200s; # used for view/edit office file via Office Online Server client_max_body_size 0; access_log /var/log/nginx/seahub.access.log; error_log /var/log/nginx/seahub.error.log; } location /seafhttp { rewrite ^/seafhttp(.*)$ $1 break; proxy_pass http://127.0.0.1:8082; client_max_body_size 0; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_connect_timeout 36000s; proxy_read_timeout 36000s; proxy_send_timeout 36000s; send_timeout 36000s; } location /media { root /usr/local/seafile/seafile-server-latest/seahub; } }修改/usr/local/seafile/conf/ccnet.conf:SERVICE_URL = https://seafile.yourdomain.com修改/usr/local/seafile/conf/seahub_settings.py:FILE_SERVER_ROOT = 'https://yourdomain.com/seafhttp
2018年11月24日
4,469 阅读
0 评论
0 点赞