首页 » Linux » 正文

Seafile 同步网盘搭建

操作系统:CentOS 8
软件版本:seafile:7.1.3 
         nginx:1.16.1

1、安装nginx

###查看yum源中的nginx版本
dnf module list
#####################
nginx                1.14 [d]   common [d]                          nginx webserver
nginx                1.16       common                              nginx webserver

dnf module install nginx:1.16/common -y

###关闭防火墙
systemctl stop firewalld
systemctl disable firewalld

###启动nginx
systemctl start nginx
systemctl enable nginx

2、安装mariadb 数据库

###查看yum源中的mariadb数据库版本
dnf module list
##################
mariadb              10.3 [d]   client, server [d], galera          MariaDB Module

###安装mariadb数据库
dnf module install mariadb:10.3/server -y

systemctl enable mariadb
systemctl start mariadb

###预创建数据库
mysql -uroot -hlocalhost

####更改root密码
MariaDB [(none)]> grant all privileges on *.* to 'root'@'localhost' identified by '123456' with grant option;

####创建seafile相关数据库
MariaDB [(none)]> create database ccnet default charset utf8mb4;
MariaDB [(none)]> create database seafile default charset utf8mb4;
MariaDB [(none)]> create database seahub default charset utf8mb4;

####创建seafile相关数据库访问用户并授权
MariaDB [(none)]> grant all on ccnet.* to seafile@'localhost' identified by '123456';
MariaDB [(none)]> grant all on seahub.* to seafile@'localhost' identified by '123456';
MariaDB [(none)]> grant all on seafile.* to seafile@'localhost' identified by '123456';

####刷新mariadb数据库权限
MariaDB [(none)]> flush privileges;

3、安装seafile 服务端程序

3.1、准备seafile 服务端程序

[ -x /usr/bin/wget ] || yum install wget -y

###下载seafile Linux版服务端程序
mkdir -p /usr/local/seafile
cd /usr/local/seafile 
wget http://seafile-downloads.oss-cn-shanghai.aliyuncs.com/seafile-server_7.1.3_x86-64.tar.gz

tar -xf seafile-server_7.1.3_x86-64.tar.gz
mkdir installed && mv seafile-server_7.1.3_x86-64.tar.gz installed

3.2、安装依赖包

####安装依赖库
yum install python3 python3-setuptools python3-pip python3-ldap -y

####pip 安装加速
mkdir ~/.pip
toucah ~/.pip/pip.conf

cat >> ~/.pip/pip.conf << EOF
[global] 
index-url=http://mirrors.aliyun.com/pypi/simple 
[install] 
trusted-host=mirrors.aliyun.com
EOF

####升级pip版本(不升级安装依赖包可能会报错,提示文件缺失)
pip3 install --upgrade pip

###安装python包
pip3 install --timeout=3600 Pillow pylibmc captcha jinja2 sqlalchemy psd-tools django-pylibmc django-simple-captcha

3.3、安装seafile服务器

cd /usr/local/seafile/seafile-server-7.1.3

####安装seafile数据库
./setup-seafile-mysql.sh 

##############
[root@CentOS8 seafile-server-7.1.3]# ./setup-seafile-mysql.sh
Checking python on this machine ...

-----------------------------------------------------------------
This script will guide you to setup your seafile server using MySQL.
Make sure you have read seafile server manual at

        https://download.seafile.com/published/seafile-manual/home.md

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 ] seafile.test.cn

Which port do you want to use for the seafile fileserver?
[ default "8082" ] 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 ] 2

What is the host of mysql server?
[ default "localhost" ] localhost

What is the port of mysql server?
[ default "3306" ] 3306

Which mysql user to use for seafile?
[ mysql user for seafile ] seafile

What is the password for mysql user "seafile"?
[ password for seafile ]

verifying password of user seafile ...  done

Enter the existing database name for ccnet:
[ ccnet database ] ccnet

verifying user "seafile" access to database ccnet ...  done

Enter the existing database name for seafile:
[ seafile database ] seafile

verifying user "seafile" access to database seafile ...  done

Enter the existing database name for seahub:
[ seahub database ] seahub

verifying user "seafile" access to database seahub ...  done

---------------------------------
This is your configuration
---------------------------------

    server name:            seafile
    server ip/domain:       seafile.test.cn

    seafile data dir:       /usr/local/seafile/seafile-data
    fileserver port:        8082

    database:               use existing
    ccnet database:         ccnet
    seafile database:       seafile
    seahub database:        seahub
    database user:          seafile

---------------------------------
Press ENTER to continue, or Ctrl-C to abort
---------------------------------

####其中Create new ccnet/seafile/seahub databases选项表示自动创建,选择这个选项的话提供mariadb数据库的root用户名密码自动创建即可,因为已经手动创建好了,所以选择第二个选项即可。
##########启动 Seafile:
./seafile.sh start # 启动 Seafile 服务

#########启动 Seahub
./seahub.sh start  # 启动 Seahub 网站 (默认运行在127.0.0.1:8000端口上)

发表评论