1.下载安装docker(如果系统有docker服务了,请跳过此步骤)
[root@lixian ~]# yum -y install yum-utils device-mapper-persistent-data lvm2
[root@lixian ~]# yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
[root@lixian ~]# yum makecache fast
[root@lixian ~]# yum -y install docker-ce
[root@lixian ~]# systemctl start docker
2.拉取seafile镜像
[root@lixian ~]# docker pull seafileltd/seafile
Using default tag: latest
latest: Pulling from seafileltd/seafile
1489501ea318: Downloading [=========> ] 50.36MB/270.4MB
c197ac8352c5: Downloading [============================> ] 32.08MB/55.58MB
3.使用seafile镜像运行docker容器
#将192.168.1.215替换你的服务器IP地址
#/data/seafile是本地的seafile数据目录映射到docker里的/shared目录
[root@lixian ~]# docker run -d --name seafile -e SEAFILE_SERVER_HOSTNAME=192.168.1.215 -v /data/seafile:/shared -p 80:80 seafileltd/seafile:latest
4.查看运行的容器
[root@lixian ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5e38ef46322a seafileltd/seafile:latest "/sbin/my_init -- /s…" 2 days ago Up 2 days 0.0.0.0:80->80/tcp seafile
5.浏览器http://IP地址 访问seafile(默认用户名:me@example.com 默认密码:asecret)
6.增加上传下载大小代码
[root@lixian ~]# cat /data/seafile/seafile/conf/seafile.conf
[fileserver]
port = 8082
[database]
type = mysql
host = 127.0.0.1
port = 3306
user = seafile
password = ec2a3fc7-9fb3-4d6c3787f7bd3
db_name = seafile_db
connection_charset = utf8
[fileserver]
#最大上传文件单位为MB,为1TB
max_upload_size=1048576
#最大下载目录为MB,为1TB
max_download_dir_size=1048576
7.备份seafile脚本
#!/bin/bash
#备份数据库
docker exec -i seafile mysqldump -uroot ccnet_db > /data/seafile/`date +'%Y-%m-%d-%H:%M:%S'`_ccnet_db.sql
docker exec -i seafile mysqldump -uroot seafile_db > /data/seafile/`date +'%Y-%m-%d-%H:%M:%S'`_seafile_db.sql
docker exec -i seafile mysqldump -uroot seahub_db > /data/seafile/`date +'%Y-%m-%d-%H:%M:%S'`_seahub_db.sql
#删除备份30天的数据库备份文件
find /data/seafile -mtime +30 -name "*.sql" -exec rm -rf {} \;
#备份seafile数据
tar czfP /data/seafile/`date +'%Y-%m-%d-%H:%M:%S'`_seafile.tar.gz /backup/seafile/seafile/
#删除备份30天的数据备份文件
find /data/seafile -mtime +30 -name "*.tar.gz" -exec rm -rf {} \;