当前位置: 首页 >> 原创·技术 >> 201912121617 记CentOS7_1904下安装Seafile7.0.11专业版 >> 正文

201912121617 记CentOS7_1904下安装Seafile7.0.11专业版

4年前 (2019-12-12)     作者:iMoke     分类:原创·技术     阅读次数:9021     评论(11)    

本文搭建的是Seafile7.0.11专(po)业(jie)版,结合自身安装经验,为朋友们跳过各种坑。

重点感谢:deny,dznas


2020年10月28日 10:21:31更新

请到这里看最新版本的官方专业版安装教程:https://www.imoke.org/post/20201004271.html


本文搭建的是Seafile7.0.11专(po)业(jie)版,结合自身安装经验,为朋友们跳过各种坑。


一、特别鸣谢

重点感谢:deny,dznas

参考文章:

  1. 记一次Ubuntu 16.0.4 手动搭建Seafile 7.0.5专业版(下文部分内容摘抄自这篇文章)

  2. deny大神的网盘demo

  3. deny大神的某网址(已失效)

  4. seafile官方部署教程

  5. seafile官方pro版本下载地址


二、环境介绍

  1. 虚拟机:4vCPU/4G/30G系统盘+100G数据盘,LVM/1NIC

  2. 内网环境

  3. 宝塔面板

  4. seafile-pro-server_7.0.11_x86-64-Crack.tar.gz

  5. d.rc.it为公司内部域名,虚假域名,请勿使用。


三、坑

  1. Seafile的文件搜索程序elasticsea,从日志中看,elasticsea无法使用root用户执行。因此,必须要单独创建一个用户;

  2. 每次重启,Seafile都会读取/sys/class/dmi/id/product_uuid重新验证授权。但该文件只有root有读的权限,且每次重启都会重新创建,导致Seafile无权限读取,再导致Seafile致验证失败,无法启动(编者注:感谢dznas大神文章,本人之前部署过不下20次,部署过不同版本,都失败,就差这一步。)

  3. 注意注意:验证授权时,匹配的是/home/seafile/conf/ccnet.conf的SERVICE_URL,不要写错


四、安装宝塔面板(可选)

seafile默认安装完,会开启8000和8082两个端口,所以我们需要使用apache或者nginx做反向代理(尤其是从某个版本开始,开启的是127.0.0.1:8000,无法直接访问),后期使用宝塔面板安装SSL证书也很简单。

#宝塔面板安装教程:https://www.bt.cn/bbs/thread-19376-1-1.html
yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh

宝塔面板安装完毕后,仅需要安装apache和mariadb即可。(编者注:我试过用自带的sqlite安装,但是启动报错。本来也不喜欢sqlite,所以没再过多尝试。)

安装后,记住你的mairadb root密码


五、apache的反向代理

创建一个网站:pan.rc.it

添加反向代理

修改反向代理配置文件

官方教程:https://cloud.seafile.com/published/seafile-manual-cn/deploy/deploy_with_apache.md

内容如下:
#PROXY-START/
<IfModule mod_proxy.c>
    ProxyRequests Off
    SSLProxyEngine on
    #
    # seafile fileserver
    #
    ProxyPass /seafhttp http://127.0.0.1:8082
    ProxyPassReverse /seafhttp http://127.0.0.1:8082
    RewriteRule ^/seafhttp - [QSA,L]
    #
    # seahub
    #
    SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
    ProxyPass / http://127.0.0.1:8000/
    ProxyPassReverse / http://127.0.0.1:8000/
    </IfModule>
#PROXY-END/


六、部署seafile

1.创建用户(本文以seafile用户为例)

#以root用户登录
useradd seafile
#设置seafile密码
passwd seafile
#记得修改sudo权限
vi /etc/sudoers
#找到下面内容
#    # Allow root to run any commands anywhere
#    root    ALL=(ALL)       ALL
#添加新行
seafile ALL=(ALL)       ALL


2.切换至seafile用户,安装依赖

su - seafile
#输入seafile密码
sudo yum install -y jre


3.安装Seafile专(po)业(jie)版

下载专(po)业(jie)版安装包。可以选择从官方版下载,也可以选择下载破解好的安装包。(为防止伸手党和举报党,本文不直接提供专(po)业(jie)版安装包地址,本教程多看看就能找到。)

cd $HOME
wget http://d.rc.it/Server/Seafile/crack/seafile-pro-server_7.0.11_x86-64-Crack.tar.gz
tar zxvf seafile-pro-server_7.0.11_x86-64-Crack.tar.gz
rm -rf seafile-pro-server_7.0.11_x86-64-Crack.tar.gz

