본문 바로가기
서버/리눅스 서버

Seafile Server 설치하기 (init.d / Apache2 proxy / Debian 9 Stretch)

by ㅋㅋ잠자 2018. 12. 19.
반응형

안녕하세요. 이번에는 데비안9에 Seafile 서버를 설치해 보겠습니다.


다음으로 프록시 설정까지 알아보겠습니다.






1. Seafile 설치하기


# 설치파일 다운로드

root@djjproject:~# wget https://download.seadrive.org/seafile-server_6.3.4_x86-64.tar.gz

--2018-12-19 21:03:34--  https://download.seadrive.org/seafile-server_6.3.4_x86-64.tar.gz

Resolving download.seadrive.org (download.seadrive.org)... 104.18.59.193, 104.18.58.193, 2606:4700:30::6812:3ac1, ...

Connecting to download.seadrive.org (download.seadrive.org)|104.18.59.193|:443... connected.

HTTP request sent, awaiting response... 200 OK

Length: 55194233 (53M) [application/x-tar]

Saving to: ‘seafile-server_6.3.4_x86-64.tar.gz’


seafile-server_6.3.4_x86-64.tar.gz 100%[===============================================================>]  52.64M  9.49MB/s    in 5.6s    


2018-12-19 21:03:39 (9.45 MB/s) - ‘seafile-server_6.3.4_x86-64.tar.gz’ saved [55194233/55194233]


# /home/seafile 에 압축 해제

root@djjproject:~# tar xf seafile-server_6.3.4_x86-64.tar.gz -C /home/seafile/


# 해당 폴더로 이동

root@djjproject:~# cd /home/seafile/seafile-server-6.3.4/

root@djjproject:/home/seafile/seafile-server-6.3.4#


# 의존성 패키지 설치

root@djjproject:/home/seafile/seafile-server-6.3.4# apt-get install python2.7 libpython2.7 python-setuptools python-ldap python-urllib3 python-pip sqlite3 python-requests python-imaging

Reading package lists... Done

Building dependency tree       

Reading state information... Done

The following additional packages will be installed:

  binutils build-essential bzip2 cpp cpp-6 dpkg-dev fakeroot file g++ g++-6 gcc gcc-6 gir1.2-glib-2.0 libalgorithm-diff-perl

  libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan3 libatomic1 libc-dev-bin libc6-dev libcc1-0 libcilkrts5 libdbus-glib-1-2

  libdpkg-perl libexpat1-dev libfakeroot libfile-fcntllock-perl libgcc-6-dev libgirepository-1.0-1 libglib2.0-0 libglib2.0-data libgomp1

  libicu57 libisl15 libitm1 libldap-2.4-2 libldap-common liblsan0 libmagic-mgc libmagic1 libmpc3 libmpfr4 libmpx2 libperl5.24

  libpython-all-dev libpython-dev libpython-stdlib libpython2.7-dev libpython2.7-minimal libpython2.7-stdlib libquadmath0 libsasl2-2

  libsasl2-modules libsasl2-modules-db libstdc++-6-dev libtsan0 libubsan0 libxml2 linux-libc-dev make manpages manpages-dev mime-support

  patch perl perl-modules-5.24 python python-all python-all-dev python-cffi-backend python-chardet python-crypto python-cryptography

  python-dbus python-dev python-enum34 python-gi python-idna python-ipaddress python-keyring python-keyrings.alt python-minimal

  python-openssl python-pip-whl python-pkg-resources python-pyasn1 python-secretstorage python-six python-wheel python-xdg python2.7-dev

  python2.7-minimal rename sgml-base shared-mime-info xdg-user-dirs xml-core xz-utils

