Debian10安装seafile-pro-6.x记录

一、Debian安装配置

  1. Debian最小安装(只安装ssh服务)

  2. 安装完成先设置网络
    root账户登陆,输入

    # nano /etc/network/interfaces 
    

    改为如下设置

    # The loopback network interface
    auto lo
    iface lo inet loopback
    
    # The primary network interface
    # iface enp3s0 inet dhcp
    allow-hotplug enp3s0
    auto enp3s0
    iface enp3s0 inet static
    address 192.168.1.200
    netmask 255.255.255.0
    gateway 192.168.1.1
    

    附 nano简单操作:

    操作 指令
    删除行 Ctrl + k
    保存 Ctrl + o
    退出 Ctrl + x

    设置dns比较麻烦些,后来发现在路由器中,通过指定MAC分配IP更为方便。

  3. 使用自建用户usera远程登陆debian主机:

    ssh [email protected]
    

    切换 root 用户后开始配置。

  4. 配置国内 apt 源;

    # nano /etc/apt/sources.list 
    

    进入后,粘贴如下内容

    deb http://mirrors.tuna.tsinghua.edu.cn/debian/ buster main non-free contrib
    deb http://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main non-free contrib
    deb http://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main non-free contrib
    deb http://mirrors.tuna.tsinghua.edu.cn/debian-security/ buster/updates main non-free contrib   
    deb-src http://mirrors.tuna.tsinghua.edu.cn/debian/ buster main non-free contrib
    deb-src http://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main non-free contrib
    deb-src http://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main non-free contrib
    deb-src http://mirrors.tuna.tsinghua.edu.cn/debian-security/ buster/updates main non-free contrib
    
  5. 将自建用户加入sudo用户组:
    先安装sudo工具;

    # apt update
    # apt-get install sudo 
    

    修改 /etc/sudoers 文件属性为可写

    # chmod +w /etc/sudoers
    

    编辑 /etc/sudoers 在

    root    ALL=(ALL:ALL) ALL
    

    后,添加如下行

    usera    ALL=(ALL:ALL) ALL
    
  6. 配置ssh为自建用户可远程登陆;

    # nano /etc/ssh/sshd_config
    

    修改

    #PermitRootLogin prohibit-password
    

    PermitRootLogin yes
    
  7. 安装防火墙配置工具ufw;

    # apt install ufw
    
    # ufw disable
    

    重启Debian主机。

  8. 安装配置FTP工具vsftpd;

    $ sudo apt install vsftpd
    
    $ sudo nano /etc/vsftpd.conf
    

    修改为

    listen=YES 
    #listen_ipv6=YES
    write_enable=YES
    

    重启vsftpd服务

    $ sudo /etc/init.d/./vsftpd restart
    

二、下载所需软件

  1. seafile下载
    历史版本 中找到 seafile-pro-server_6.3.14_x86-64.tar.gz 下载;
  2. java下载
    下载jdk8版本,Linux x64 Compressed Archive 版;
  3. FTP上传以上软件包到usera目录;

三、安装Java

  1. usera目录下的jdk-8u241-linux-x64.tar.gz复制到/usr/lib/jvm目录,解压后删除:
    $ sudo mkdir /usr/lib/jvm
    $ sudo cp ~/jdk-8u241-linux-x64.tar.gz /usr/lib/jvm/
    $ cd /usr/lib/jvm
    $ sudo tar xvf jdk-8u241-linux-x64.tar.gz
    $ sudo rm jdk-8u241-linux-x64.tar.gz
    
  2. 配置环境变量
    $ nano ~/.profile
    
    在最后添加
    export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_241
    export JRE_HOME=${JAVA_HOME}/jre  
    export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib  
    export PATH=${JAVA_HOME}/bin:$PATH
    
    保存关闭,使用source更新下
    $ source ~/.profile
    
    使用env命令察看JAVA_HOME的值
    $ env
    
    如果JAVA_HOME=/usr/lib/jvm/jdk1.8.0_241,说明配置成功。
  3. 修改系统默认的jdk
    $ sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.8.0_241/bin/java 300
    $ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.8.0_241/bin/javac 300
    $ sudo update-alternatives --config java
    $ sudo update-alternatives --config javac
    
  4. 查看是否配置成功
    $ java -version
    
    输出如下信息,说明成功:
    java version "1.8.0_241"
    Java(TM) SE Runtime Environment (build 1.8.0_241-b07)
    Java HotSpot(TM) 64-Bit Server VM (build 25.241-b07, mixed mode)
    

四、安装NMP

  1. apt安装nginx:
    $ sudo apt install nginx
    
  2. apt安装mariadb-server:
    $ sudo apt install mariadb-server
    
  3. 初始化mariadb安全设置
    $ sudo mysql_secure_installation
    
    根据提示,设置数据库root密码。
  4. apt安装python2.7环境
    $ sudo apt-get install python2.7 python-setuptools python-mysqldb python-urllib3 python-ldap -y
    

