天天看点

centos7搭建seafile开源私人网盘

#本文章参考https://cloud.seafile.com/published/seafile-manual-cn/home.md

#安装依赖包

yum -y install wget epel-release
rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
yum -y install python-imaging MySQL-python python-memcached python-ldap python-urllib3 ffmpeg ffmpeg-devel
           

#创建压缩的源码包存放目录

mkdir /home/tools/
           

#创建要运行存放的位置

mkdir /home/wwwroot/seafile/
           

#切换到源码包存放目录

cd /home/tools/
           

#下载6.3.4版本的seafile(最新的是7版本的,但安装不成功,可能有问题,所以推荐安装6版本的。)

wget http://seafile-downloads.oss-cn-shanghai.aliyuncs.com/seafile-server_6.3.4_x86-64.tar.gz
           

#解压

tar xf seafile-server_6.3.4_x86-64.tar.gz
           

#转移解压出来的目录到要运行的位置

mv seafile-server_6.3.4 /home/wwwroot/seafile/
           

#切换到转移的目录

cd /home/wwwroot/seafile/seafile-server-6.3.4
           

#运行安装脚本,并回答预设问题(这个脚本是使用SQLite作为数据存放的,./setup-seafile-mysql.sh是mysql作为存放数据的安装脚本,需要提前搭建和创建mysql数据库,很麻烦,个人用,这个就够了)

#设置中有一条是设置访问域名或者IP,如果打算做域名访问,可以直接输入预设的域名,方便后期分享文件。nginx配置文件在文章尾部

./setup-seafile.sh
           

#启动seafile服务,默认端口是8082,注意开放防火墙端口,或者阿里的安全组

./seafile.sh start
           

#启动seafile网站,默认端口是8000,注意开放防火墙端口,或者阿里的安全组(启动这个脚本会让设置管理员邮箱和密码,邮箱为登陆seafile的用户名,密码就是登陆密码)

./seahub.sh start
           

#访问:http://IP:8000/

#nginx相关设置:

vim seafile.conf
server {
    listen 80;
    server_name seafile.XXX.com
    proxy_set_header X-Forwarded-For $remote_addr;

    location / {
         proxy_pass         http://127.0.0.1:8000;
         proxy_set_header   Host $host;
         proxy_set_header   X-Real-IP $remote_addr;
         proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_set_header   X-Forwarded-Host $server_name;
         proxy_read_timeout  1200s;

         client_max_body_size 0;
         #设置日志存放路径
         access_log      /home/wwwlogs/seafile/access.log;
         error_log       /home/wwwlogs/seafile/error.log;
    }

    location /seafhttp {
        rewrite ^/seafhttp(.*)$ $1 break;
        proxy_pass http://127.0.0.1:8082;
        client_max_body_size 0;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_connect_timeout  36000s;
        proxy_read_timeout  36000s;
        proxy_send_timeout  36000s;
        send_timeout  36000s;
    }

    location /media {
        root /home/wwwroot/seafile/seafile-server-latest/seahub;
    }

}
           

继续阅读