安装seafile记录文档

安装yum-croniptables 、关闭selinux

    yum -y install cronie
    yum -y install yum-cron
    systemctl start yu,-cron
    systemctl start yumcron
    systemctl start yum-cron
    yum -y install yum-cron
    systemctl status yum-cron
    sed -i 's/SELINUX=enforcing/SELINUX=disablde/g' /etc/selinux/config
    reboot
    systemctl stop firewalld
    systemctl disable firewalld
    reboot
    rpm -Uvh iptables-1.4.21-35.el7.x86_64.rpm
    rpm -Uvh iptables-services-1.4.21-35.el7.x86_64.rpm
    #下面几个包不装的话运行createrepo会报错
    rpm -ivh deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
    rpm -ivh python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
    rpm -ivh createrepo-0.9.9-24.el6.noarch.rpm

配置iptables规则

配置完需要重启此服务

vim /etc/sysconfig/iptables
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8000 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8082 -j ACCEPT

配置本地源

chown 755 CentOS-7-x86_64-Everything-2003.iso
mkdir -p /mnt/iso
mount -o loop CentOS-7-x86_64-Everything-2003.iso  /mnt/iso
cp -r /mnt/iso/Packages /root/Packages
rm -rf /etc/yum.repos.d/Centos*
vim local.repo
[local_server]
name = This is a local repo
baseurl = file:///root/Packages
enabled = 1
gpgcheck = 0
#保存退出
createrepo -d /root/Packages/
yum repolist
yum clean all
yum makecache

配置python环境

vim /etc/profile.d/python.sh
alias python='/usr/local/bin/python3.6'
alias pip='/usr/local/bin/pip3.6'
#保存退出
chmod 755 /etc/profile.d/python.sh
source /etc/profile.d/python.sh

安装mysql

#解压包,然后移动到本地源内
cd MariaDB
mv * ../Packages
#重新生成一下源数据
createrepo -d /root/Packages/
yum repolist
rm -rf /var/cache/yum
yum makecache
#安装
sudo yum install MariaDB-server MariDB-client
#查看状态
service mariadb.service status
systemctl enable --now mariadb
#设置mysql账号密码
mysql_secure_installation
#全是y

修改mysql存储目录到其他地方

最好还是配置一下,毕竟是数据。

systemctl stop mariadb.service
#创建好需要移动的目录
mkdir -p /data/seafile
chown -R mysql:mysql /data/seafile
cp -a /var/lib/mysql /data/seafile
vim /etc/my.cnf.d/server.cnf 
#在 【mysqld】下插入以下配置
#--------------------------add by root-----------------------------
# add for moving data to /home/mariadb设置数据存放目录为/data/seafile/mysql  socket路径保持不变
#
datadir=/data/seafile/mysql
socket=/var/lib/mysql/mysql.sock
#default-character-set=utf8 增加utf8代码支持
character_set_server=utf8
#SET配置MariaDB慢查询
slow_query_log=on
slow_query_log_file=/data/seafile/mysql/slow_query_log.log
long_query_time=2
#--------------------------end-------------------------------------

vim /etc/my.cnf
#添加以下配置
[mysqld]
datadir=/data/seafile/mysql/
socket=/var/lib/mysql/mysql.sock
server_id=101
log-bin = mysql-bin
[client-server]
port=3306
socket=/var/lib/mysql/mysql.sock
#--------------------------end-------------------------------------
touch /data/seafile/mysql/slow_query_log.log
chown mysql:mysql /data/seafile/mysql/slow_query_log.log
#修改 /usr/lib/systemd/systemd/mariadb.service
vim /usr/lib/systemd/systemd/mariadb.service
#将里面的ProtectHome 参数改为false,然后保存退出
systemctl daemon-reload
service mariadb.service restart

数据库配置

mysql -uroot -p
MariaDB [(none)]> SHOW VARIABLES LIKE 'character%';
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8                       |
| character_set_connection | utf8                       |
| character_set_database   | utf8                       |
| character_set_filesystem | binary                     |
| character_set_results    | utf8                       |
| character_set_server     | utf8                       |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.010 sec)

#--------------------------next----------------------------------

MariaDB [(none)]> show global variables like "%datadir%";
+---------------+----------------------+
| Variable_name | Value                |
+---------------+----------------------+
| datadir       | /data/seafile/mysql/ |
+---------------+----------------------+
1 row in set (0.002 sec)

#--------------------------next----------------------------------