What is the name of the server? It will be displayed on the client.
3 - 15 letters or digits
[ server name ] 你的站点名称
What is the ip or domain of the server?
For example: www.mycompany.com, 192.168.1.101
[ This server's ip or domain ] 你的域名
Where do you want to put your seafile data?
Please use a volume with enough free space
[ default "/home/seafile/seafile-data" ] 默认回车
Which port do you want to use for the seafile fileserver?
[ default "8082" ] 默认回车
-------------------------------------------------------
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" ] 默认回车
What is the port of mysql server?
[ default "3306" ] 默认回车
What is the password of the mysql root user?
[ root password ] 输入root密码
verifying password of user root ...  done
Enter the name for mysql user of seafile. It would be created if not exists.
[ default "seafile" ] 默认回车
Enter the password for mysql user "seafile":
[ password for seafile ] 设置数据库用户seafile的密码
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" ] 默认回车

完成安装


七、启动并配置管理员

[seafile@centos7 seafile-pro-server-7.0.11]$ ./seafile.sh start
** Message: seafile-controller.c(1157): loading seafdav config from /home/seafile/conf/seafdav.conf
[12/12/19 17:24:27] ../common/session.c(139): using config file /home/seafile/conf/ccnet.conf
[12/12/19 17:24:27] ../common/license.c(406): Loading license file /home/seafile/seafile-license.txt ..
[12/12/19 17:24:27] ../common/license.c(409): License file /home/seafile/seafile-license.txt does not exist, allow at most 3 trial users
License file /home/seafile/seafile-license.txt does not exist, allow at most 3 trial users
Starting seafile server, please wait ...
** Message: seafile-controller.c(1157): loading seafdav config from /home/seafile/conf/seafdav.conf
Seafile server started
Done.
[seafile@centos7 seafile-pro-server-7.0.11]$ ./seahub.sh start
LC_ALL is not set in ENV, set to en_US.UTF-8
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 ] 你的邮箱(必须是邮箱地址)
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.
[seafile@centos7 seafile-pro-server-7.0.11]$


八、如何正常的使用专(po)业(jie)版

1.如果你使用的是官方专业版安装包,那么,请到某页面更新2个核心文件ccnet-server和seaf-server(注:此步骤我没测试过)

sudo yum install -y lrzsz
sz /home/seafile/seafile-server-latest/seafile/bin/ccnet-server 
sz /home/seafile/seafile-server-latest/seafile/bin/seaf-server

在网页上更新后,将新文件替换系统中那两个文件

cd /home/seafile/seafile-server-latest/seafile/bin/
mv ccnet-server ccnet-server.bak
mv seaf-server seaf-server.bak
rz (ccnet-server)
rz (seaf-server)
chmod +x ccnet-server seaf-server

2.在某网页填写刚才安装seafile的信息,下载Licnese

3.赋予权限(大坑!深坑!万年坑!)

sudo chmod +r /sys/class/dmi/id/product_uuid
#使用root账户登录
echo "chmod +r /sys/class/dmi/id/product_uuid">>/etc/rc.local
chmod +x /etc/rc.d/rc.local


4.在seafile后台,安装license,并重启seafile和seahub


九、官方其他功能(挑选常用的功能)

1.开机启动Seafile(使用root账户配置)

官方教程:https://cloud.seafile.com/published/seafile-manual-cn/deploy/start_seafile_at_system_bootup.md

wget -O /etc/sysconfig/seafile http://d.rc.it/Server/Seafile/config/7.0.11/etc/sysconfig/seafile
wget -O /etc/init.d/seafile http://d.rc.it/Server/Seafile/config/7.0.11/etc/init.d/seafile
wget -O /etc/init.d/seahub http://d.rc.it/Server/Seafile/config/7.0.11/etc/init.d/seahub 
chmod 550 /etc/init.d/seafile
chmod 550 /etc/init.d/seahub
chkconfig --add seafile
chkconfig --add seahub
chkconfig seahub on
chkconfig seafile on

这块又是一个坑,因为启动用户是seafile,但是生成的/home/seafile/logs/seahub.init.log文件是root权限。所以启动报错,需要手动改文件的所属

sudo chown seafile:seafile /home/seafile/logs/seahub.init.log


2.Logrotate管理系统日志

官方教程:https://cloud.seafile.com/published/seafile-manual-cn/deploy/using_logrotate.md

因为官方也是不同时间写的,所以路径都不统一,自己留意一下吧。

wget -O /etc/logrotate.d/seafile http://d.rc.it/Server/Seafile/config/7.0.11/etc/logrotate.d/seafile


/home/seafile/logs/seafile.log
{
        daily
        missingok
        rotate 60
        compress
        delaycompress
        notifempty
        sharedscripts
        postrotate
                [ ! -f /home/seafile/pids/seaf-server.pid ] || kill -USR1 `cat /home/seafile/pids/seaf-server.pid`
        endscript
}
/home/seafile/logs/ccnet.log
{
        daily
        missingok
        rotate 60
        compress
        delaycompress
        notifempty
        sharedscripts
        postrotate
                [ ! -f /home/seafile/pids/ccnet.pid ] || kill -USR1 `cat /home/seafile/pids/ccnet.pid`
        endscript
}
/home/seafile/logs/index.log
{
        daily
        missingok
        rotate 60
        compress
        delaycompress
        notifempty
        sharedscripts
}


3.Office文件预览和编辑(建议OnlyOffice)

官方教程:https://cloud.seafile.com/published/seafile-manual-cn/deploy/only_office.md