Suggested packages:

  binutils-doc bzip2-doc cpp-doc gcc-6-locales debian-keyring g++-multilib g++-6-multilib gcc-6-doc libstdc++6-6-dbg gcc-multilib

  autoconf automake libtool flex bison gdb gcc-doc gcc-6-multilib libgcc1-dbg libgomp1-dbg libitm1-dbg libatomic1-dbg libasan3-dbg

  liblsan0-dbg libtsan0-dbg libubsan0-dbg libcilkrts5-dbg libmpx2-dbg libquadmath0-dbg glibc-doc libsasl2-modules-gssapi-mit

  | libsasl2-modules-gssapi-heimdal libsasl2-modules-ldap libsasl2-modules-otp libsasl2-modules-sql libstdc++-6-doc make-doc man-browser

  ed diffutils-doc perl-doc libterm-readline-gnu-perl | libterm-readline-perl-perl python-doc python-tk python-crypto-dbg

  python-crypto-doc python-cryptography-doc python-cryptography-vectors python-dbus-dbg python-dbus-doc python-enum34-doc python-gi-cairo

  gnome-keyring libkf5wallet-bin gir1.2-gnomekeyring-1.0 python-fs python-gdata python-kde4 python-keyczar python-ldap-doc

  python-openssl-doc python-openssl-dbg doc-base python-socks python-secretstorage-doc python-setuptools-doc python-ntlm python2.7-doc

  binfmt-support sgml-base-doc sqlite3-doc debhelper

The following NEW packages will be installed:

  binutils build-essential bzip2 cpp cpp-6 dpkg-dev fakeroot file g++ g++-6 gcc gcc-6 gir1.2-glib-2.0 libalgorithm-diff-perl

  libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan3 libatomic1 libc-dev-bin libc6-dev libcc1-0 libcilkrts5 libdbus-glib-1-2

  libdpkg-perl libexpat1-dev libfakeroot libfile-fcntllock-perl libgcc-6-dev libgirepository-1.0-1 libglib2.0-0 libglib2.0-data libgomp1

  libicu57 libisl15 libitm1 libldap-2.4-2 libldap-common liblsan0 libmagic-mgc libmagic1 libmpc3 libmpfr4 libmpx2 libperl5.24

  libpython-all-dev libpython-dev libpython-stdlib libpython2.7 libpython2.7-dev libpython2.7-minimal libpython2.7-stdlib libquadmath0

  libsasl2-2 libsasl2-modules libsasl2-modules-db libstdc++-6-dev libtsan0 libubsan0 libxml2 linux-libc-dev make manpages manpages-dev

  mime-support patch perl perl-modules-5.24 python python-all python-all-dev python-cffi-backend python-chardet python-crypto

  python-cryptography python-dbus python-dev python-enum34 python-gi python-idna python-ipaddress python-keyring python-keyrings.alt

  python-ldap python-minimal python-openssl python-pip python-pip-whl python-pkg-resources python-pyasn1 python-requests

  python-secretstorage python-setuptools python-six python-urllib3 python-wheel python-xdg python2.7 python2.7-dev python2.7-minimal

  rename sgml-base shared-mime-info sqlite3 xdg-user-dirs xml-core xz-utils

0 upgraded, 106 newly installed, 0 to remove and 0 not upgraded.

Need to get 103 MB of archives.

After this operation, 345 MB of additional disk space will be used.

Do you want to continue? [Y/n] 


# Seafile Server 설치 과정

root@djjproject:/home/seafile/seafile-server-6.3.4# ./setup-seafile.sh

-----------------------------------------------------------------

This script will guide you to config and setup your seafile server.


Make sure you have read seafile server manual at 


https://github.com/haiwen/seafile/wiki


Note: This script will guide your to setup seafile server using sqlite3,

which may have problems if your disk is on a NFS/CIFS/USB.

In these cases, we sugguest you setup seafile server using MySQL.


Press [ENTER] to continue

-----------------------------------------------------------------



Checking packages needed by seafile ...


Checking python on this machine ...

Find python: python2.7


  Checking python module: setuptools ... Done.

  Checking python module: python-imaging ... Done.

  Checking python module: python-sqlite3 ... Done.


Checking for sqlite3 ...Done.


Checking Done.



What would you like to use as the name of this seafile server?

Your seafile users will be able to see the name in their seafile client.

You can use a-z, A-Z, 0-9, _ and -, and the length should be 3 ~ 15


# 원하는 서버 이름 입력

[server name]: djjproject


What is the ip or domain of this server?

For example, www.mycompany.com, or, 192.168.1.101


# 서버 도메인 혹은 아이피 정보 입력