五、安装Seafile

  1. 添加seafile安装运行目录
    $ sudo mkdir /opt/seafile_rt
    
  2. usera目录下的seafile-pro-server_6.3.14_x86-64.tar.gz复制到/opt/seafile_rt录,解压:
    $ sudo cp ~/seafile-pro-server_6.3.14_x86-64.tar.gz /opt/seafile_rt/
    $ cd /opt/seafile_rt
    $ sudo tar xvf seafile-pro-server_6.3.14_x86-64.tar.gz
    $ sudo mkdir installed
    $ sudo mv seafile-pro-server_6.3.14_x86-64.tar.gz installed/
    
  3. 运行seafile初始化配置
    $ cd seafile-pro-server-6.3.14/
    $ sudo ./setup-seafile-mysql.sh
    
  4. 提示缺少依赖软件
    python-imaging  is not installed, Please install it first.
    
    安装之
    sudo apt-get install python-imaging
    
    又提示
    没有可用的软件包 python-imaging,但是它被其它的软件包引用了。
    然而下列软件包会取代它:
    python-pil
    
    那就安装python-pil吧
    sudo apt install python-pil
    
  5. 再次运行seafile初始化配置
    $ sudo ./setup-seafile-mysql.sh
    
    提示成功:
    -----------------------------------------------------------------
    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.
    

六、Nginx配置

  1. 配置seafile的代理
    $ sudo nano /etc/nginx/sites-available/seafile.conf   #此处seafile官网有错误,/etc/nginx/sites-*** 错写成了/etc/nginx/site-***
    
    粘贴以下内容
    server {
        listen 80;
        server_name seafile.example.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;
    
             # used for view/edit office file via Office Online Server
             client_max_body_size 0;
    
             access_log      /var/log/nginx/seahub.access.log;
             error_log       /var/log/nginx/seahub.error.log;
        }
    
    # If you are using [FastCGI](http://en.wikipedia.org/wiki/FastCGI),
    # which is not recommended, you should use the following config for location `/`.
    #
    #    location / {
    #         fastcgi_pass    127.0.0.1:8000;
    #         fastcgi_param   SCRIPT_FILENAME     $document_root$fastcgi_script_name;
    #         fastcgi_param   PATH_INFO           $fastcgi_script_name;
    #
    #         fastcgi_param     SERVER_PROTOCOL     $server_protocol;
    #         fastcgi_param   QUERY_STRING        $query_string;
    #         fastcgi_param   REQUEST_METHOD      $request_method;
    #         fastcgi_param   CONTENT_TYPE        $content_type;
    #         fastcgi_param   CONTENT_LENGTH      $content_length;
    #         fastcgi_param     SERVER_ADDR         $server_addr;
    #         fastcgi_param     SERVER_PORT         $server_port;
    #         fastcgi_param     SERVER_NAME         $server_name;
    #         fastcgi_param   REMOTE_ADDR         $remote_addr;
    #          fastcgi_read_timeout 36000;
    #
    #         client_max_body_size 0;
    #
    #         access_log      /var/log/nginx/seahub.access.log;
    #          error_log       /var/log/nginx/seahub.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 /opt/seafile_rt/seafile-server-latest/seahub;
        }
    }
    
    删除nginx默认代理配置
    $ sudo rm /etc/nginx/sites-enabled/default  
    
    创建符号链接
    $ sudo ln -s /etc/nginx/sites-available/seafile.conf /etc/nginx/sites-enabled/seafile.conf 
    

七、启动seafile

  1. 启动 Seafile
    $ sudo ./seafile.sh start
    
    报错
    ** Message: seafile-controller.c(1155): loading seafdav config from /opt/seafile_rt/conf/seafdav.conf
    
    ccnet-server: error while loading shared libraries: libssl3.so: cannot open shared object file: No such   file or directory
    failed to run "ccnet-server -t"
    
    安装缺少的库文件
    $ sudo apt install libnss3
    
    再次启动seafile,成功。
  2. 继续启动seahub
    $ sudo ./seahub.sh start
    
    报错
    /opt/seafile_rt/ccnet/seafile.ini not found. Now quit
    
    seahub 服务提供一种类似于 debug 的启动方式,可详细展现 seahub 服务启动的过程,方法是在 seafile server 部署路径下执行如下命令:
    ./seahub.sh start-fastcgi
    
    得到
    LC_ALL is not set in ENV, set to en_US.UTF-8
    ./seahub.sh:行231: 警告:setlocale:LC_ALL:无法改变区域选项 (en_US.UTF-8):没有那个文件或目录
    Starting seahub (fastcgi) at 127.0.0.1:8000 ...
    ……
    ImportError: libpython2.7.so.1.0: cannot open shared object file: No such file or directory
    Error:Seahub failed to start.
    
    缺少libpython2.7的依赖,安装之
    sudo apt install libpython2.7
    
    再次启动seahub,成功。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章