MariaDB [(none)]> grant all privileges on *.* to 'root'@'%' identified by 'seafile.2019' with grant option;
Query OK, 0 rows affected (0.004 sec)

#--------------------------next----------------------------------

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.003 sec)

#--------------------------next----------------------------------

MariaDB [(none)]> exit
Bye

安装python3

#--------------------------安装包--------------------------------
#先解压python-rpm,并将帮移动到Packages,然后执行下面的命令
createrepo -d /root/Packages/
yum repolist
rm -rf /var/cache/yum
yum makecache
yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make

#------------------------编译安装python3----------------------------
#上传python3压缩包
tar -xzvf Python-3.6.5.tgz -C /tmp
cd /tmp
./configure --prefix=/usr/local
make all && make install
createrepo -d /root/Packages/
yum repolist
rm -rf /var/cache/yum
yum makecache

#------------------------安装pip------------------------------
#上传压缩包
tar -xzf pip-18.1.tar.gz
cd pip-18.1
sudo python setup.py install

安装ffmpeg-rpm

#--------------------上传包,并移动到Packages ------------------------

createrepo -d /root/Packages/
yum repolist
rm -rf /var/cache/yum
yum makecache
yum install python-setuptools python-imaging MySQL-python python-memcached python-ldap python-urllib3 ffmpeg ffmpeg-devel python-requests

#--------------------------next----------------------------------
#上传moviepy包,并安装相应的包
pip install Pillow-5.2.0-cp36-cp36m-manylinux1_x86_64.whl
pip install decorator-4.3.0-py2.py3-none-any.whl
pip install tqdm-4.26.0-py2.py3-none-any.whl
pip install numpy-1.15.1-cp36-cp36m-manylinux1_x86_64.whl
tar -xzf imageio-2.4.1.tar.gz && rm imageio-2.4.1.tar.gz -f
tar -xzf moviepy-0.2.3.5.tar.gz && rm moviepy-0.2.3.5.tar.gz -f
cd imageio-2.4.1/ && python setup.py install
cd ../moviepy-0.2.3.5/ && python setup.py install
sudo yum install java-1.7.0-openjdk poppler-utils python-setuptools  python-imaging MySQL-python mariadb-server python-memcached python-ldap  python-urllib3

#--------------------------next----------------------------------
#上传boto包,并安装
cd boto
sudo python setup.py install
yum -y install java-1.7.0-openjdk
yum -y install java-1.8.0-openjdk
yum -y install poppler-utils
sudo easy_install pip
Searching for pip
Best match: pip 18.1
Processing pip-18.1-py2.7.egg
pip 18.1 is already the active version in easy-install.pth
Installing pip script to /usr/bin
Installing pip2.7 script to /usr/bin
Installing pip2 script to /usr/bin
Using /usr/lib/python2.7/site-packages/pip-18.1-py2.7.egg
Processing dependencies for pip
Finished processing dependencies for pip
sudo pip install boto
Requirement already satisfied: boto in /usr/lib/python2.7/site-packages/boto-2.49.0-py2.7.egg (2.49.0)

#--------------------------next----------------------------------

安装seafile

  • 上传包并解压
#--------------------------next----------------------------------
#上传包,并解压
tar -zxf seafile-pro-server_7.0.19_x86-64.tar.gz
cd seafile-pro-server-7.0.19/
  • 启动mysql服务
./setup-seafile-mysql.sh
Checking python on this machine ...
  Checking python module: python-mysqldb ... Done.
Checking for java ...Done.
-----------------------------------------------------------------
This script will guide you to setup your seafile server using MySQL.
Make sure you have read seafile server manual at
        https://github.com/haiwen/seafile/wiki
Press ENTER to continue
-----------------------------------------------------------------
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
[ This server's ip or domain ] 10.224.91.79
Where do you want to put your seafile data?
Please use a volume with enough free space
[ default "/data/seafile_pro/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 ]
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 ]
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" ]
---------------------------------
This is your configuration
---------------------------------
    server name:            seafile
    server ip/domain:       10.224.91.79
    seafile data dir:       /data/seafile_pro/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
---------------------------------
Generating ccnet configuration ...
done
Successly create configuration dir /data/seafile_pro/ccnet.
Generating seafile configuration ...
Done.
done
Generating seahub configuration ...
----------------------------------------
Now creating ccnet database tables ...
----------------------------------------
----------------------------------------
Now creating seafile database tables ...
----------------------------------------
----------------------------------------
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
./seafile.sh start
[root@localhost seafile-pro-server-7.0.19]# ./seafile.sh start
** Message: seafile-controller.c(1157): loading seafdav config from /data/seafile_pro/conf/seafdav.conf
[12/02/20 15:55:38] ../common/session.c(143): using config file /data/seafile_pro/conf/ccnet.conf
[12/02/20 15:55:38] ../common/license.c(406): Loading license file /data/seafile_pro/seafile-license.txt ..
[12/02/20 15:55:38] ../common/license.c(409): License file /data/seafile_pro/seafile-license.txt does not exist, allow at most 3 trial users
License file /data/seafile_pro/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 /data/seafile_pro/conf/seafdav.conf
Seafile server started
Done.
  • 启动seahub
./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 ] demo@demo.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.
  • 修改配置文件
