部署Seafile專業版(三用戶免費)

前言:是國內團隊開發、國際領先的開源企業云存儲軟件,為企業提供私有云環境下的網盤解決方案,滿足文件集中管理、多終端訪問、共享協作等需求。普通版本的功能比較簡單,與之相比專業版的強大自然是我們的首選。Seafile的專業版本實際上不需要付費也可以使用,只是在用戶數上有所限制,三用戶滿足需求的情況下完全可以使用。

環境:CentOS 7及7.x版本,JAVA環境jdk1.7或更高版本

下載Seafile專業版server https://download.seafile.com/d/06d4ca0272/

wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
yum install java-1.7.0-openjdk poppler-utils python-setuptools python-imaging MySQL-python mariadb-server python-memcached python-ldap python-urllib3
pip install boto

安裝mariadb

yum -y install mariadb mariadb-server
systemctl start mariadb

獲取專業版許可證書,放置在頂層目錄下
(Seafile專業版無許可證書的情況下允許最多創建三個用戶)

現在的目錄結構應該像如下這樣:

haiwen
├── seafile-license.txt
└── seafile-pro-server_6.1.7/

安裝NGINX(我使用了源碼安裝,可以參考這篇http://www.lxweimin.com/p/4699bcb04633

yum install -y apr* autoconf automake bison bzip2 bzip2*  cloog-ppl compat* cpp curl curl-devel fontconfig   fontconfig-devel freetype freetype* freetype-devel  gcc gcc-c++ gtk+-devel gd gettext gettext-devel   glibc kernel kernel-headers keyutils keyutils-libs-devel  krb5-devel libcom_err-devel libpng libpng-devel libjpeg*   libsepol-devel libselinux-devel libstdc++-devel libtool*   libgomp libxml2 libxml2-devel libXpm* libtiff libtiff* make  mpfr ncurses* ntp openssl openssl-devel patch pcre-devel   perl php-common php-gd policycoreutils telnet t1lib t1lib* nasm nasm* wget zlib-devel
mkdir /usr/local/src
mv * /usr/local/src
cd /usr/local/src
tar zxvf pcre-8.41.tar.gz 
mkdir /usr/local/pcre
cd pcre-8.41/
./configure --prefix=/usr/local/pcre
make
make install
cd ..
mkdir /usr/local/openssl
tar zxvf openssl-1.0.1h.tar.gz
cd openssl-1.0.1h
./config --prefix=/usr/local/openssl/
make
make install
vim /etc/profile
. /etc/profile
cd ..
mkdir /usr/local/zlib
tar zxvf zlib-1.2.11.tar.gz
cd zlib-1.2.11/
./configure --prefix=/usr/local/zlib
make
make install
cd ..
tar zxvf nginx-1.8.0.tar.gz
cd nginx-1.8.0
./configure --prefix=/usr/local/nginx --without-http_memcached_module --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-openssl=/usr/local/src/openssl-1.0.1h --with-zlib=/usr/local/src/zlib-1.2.11 --with-pcre=/usr/local/src/pcre-8.41
make
make install
/usr/local/nginx/sbin/nginx
groupadd www
useradd -g www www -s /bin/false
/usr/local/nginx/sbin/nginx
vim /etc/rc.d/init.d/nginx
chmod 775 /etc/rc.d/init.d/nginx
chkconfig nginx on

安裝Seafile并使用MySQL數據庫

mkdir haiwen
mv seafile-pro-server_6.1.7_x86-64.tar.gz haiwen/
cd haiwen
tar xf seafile-pro-server_6.1.7_x86-64.tar.gz
mkdir installed
mv seafile-pro-server_6.1.7_x86-64.tar.gz installed

現在,你的目錄看起來應該像這樣

├── installed
│   └── seafile-pro-server_6.1.7_x86-64.tar.gz
└── seafile-server-6.1.7
    ├── reset-admin.sh
    ├── runtime
    ├── seafile
    ├── seafile.sh
    ├── seahub
    ├── seahub.sh
    ├── setup-seafile.sh
    └── upgrade

這樣設計目錄的好處在于
和 seafile 相關的配置文件都可以放在 haiwen 目錄下,便于集中管理.
后續升級時,你只需要解壓最新的安裝包到 haiwen 目錄下.

yum install -y mariadb-server
yum install -y python-setuptools python-imaging python-ldap MySQL-python python-memcached python-urllib3
cd seafile-server-6.1.7
./setup-seafile-mysql.sh

該腳本會依次詢問你一些問題,從而一步步引導你配置 Seafile 的各項參數:

1.seafile server name
seafile 服務器的名字,目前該配置已經不再使用
3 ~ 15 個字符,可以用英文字母,數字,下劃線
2.seafile server ip or domain
seafile 服務器的 IP 地址或者域名
客戶端將通過這個 IP 或者地址來訪問你的 Seafile 服務
3.seafile data dir
seafile 數據存放的目錄,用上面的例子,默認將是 /data/haiwen/seafile-data
seafile 數據將隨著使用而逐漸增加,請把它放在一個有足夠大空閑空間的分區上
4.seafile fileserver port
seafile fileserver 使用的 TCP 端口
該端口用于文件同步,請使用默認的 8082,不能更改。

在這里, 你會被要求選擇一種創建 Seafile 數據庫的方式:

-------------------------------------------------------
Please choose a way to initialize seafile databases:
-------------------------------------------------------

[1] Create new ccnet/seafile/seahub databases
[2] Use existing ccnet/seafile/seahub databases

如果選擇1, 你需要提供根密碼. 腳本程序會創建數據庫和用戶。
如果選擇2, ccnet/seafile/seahub 數據庫應該已經被你(或者其他人)提前創建。

啟動 Seafile 服務器
./seafile.sh start #啟動 Seafile 服務
./seahub.sh start <port>  #啟動 Seahub 網站 (默認運行在8000端口上)
vim /usr/local/nginx/conf/nginx.conf
    server {
        listen       80;
        server_name  localhost;
        proxy_set_header X-Forwarded-For $remote_addr;
        location / {
        root   html;
        index  index.html index.htm;
        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;

        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_connect_timeout  36000s;
        proxy_read_timeout  36000s;
        proxy_request_buffering off;
    }

    location /media {
        root /seafile/seafile-server-latest/seahub;
    }
}
/usr/local/nginx/sbin/nginx -s reload
訪問IP:8000即可
seafile

寫在結尾:非常有意思的是,Seafile支持更換logo,企業使用是非常不錯的

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容