[This server's ip or domain]: mycloud.djjproject.com


Where would you like to store your seafile data? 

Note: Please use a volume with enough free space.


# 데이터 저장 경로 설정

[default: /home/seafile/seafile-data ] /media/seafile


What tcp port do you want to use for seafile fileserver?

8082 is the recommended port.


# 포트 설정 (비워두면 기본 설정으로 진행)

[default: 8082 ] 



This is your config information:


server name:        djjproject

server ip/domain:   mycloud.djjproject.com

seafile data dir:   /media/seafile

fileserver port:    8082


If you are OK with the configuration, press [ENTER] to continue.


Generating ccnet configuration in /home/seafile/ccnet...


done

Successly create configuration dir /home/seafile/ccnet.


Generating seafile configuration in /media/seafile ...


Done.


-----------------------------------------------------------------

Seahub is the web interface for seafile server.

Now let's setup seahub configuration. Press [ENTER] to continue

-----------------------------------------------------------------



Creating seahub database now, it may take one minute, please wait... 



Done.


creating seafile-server-latest symbolic link ... done



-----------------------------------------------------------------

Your seafile server configuration has been completed successfully.

-----------------------------------------------------------------


run seafile server:     ./seafile.sh { start | stop | restart }

run seahub  server:     ./seahub.sh  { start <port> | stop | restart <port> }


-----------------------------------------------------------------

If the server is behind a firewall, remember to open these tcp ports:

-----------------------------------------------------------------


port of seafile fileserver:   8082

port of seahub:               8000


When problems occur, refer to


      https://github.com/haiwen/seafile/wiki


for more information.


root@djjproject:/home/seafile/seafile-server-6.3.4# 


# Seafile Server 시작

root@djjproject:/home/seafile/seafile-server-6.3.4# ./seafile.sh start


[12/19/18 21:15:07] ../common/session.c(132): using config file /home/seafile/conf/ccnet.conf

Starting seafile server, please wait ...

Seafile server started


Done.


# SeaHub 시작

root@djjproject:/home/seafile/seafile-server-6.3.4# ./seahub.sh start


LC_ALL is not set in ENV, set to en_US.UTF-8

Starting seahub at port 8000 ...


----------------------------------------

It's the first time you start the seafile server. Now let's create the admin account

----------------------------------------


# 관리자 계정 설정

What is the email for the admin account?

[ admin email ] djj9405@naver.com


What is the password for the admin account?

[ admin password ] 


Enter the password again:

[ admin password again ] 




----------------------------------------

Successfully created seafile admin

----------------------------------------





Seahub is started


Done.


테스트 진행 : 정상






2. Apache2 프록시 설정 (with SSL)


# 홈폴더로 이동

root@djjproject:/home/seafile/seafile-server-6.3.4# cd ~


# apache2 설치

root@djjproject:~# apt-get install apache2

Reading package lists... Done

Building dependency tree       

Reading state information... Done

The following additional packages will be installed:

  apache2-bin apache2-data apache2-utils libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.2-0 libnghttp2-14 ssl-cert

Suggested packages:

  www-browser apache2-doc apache2-suexec-pristine | apache2-suexec-custom openssl-blacklist

The following NEW packages will be installed:

  apache2 apache2-bin apache2-data apache2-utils libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.2-0 libnghttp2-14

  ssl-cert

0 upgraded, 11 newly installed, 0 to remove and 0 not upgraded.

Need to get 2,230 kB of archives.

After this operation, 7,364 kB of additional disk space will be used.

Do you want to continue? [Y/n] 

Get:1 http://debian-archive.trafficmanager.net/debian stretch/main amd64 libapr1 amd64 1.5.2-5 [96.6 kB]

Get:2 http://debian-archive.trafficmanager.net/debian stretch/main amd64 libaprutil1 amd64 1.5.4-3 [85.8 kB]

Get:3 http://debian-archive.trafficmanager.net/debian stretch/main amd64 libaprutil1-dbd-sqlite3 amd64 1.5.4-3 [19.3 kB]

Get:4 http://debian-archive.trafficmanager.net/debian stretch/main amd64 libaprutil1-ldap amd64 1.5.4-3 [17.4 kB]

Get:5 http://debian-archive.trafficmanager.net/debian stretch/main amd64 liblua5.2-0 amd64 5.2.4-1.1+b2 [110 kB]

Get:6 http://debian-archive.trafficmanager.net/debian stretch/main amd64 libnghttp2-14 amd64 1.18.1-1 [79.1 kB]

Get:7 http://debian-archive.trafficmanager.net/debian stretch/main amd64 apache2-bin amd64 2.4.25-3+deb9u6 [1,186 kB]

Get:8 http://debian-archive.trafficmanager.net/debian stretch/main amd64 apache2-utils amd64 2.4.25-3+deb9u6 [217 kB]

Get:9 http://debian-archive.trafficmanager.net/debian stretch/main amd64 apache2-data all 2.4.25-3+deb9u6 [162 kB]

Get:10 http://debian-archive.trafficmanager.net/debian stretch/main amd64 apache2 amd64 2.4.25-3+deb9u6 [236 kB]

Get:11 http://debian-archive.trafficmanager.net/debian stretch/main amd64 ssl-cert all 1.0.39 [20.8 kB]

Fetched 2,230 kB in 0s (2,839 kB/s)

Preconfiguring packages ...

Selecting previously unselected package libapr1:amd64.

(Reading database ... 29980 files and directories currently installed.)

Preparing to unpack .../00-libapr1_1.5.2-5_amd64.deb ...

Unpacking libapr1:amd64 (1.5.2-5) ...

Selecting previously unselected package libaprutil1:amd64.

Preparing to unpack .../01-libaprutil1_1.5.4-3_amd64.deb ...

Unpacking libaprutil1:amd64 (1.5.4-3) ...

Selecting previously unselected package libaprutil1-dbd-sqlite3:amd64.

Preparing to unpack .../02-libaprutil1-dbd-sqlite3_1.5.4-3_amd64.deb ...

Unpacking libaprutil1-dbd-sqlite3:amd64 (1.5.4-3) ...

Selecting previously unselected package libaprutil1-ldap:amd64.

Preparing to unpack .../03-libaprutil1-ldap_1.5.4-3_amd64.deb ...

Unpacking libaprutil1-ldap:amd64 (1.5.4-3) ...

Selecting previously unselected package liblua5.2-0:amd64.

Preparing to unpack .../04-liblua5.2-0_5.2.4-1.1+b2_amd64.deb ...

Unpacking liblua5.2-0:amd64 (5.2.4-1.1+b2) ...

Selecting previously unselected package libnghttp2-14:amd64.

Preparing to unpack .../05-libnghttp2-14_1.18.1-1_amd64.deb ...

Unpacking libnghttp2-14:amd64 (1.18.1-1) ...

Selecting previously unselected package apache2-bin.

Preparing to unpack .../06-apache2-bin_2.4.25-3+deb9u6_amd64.deb ...

Unpacking apache2-bin (2.4.25-3+deb9u6) ...

Selecting previously unselected package apache2-utils.

Preparing to unpack .../07-apache2-utils_2.4.25-3+deb9u6_amd64.deb ...

Unpacking apache2-utils (2.4.25-3+deb9u6) ...

Selecting previously unselected package apache2-data.

Preparing to unpack .../08-apache2-data_2.4.25-3+deb9u6_all.deb ...

Unpacking apache2-data (2.4.25-3+deb9u6) ...

Selecting previously unselected package apache2.

Preparing to unpack .../09-apache2_2.4.25-3+deb9u6_amd64.deb ...

Unpacking apache2 (2.4.25-3+deb9u6) ...

Selecting previously unselected package ssl-cert.

Preparing to unpack .../10-ssl-cert_1.0.39_all.deb ...

Unpacking ssl-cert (1.0.39) ...

Setting up libapr1:amd64 (1.5.2-5) ...

Setting up libnghttp2-14:amd64 (1.18.1-1) ...

Setting up apache2-data (2.4.25-3+deb9u6) ...

Setting up ssl-cert (1.0.39) ...

Processing triggers for libc-bin (2.24-11+deb9u3) ...

Setting up libaprutil1:amd64 (1.5.4-3) ...

Processing triggers for systemd (232-25+deb9u6) ...

Setting up liblua5.2-0:amd64 (5.2.4-1.1+b2) ...

Setting up libaprutil1-ldap:amd64 (1.5.4-3) ...

Setting up libaprutil1-dbd-sqlite3:amd64 (1.5.4-3) ...

Setting up apache2-utils (2.4.25-3+deb9u6) ...

Setting up apache2-bin (2.4.25-3+deb9u6) ...

Setting up apache2 (2.4.25-3+deb9u6) ...

Enabling module mpm_event.

Enabling module authz_core.

Enabling module authz_host.

Enabling module authn_core.

Enabling module auth_basic.

Enabling module access_compat.

Enabling module authn_file.

Enabling module authz_user.

Enabling module alias.

Enabling module dir.

Enabling module autoindex.

Enabling module env.

Enabling module mime.

Enabling module negotiation.

Enabling module setenvif.

Enabling module filter.

Enabling module deflate.

Enabling module status.

Enabling module reqtimeout.

Enabling conf charset.

Enabling conf localized-error-pages.

Enabling conf other-vhosts-access-log.

Enabling conf security.

Enabling conf serve-cgi-bin.

Enabling site 000-default.

Created symlink /etc/systemd/system/multi-user.target.wants/apache2.service → /lib/systemd/system/apache2.service.

Created symlink /etc/systemd/system/multi-user.target.wants/apache-htcacheclean.service → /lib/systemd/system/apache-htcacheclean.service.

Processing triggers for libc-bin (2.24-11+deb9u3) ...

Processing triggers for systemd (232-25+deb9u6) ...


# 필요 웹서버 모듈 활성화

root@djjproject:~# a2enmod ssl proxy proxy_ajp proxy_http proxy_connect rewrite

Considering dependency setenvif for ssl:

Module setenvif already enabled

Considering dependency mime for ssl:

Module mime already enabled

Considering dependency socache_shmcb for ssl:

Enabling module socache_shmcb.

Enabling module ssl.

See /usr/share/doc/apache2/README.Debian.gz on how to configure SSL and create self-signed certificates.

Enabling module proxy.

Enabling module rewrite.

Considering dependency proxy for proxy_ajp:

Module proxy already enabled

Enabling module proxy_ajp.

Considering dependency proxy for proxy_http:

Module proxy already enabled

Enabling module proxy_http.

Considering dependency proxy for proxy_connect:

Module proxy already enabled

Enabling module proxy_connect.

To activate the new configuration, you need to run:

  systemctl restart apache2


아래는 예시입니다. 제 환경의 경우 80번 포트가 막혀 있어서 작동이 되지 않습니다. 포트 부분은 신경쓰셔서 바꾸시길 바랍니다.


1. mycloud.djjproject.com:80 으로 접근 시, mycloud.djjproject.com:443 으로 이동하는 가상호스트 설정


2. https ssl 가상호스트 설정


# 가상 호스트 파일 작성

root@djjproject:~# nano /etc/apache2/sites-available/seafile.conf


<Virtualhost *:80>

  ServerName mycloud.djjproject.com

  RewriteEngine On

  RewriteCond %{HTTPS} off

  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

</VirtualHost>


<VirtualHost *:443>

  ServerName mycloud.djjproject.com

  DocumentRoot /var/www/html


  SSLEngine On

  SSLCertificateFile /etc/apache2/ssl/apache.crt

  SSLCertificateKeyFile /etc/apache2/ssl/apache.key


  Alias /media  /home/seafile/seafile-server-latest/seahub/media


  <Location /media>

    Require all granted

  </Location>


  RewriteEngine On


  #

  # seafile fileserver

  #

  ProxyPass /seafhttp http://127.0.0.1:8082

  ProxyPassReverse /seafhttp http://127.0.0.1:8082

  RewriteRule ^/seafhttp - [QSA,L]


  #

  # seahub

  #

  SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1

  ProxyPreserveHost On

  ProxyPass / http://127.0.0.1:8000/

  ProxyPassReverse / http://127.0.0.1:8000/

</VirtualHost>




# 셀프 싸인 인증서 생성

root@djjproject:~# openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt

Generating a RSA private key

..................+++++

.........+++++

writing new private key to '/etc/apache2/ssl/apache.key'

-----

You are about to be asked to enter information that will be incorporated

into your certificate request.

What you are about to enter is what is called a Distinguished Name or a DN.

There are quite a few fields but you can leave some blank

For some fields there will be a default value,

If you enter '.', the field will be left blank.

-----

Country Name (2 letter code) [AU]:

State or Province Name (full name) [Some-State]:

Locality Name (eg, city) []:

Organization Name (eg, company) [Internet Widgits Pty Ltd]:

Organizational Unit Name (eg, section) []:

Common Name (e.g. server FQDN or YOUR name) []:

Email Address []:


# ccnet.conf 파일 수정

root@djjproject:~# nano /home/seafile/conf/ccnet.conf


[General]

USER_NAME = djjproject

ID = de4eb83483e038c337f0ee3e5b0ea55599dfab05

NAME = djjproject

SERVICE_URL = https://mycloud.djjproject.com    


[Client]

PORT = 13419


# seahub_settings.py 에 설정 라인 추가

root@djjproject:~# nano /home/seafile/conf/seahub_settings.py


# -*- coding: utf-8 -*-

SECRET_KEY = "26(_yrqw-i2*_5sn_mgyl&84#)dg8a#a12(teol#q!pxy&4#v6"

FILE_SERVER_ROOT = 'https://mycloud.djjproject.com/seafhttp'


실제로 제 환경은 그렇지 않음으로 아래와 같이 수정합니다. 30000번 포트로 서비스 해보겠습니다.


# 가상호스트 파일 약간 ? 수정

root@djjproject:~# nano /etc/apache2/sites-available/seafile.conf


#<Virtualhost *:80>

#  ServerName mycloud.djjproject.com

#  RewriteEngine On

#  RewriteCond %{HTTPS} off

#  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

#</VirtualHost>


<VirtualHost *:30000>

  ServerName mycloud.djjproject.com

  DocumentRoot /var/www/html


  SSLEngine On

  SSLCertificateFile /etc/apache2/ssl/apache.crt

  SSLCertificateKeyFile /etc/apache2/ssl/apache.key


  Alias /media  /home/seafile/seafile-server-latest/seahub/media


  <Location /media>

    Require all granted

  </Location>


  RewriteEngine On


  #

  # seafile fileserver

  #

  ProxyPass /seafhttp http://127.0.0.1:8082

  ProxyPassReverse /seafhttp http://127.0.0.1:8082

  RewriteRule ^/seafhttp - [QSA,L]


  #

  # seahub

  #

  SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1

  ProxyPreserveHost On

  ProxyPass / http://127.0.0.1:8000/

  ProxyPassReverse / http://127.0.0.1:8000/

</VirtualHost>


# ccnet.conf 파일 수정

root@djjproject:~# nano /home/seafile/conf/ccnet.conf 


[General]

USER_NAME = djjproject

ID = de4eb83483e038c337f0ee3e5b0ea55599dfab05

NAME = djjproject

SERVICE_URL = https://mycloud.djjproject.com:30000


[Client]

PORT = 13419


# seahub_settings.py 수정

root@djjproject:~# nano /home/seafile/conf/seahub_settings.py


# -*- coding: utf-8 -*-

SECRET_KEY = "26(_yrqw-i2*_5sn_mgyl&84#)dg8a#a12(teol#q!pxy&4#v6"

FILE_SERVER_ROOT = 'https://mycloud.djjproject.com:30000/seafhttp'


# apache2 리스닝 포트 30000 추가

root@djjproject:~# nano /etc/apache2/ports.conf 


# If you just change the port or add more ports here, you will likely also

# have to change the VirtualHost statement in

# /etc/apache2/sites-enabled/000-default.conf


Listen 80

Listen 30000


<IfModule ssl_module>

        Listen 443

</IfModule>


<IfModule mod_gnutls.c>

        Listen 443

</IfModule>


# vim: syntax=apache ts=4 sw=4 sts=4 sr noet


# 만든 가상호스트 파일 활성화

root@djjproject:~# a2ensite seafile.conf

Enabling site seafile.

To activate the new configuration, you need to run:

  systemctl reload apache2


# 전체 서비스 재시작

root@djjproject:~# /home/seafile/seafile-server-latest/seafile.sh stop


Stopping seafile server ...

Done.

root@djjproject:~# /home/seafile/seafile-server-latest/seafile.sh start


[12/19/18 21:38:01] ../common/session.c(132): using config file /home/seafile/conf/ccnet.conf

Starting seafile server, please wait ...

Seafile server started


Done.

root@djjproject:~# /home/seafile/seafile-server-latest/seahub.sh stop


Stopping seahub ...

Done.


root@djjproject:~# /home/seafile/seafile-server-latest/seahub.sh start


LC_ALL is not set in ENV, set to en_US.UTF-8

Starting seahub at port 8000 ...


Seahub is started


Done.


root@djjproject:~# service apache2 restart


정상 작동을 확인합니다. 셀프싸인 인증서라 위험하다는 에러가 뜨고 있습니다. 이 에러가 보기 싫으시면 Let's Encrypt 로 인증서를 만드시길 바랍니다.







3. init.d 스크립트 만들기


음.. systemd 스크립트가 훨씬 편합니다만, U5PVR 을 위해서 init.d 스크립트를 작성해 보았습니다.


# seafile 서비스 작성

root@djjproject:~# nano /etc/init.d/seafile


#!/bin/sh


### BEGIN INIT INFO

# Provides:          seafile

# Required-Start:    $local_fs $remote_fs $network

# Required-Stop:     $local_fs

# Default-Start:     2 3 4 5

# Default-Stop:      0 1 6

# Short-Description: Starts Seafile Server

# Description:       starts Seafile Server

### END INIT INFO


# Change the value of "user" to linux user name who runs seafile

user=root


# Change the value of "seafile_dir" to your path of seafile installation

# usually the home directory of $user

seafile_dir=/home/seafile

script_path=${seafile_dir}/seafile-server-latest

seafile_init_log=${seafile_dir}/logs/seafile.init.log

seahub_init_log=${seafile_dir}/logs/seahub.init.log


# Change the value of fastcgi to true if fastcgi is to be used

fastcgi=false

# Set the port of fastcgi, default is 8000. Change it if you need different.

fastcgi_port=8000


#

# Write a polite log message with date and time

#

echo -e "\n \n About to perform $1 for seafile at `date -Iseconds` \n " >> ${seafile_init_log}

echo -e "\n \n About to perform $1 for seahub at `date -Iseconds` \n " >> ${seahub_init_log}


case "$1" in

        start)

                sudo -u ${user} ${script_path}/seafile.sh ${1} >> ${seafile_init_log}

                if [ $fastcgi = true ];

                then

                        sudo -u ${user} ${script_path}/seahub.sh ${1}-fastcgi ${fastcgi_port} >> ${seahub_init_log}

                else

                        sudo -u ${user} ${script_path}/seahub.sh ${1} >> ${seahub_init_log}

                fi

        ;;

        restart)

                sudo -u ${user} ${script_path}/seafile.sh ${1} >> ${seafile_init_log}

                if [ $fastcgi = true ];

                then

                        sudo -u ${user} ${script_path}/seahub.sh ${1}-fastcgi ${fastcgi_port} >> ${seahub_init_log}

                else

                        sudo -u ${user} ${script_path}/seahub.sh ${1} >> ${seahub_init_log}

                fi

        ;;

        stop)

                sudo -u ${user} ${script_path}/seahub.sh ${1} >> ${seahub_init_log}

                sudo -u ${user} ${script_path}/seafile.sh ${1} >> ${seafile_init_log}

        ;;

        *)

                echo "Usage: /etc/init.d/seafile-server {start|stop|restart}"

                exit 1

        ;;