1)先使用docker部署OnlyOffice(可以部署在同一台服务器,也可以独立部署。本次我就集成部署了。端口880)

yum install docker -y
systemctl start docker
systemctl enable docker
docker pull onlyoffice/documentserver
docker run -i -t -d --restart=always -p 880:80 -v /www/docker/onlyoffice/Data:/var/www/onlyoffice/Data -v /www/docker/onlyoffice/logs:/var/log/onlyoffice onlyoffice/documentserver

#查看容器ID
docker ps
CONTAINER ID        IMAGE                       COMMAND                  CREATED             STATUS              PORTS                                        NAMES
a016998fe6dd        onlyoffice/documentserver   "/bin/sh -c /app/d..."   7 minutes ago       Up About a minute   0.0.0.0:880->80/tcp, 0.0.0.0:8443->443/tcp   elegant_archimedes

#进入docker命令
docker exec -it a016998fe6dd /bin/bash

#修改配置文件,实现自动保存
#参照官方文档,注意docker里没有vi和vim,使用nano编辑。


2)配置seafile服务

添加以下配置信息到seahub_settings.py。

# Enable Only Office
ENABLE_ONLYOFFICE = True
VERIFY_ONLYOFFICE_CERTIFICATE = False
ONLYOFFICE_APIJS_URL = 'http://pan.rc.it:880/web-apps/apps/api/documents/api.js'
ONLYOFFICE_FILE_EXTENSION = ('doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx', 'odt', 'fodt', 'odp', 'fodp', 'ods', 'fods')
ONLYOFFICE_EDIT_FILE_EXTENSION = ('docx', 'pptx', 'xlsx')


然后重启Seafile服务

./seafile.sh restart
./seahub.sh restart

# or
service seafile-server restart



4.LDAP集成

官方教程:https://cloud.seafile.com/published/seafile-manual-cn/deploy_pro/using_ldap_pro.md


5.邮件功能

官方教程:https://cloud.seafile.com/published/seafile-manual-cn/config/sending_email.md


6.高级用户管理

官方教程:https://cloud.seafile.com/published/seafile-manual-cn/deploy_pro/roles_permissions.md


7.BUG:解决管理员账户头像不显示文体

默认显示的路径是<SERVICE_URL>:8000/media/avatars/default.png,因为我们用的是反向代理,加上官方已经关闭了对0.0.0.0:8000的绑定,所以头像是显示不出来的。

解决方法:

修改/home/seafile/conf/ccnet.conf:5,去掉端口号,重启seafile。


除非注明,发表在“傲孤漠客”的文章『201912121617 记CentOS7_1904下安装Seafile7.0.11专业版』版权归iMoke所有。 转载请注明出处为“本文转载于『傲孤漠客』原地址https://www.imoke.org/post/20191212157.html

评论

发表评论   

昵称*

E-mail*(建议输入,以便收到博主回复的提示邮件)

网站

  • 访客
    • 访客  POST:2021-04-12 13:08:15 与TA同吐槽
    • 请问呢license文件内容是什么样的?一串RSA加密的密文么
  • 访客
    • 访客  POST:2020-09-10 17:52:19 与TA同吐槽
    • 下载 license 的某网页失效了,我们目前也是用的deny大神的网页下载的license,最近计划迁移,结果发现deny大神的网页失效了。我看你的license貌似也快到期了呀。有解决办法么??
      • mengqy
        • iMoke  POST:2020-09-11 13:28:08 与TA同吐槽
        • 说实话,没有,我也是因为deny大神关闭了,导致现在我还在用最老的6.X版本。一直想升,却找不到最新和谐版。
          • 访客
            • 访客  POST:2020-10-20 11:09:41 与TA同吐槽
            • 关闭的原因是因为有人在seafile的官方论坛发帖问那个破解版靠不靠谱导致的。。。服了,这不就是去自爆么。。
              • mengqy
                • iMoke  POST:2020-10-28 10:19:44 与TA同吐槽
                • 哈哈哈哈哈 这个我也是才知道。弱智果然无处不在啊。有链接吗?
  • 访客
    • 访客  POST:2020-01-29 16:35:37 与TA同吐槽
    • 博主:https://blog.dmzy.vip/Seafile-License.html 这个您提供的注册网址,提示服务器无响应。
  • 访客
    • 访客  POST:2019-12-30 15:40:34 与TA同吐槽
    • 无法解析:wget http://d.rc.it/Server/......
      • mengqy
        • iMoke  POST:2019-12-30 15:58:16 与TA同吐槽
        • 我不提供盗版下载。那个域名是公司内网域名。
  • 访客
    • 访客  POST:2019-12-25 11:15:07 与TA同吐槽
    • 请问“某页面”在哪?
      • 访客
        • 访客  POST:2019-12-25 11:32:39 与TA同吐槽
        • 如果你使用的是官方专业版安装包,那么,请到某页面更新2个核心文件ccnet-server和seaf-server
          • mengqy
            • iMoke  POST:2019-12-25 12:02:39 与TA同吐槽
            • 在特别鸣谢里。提示,这个步骤我没有测试过,不保证可用。