安裝seafile記錄文件

自在拉基發表於2020-12-02

安裝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

重啟,訪問。搜尋索引需要等待一會才行。

以上是我解決幾個問題的思路大家可以參考一下,如有不對請指正。

掃一掃不迷路

相關文章