esac



# 만든 스크립트에 실행권한 주기

root@djjproject:~# chmod a+x /etc/init.d/seafile

# 서비스에 등록하기

root@djjproject:~# update-rc.d seafile defaults





4. 파일 백업을 위한 fuse 마운트?


root@djjproject:~# /home/seafile/seafile-server-latest/seaf-fuse.sh start /media/seafile_fuse


Starting seaf-fuse, please wait ...

seaf-fuse started


Done.

root@djjproject:~# cd /media/seafile_fuse/

root@djjproject:/media/seafile_fuse# ls

djj9405@naver.com

root@djjproject:/media/seafile_fuse# cd djj9405\@naver.com/1b6a35e1-4da2-42b9-a773-d2653016c347_내\ 라 이브러리/

root@djjproject:/media/seafile_fuse/djj9405@naver.com/1b6a35e1-4da2-42b9-a773-d2653016c347_내 라이브러리

# ls

seafile-tutorial.doc  트와이스-YES or YES(181109_뮤뱅).mp4  트와이스-YES or YES(181111_인가).mp4

root@djjproject:/media/seafile_fuse/djj9405@naver.com/1b6a35e1-4da2-42b9-a773-d2653016c347_내 라이브러리


조각된 파일들이 실제 파일처럼 잘 보이고 있습니다.




여기까지 ㅎㅎ 마치겠습니다.


반응형

댓글