使用 seafile搭建私有云盘
一、系统环境
系统:centos7-1708
ip地址:192.168.159.33
二、安装seafile
[root@seafile ~]# yum -y install epel-release
[root@seafile ~]# rpm --import http://li.nux.ro/download/nux/rpm-gpg-key-nux.ro
[root@seafile ~]# yum -y install python-imaging mysql-python python-memcached python-ldap python-urllib3 ffmpeg ffmpeg-devel
[root@seafile ~]# yum -y install python-pip
[root@seafile ~]# pip install --upgrade pip
[root@seafile ~]# pip install pillow moviepy
[root@seafile ~]# yum install -y mariadb-server ##安装数据库
[root@seafile ~]# systemctl enable mariadb ##设置数据库开机启动
[root@seafile ~]# systemctl start mariadb ##启动数据库
[root@seafile ~]# mysql_secure_installation ##为数据库设置密码
[root@seafile ~]# wget http://seafile-downloads.oss-cn-shanghai.aliyuncs.com/seafile-server_6.2.3_i386.tar.gz ##下载seafile软件包
[root@seafile ~]# tar -zxf seafile-server_6.2.3_x86-64.tar.gz ##解压软件包
[root@seafile ~]# mkdir -p seafile/installed/ ##创建安装包存放位置
[root@seafile ~]# mv seafile-server_6.2.3_x86-64.tar.gz seafile/installed/
[root@seafile ~]# mv seafile-server-6.2.3/ seafile/
[root@seafile ~]# cd seafile/
[root@seafile seafile]# cd seafile-server-6.2.3/
[root@seafile seafile-server-6.2.3]# ./setup-seafile-mysql.sh ##会要填很多信息,按要求填就可以了
三、设置防火墙、selinux
设置selinux
[root@seafile ~]#vi /etc/selinux/config
将selinux=enforcing改为selinux=disabled
使selinux立即生效
[root@seafile ~]#setenforce 0
添加防火墙允许通行端口
[root@seafile ~]#firewall-cmd --zone=public --add-port=8000/tcp --permanent
[root@seafile ~]#firewall-cmd --zone=public --add-port=8082/tcp --permanent
[root@seafile ~]#firewall-cmd --zone=public --add-port=3306/tcp --permanent
[root@seafile ~]#firewall-cmd --zone=public --add-port=10001/tcp --permanent
[root@seafile ~]#firewall-cmd --zone=public --add-port=12001/tcp --permanent
[root@seafile ~]#firewall-cmd --zone=public --add-port=8000/udp --permanent
[root@seafile ~]#firewall-cmd --zone=public --add-port=8082/udp --permanent
[root@seafile ~]#firewall-cmd --zone=public --add-port=3306/udp --permanent
[root@seafile ~]#firewall-cmd --zone=public --add-port=10001/udp --permanent
[root@seafile ~]#firewall-cmd --zone=public --add-port=12001/udp --permanent
[root@seafile ~]#firewall-cmd --reload ##加载防火墙规则使其立即生效
[root@seafile ~]#firewall-cmd --zone=public --list-ports ##查看放行端口
四、启动seafile
启动seafile
[root@seafile seafile-server-6.2.3]# ./seafile.sh start # 启动 seafile 服务
[root@seafile seafile-server-6.2.3]# ./seahub.sh start # 启动 seahub 网站 (默认运行在8000端口上),可指定端口
设置开机启动(execstart execstop替换为相应安装位置)
[root@seafile ~]#vi /usr/lib/systemd/system/seafile.service
[unit]
description=seafile service
after=network.target
after=mariadb.service
[service]
type=oneshot
remainafterexit=yes
execstart=/seafile/seafile/seafile.sh start
execstart=/seafile/seafile/seahub.sh start
#execstop=/seafile/seafile/seafile.sh stop
#execstop=/seafile/seafile/seahub.sh stop
[install]
wantedby=multi-user.target
[root@seafile ~]#systemctl enable seafile
[root@seafile ~]#systemctl start seafile
[root@seafile ~]#systemctl status seafile