vim conf/gunicorn.conf
#修改bindIP为0.0.0.0
# default localhost:8000
bind = "0.0.0.0:8000"
vim /etc/systemd/system/seafile.service
#添加以下配置
[Unit]
Description=Seafile Service
After=network.target mysql.service
Environment = “ LC_ALL = C”
[Service]
Type=oneshot
RemainAfterExit= yes
ExecStart=/data/seafile_pro/seafile-server-latest/seafile.sh start
ExecStart=/data/seafile_pro/seafile-server-latest/seahub.sh start
ExecStop=/data/seafile_pro/seafile-server-latest/seafile.sh stop
ExecStop=/data/seafile_pro/seafile-server-latest/seahub.sh stop
[Install]
WantedBy=multi-user.target
#保存退出
systemctl enable seafile
systemctl is-enabled seafile #查看状态

安装Office预览

#上传LibreOffice包,并解压
tar -xzf LibreOffice_6.4.7_Linux_x86-64_rpm.tar.gz
tar -xzf LibreOffice_6.4.7_Linux_x86-64_rpm_helppack_zh-CN.tar.gz
tar -xzf LibreOffice_6.4.7_Linux_x86-64_rpm_langpack_zh-CN.tar.gz
cd LibreOffice_6.4.7.2_Linux_x86-64_rpm/RPMS/ && sudo yum install ./*.rpm /*
cd LibreOffice_6.4.7.2_Linux_x86-64_rpm_langpack_zh-CN/RPMS && sudo yum install ./*.rpm /*
cd LibreOffice_6.4.7.2_Linux_x86-64_rpm_helppack_zh-CN/RPMS && sudo yum install ./*.rpm /*

重启机器

重启后什么都不用动,服务器重启好后访问你的地址,查看是否可以访问并登陆,如果可以那就上传你的许可证吧。

-w1328

问题解决

无法下载大文件

其实用默认的就行,比较开了比较耗服务器资源

vim conf/seafile.conf
#添加以下配置
[fileserver]
# 上传文件最大限制为200M,默认是无限制.
max_upload_size=200                
# 最大下载目录限制为200M, 默认是100M. 还不够就往大的设置就好了,只要你的服务器吃得消
max_download_dir_size=200  

参考链接

无法搜索文件

讲一下我的排错思路吧。

  • 首先查看一下es是否起来了
ps aux | grep -o [j]ava[[:space:]].*elasticsearch.pid$
  • 上面没有进程的话,那就是es没有起来。解决方案我使用的是官方的,

解决方案
-w1132

  • 如果上面有进程的,那就看seahub的启动日志,看看什么报错
tail -f seahub.log
#Web界面操作一下看看什么报错了

-w920

比如我这就是自己漏掉了,忘记给office缓存文件权限了,然后还一个也是没有权限。给一下权限,不会的看看上一步官方文档,按照操作就行了。操作完毕后重启服务,再看下有没有报错,我这给了权限后seahub就没有报错了,不过web界面报错了,好像报Sorry, but the requested page is unavailable due to a server hiccup. Our engineers have been notified, so check back later.反正就是登陆界面都访问不了,报错是不是这个就不是很确定了。

  • 查看配置文件

查看一下配置文件是不是都对的。我这是·ccnet.conf配置文件被我瞎改改改坏掉了。把URL改成自己的ip+端口就好了,如👇:

-w627

重启,访问。搜索索引需要等待一会才行。

以上是我解决几个问题的思路大家可以参考一下,如有不对请指正。

以上安装所需要的包已经放置我的公众号,大家关注一下。回复关键字「1206」即可获取下载链接。

扫一扫不迷路

posted @ 2020-12-02 23:50  自在拉基  阅读(94)  评论(0编辑  收藏