본문 바로가기
AndroidOverLinux

Seafile Server 설치하기

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

-- 테스트 하다 보니 가이드에 8000번 포트 사용으로 되어 있네요. 만랩이시니 금방 캐치할 수 있다고 믿습니다!!

-- 배포의 경우, 도메인이 있으면 Apache2 나 Nginx 의 프록시를 이용하시면 더욱 더 좋습니다.

-- 포트포워딩의 경우 8082 포트는 앱단에서 사용하기 때문에 열어 두셔야 합니다.

-- Seahub 는 일종의 웹 클라이언트 입니다.


안녕하세요. 


Seafile Server 를 설치해 보겠습니다.





1. 의존성 패키지 설치


root@AOL-Debian:~# apt-get update && apt-get install python2.7 libpython2.7 python-setuptools python-ldap python-urllib3 sqlite3 python-requests python-imaging -y

Ign http://httpredir.debian.org jessie InRelease                              

Get:1 http://httpredir.debian.org jessie-backports InRelease [166 kB]

Hit http://httpredir.debian.org jessie Release.gpg      

Get:2 https://dev2day.de jessie InRelease [1,803 B] 

Hit http://httpredir.debian.org jessie Release                                     

Get:3 http://httpredir.debian.org jessie-backports/main Sources/DiffIndex [27.8 kB]

Get:4 https://dev2day.de jessie/main armhf Packages [970 B]

Get:5 http://www.lesbonscomptes.com jessie InRelease [3,815 B]        

Ign http://www.lesbonscomptes.com jessie InRelease                                 

Get:6 http://httpredir.debian.org jessie-backports/contrib Sources/DiffIndex [27.8 kB]

Get:7 https://dev2day.de jessie/main Translation-en_US [323 B]                 

Get:8 http://httpredir.debian.org jessie-backports/non-free Sources/DiffIndex [26.0 kB]                             

Get:9 https://dev2day.de jessie/main Translation-en [320 B]               

Get:10 http://httpredir.debian.org jessie-backports/main armhf Packages/DiffIndex [27.8 kB]

Get:11 http://www.lesbonscomptes.com jessie/main Sources/DiffIndex [362 B]       

Ign http://www.lesbonscomptes.com jessie/main Sources/DiffIndex

Get:12 https://dev2day.de jessie/main Translation-en_US [323 B]

Get:13 http://www.lesbonscomptes.com jessie/main armhf Packages/DiffIndex [369 B]

Ign http://www.lesbonscomptes.com jessie/main armhf Packages/DiffIndex

Get:14 https://dev2day.de jessie/main Translation-en [320 B]          

Get:15 http://httpredir.debian.org jessie-backports/contrib armhf Packages/DiffIndex [26.7 kB]         

Get:16 http://www.lesbonscomptes.com jessie/main Translation-en_US [363 B]       

Get:17 https://dev2day.de jessie/main Translation-en_US [323 B]      

Get:18 http://httpredir.debian.org jessie-backports/non-free armhf Packages/DiffIndex [8,530 B]          

Get:19 http://www.lesbonscomptes.com jessie/main Translation-en [360 B]     

Get:20 http://httpredir.debian.org jessie-backports/contrib Translation-en/DiffIndex [7,960 B]

Get:21 https://dev2day.de jessie/main Translation-en [320 B]                            

Get:22 http://httpredir.debian.org jessie-backports/main Translation-en/DiffIndex [27.8 kB]

Get:23 http://www.lesbonscomptes.com jessie/main Sources [355 B]                       

Get:24 https://dev2day.de jessie/main Translation-en_US [323 B]

Get:25 http://httpredir.debian.org jessie-backports/non-free Translation-en/DiffIndex [19.1 kB]

Hit http://httpredir.debian.org jessie/main Sources                                    

Get:26 http://www.lesbonscomptes.com jessie/main armhf Packages [362 B]            

Get:27 https://dev2day.de jessie/main Translation-en [320 B]                                                  

Hit http://httpredir.debian.org jessie/contrib Sources                                                        

Get:28 http://www.lesbonscomptes.com jessie/main Translation-en_US [363 B]                                                                

Get:29 https://dev2day.de jessie/main Translation-en_US [323 B]                                                                           

Ign https://dev2day.de jessie/main Translation-en_US                                                                                      

Hit http://httpredir.debian.org jessie/non-free Sources                                                                                   

Get:30 http://www.lesbonscomptes.com jessie/main Translation-en [360 B]                                                                   

Get:31 https://dev2day.de jessie/main Translation-en [320 B]                                                                              

Ign https://dev2day.de jessie/main Translation-en                                                                                         

Hit http://httpredir.debian.org jessie/main armhf Packages                                                                                

Hit http://httpredir.debian.org jessie/contrib armhf Packages                                                                             

Get:32 http://www.lesbonscomptes.com jessie/main Sources [355 B]                                                                          

Hit http://httpredir.debian.org jessie/non-free armhf Packages                                                                            

Get:33 http://www.lesbonscomptes.com jessie/main armhf Packages [362 B]                                                                   

Hit http://httpredir.debian.org jessie/contrib Translation-en                                                                             

Get:34 http://www.lesbonscomptes.com jessie/main Translation-en_US [363 B]                                                                

Get:35 http://www.lesbonscomptes.com jessie/main Translation-en [360 B]                                                                   

Hit http://httpredir.debian.org jessie/main Translation-en                                                                                

Get:36 http://www.lesbonscomptes.com jessie/main Sources [355 B]                                                                          

Hit http://httpredir.debian.org jessie/non-free Translation-en                                                                            

Get:37 http://www.lesbonscomptes.com jessie/main armhf Packages [362 B]                                                                   

Get:38 http://www.lesbonscomptes.com jessie/main Translation-en_US [363 B]                                                                

Get:39 http://www.lesbonscomptes.com jessie/main Translation-en [360 B]                                                                   

Get:40 http://www.lesbonscomptes.com jessie/main Sources [355 B]                                                                          

Get:41 http://www.lesbonscomptes.com jessie/main armhf Packages [362 B]                                                                   

Get:42 http://www.lesbonscomptes.com jessie/main Translation-en_US [363 B]                                                                

Ign http://www.lesbonscomptes.com jessie/main Translation-en_US                                                                           

Get:43 http://www.lesbonscomptes.com jessie/main Translation-en [360 B]                                                                   

Ign http://www.lesbonscomptes.com jessie/main Translation-en                                                                              

Fetched 377 kB in 24s (15.4 kB/s)                                                                                                         

Reading package lists... Done

W: GPG error: http://www.lesbonscomptes.com jessie InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7808CE96D38B9201

Reading package lists... Done

Building dependency tree       

Reading state information... Done

python-urllib3 is already the newest version.

python-urllib3 set to manually installed.

libpython2.7 is already the newest version.

libpython2.7 set to manually installed.

python2.7 is already the newest version.

python2.7 set to manually installed.

python-requests is already the newest version.

Suggested packages:

  python-ldap-doc sqlite3-doc

The following NEW packages will be installed:

  python-ldap python-setuptools sqlite3

0 upgraded, 3 newly installed, 0 to remove and 7 not upgraded.

Need to get 454 kB of archives.

After this operation, 1,319 kB of additional disk space will be used.

Get:1 http://httpredir.debian.org/debian/ jessie/main python-ldap armhf 2.4.10-1 [112 kB]

Get:2 http://httpredir.debian.org/debian/ jessie/main python-setuptools all 5.5.1-1 [242 kB]

Get:3 http://httpredir.debian.org/debian/ jessie/main sqlite3 armhf 3.8.7.1-1+deb8u2 [100 kB]

Fetched 454 kB in 2s (185 kB/s)

Selecting previously unselected package python-ldap.

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

Preparing to unpack .../python-ldap_2.4.10-1_armhf.deb ...

Unpacking python-ldap (2.4.10-1) ...

Selecting previously unselected package python-setuptools.

Preparing to unpack .../python-setuptools_5.5.1-1_all.deb ...

Unpacking python-setuptools (5.5.1-1) ...

Selecting previously unselected package sqlite3.

Preparing to unpack .../sqlite3_3.8.7.1-1+deb8u2_armhf.deb ...

Unpacking sqlite3 (3.8.7.1-1+deb8u2) ...

Processing triggers for man-db (2.7.0.2-5) ...

Setting up python-ldap (2.4.10-1) ...

Setting up python-setuptools (5.5.1-1) ...

Setting up sqlite3 (3.8.7.1-1+deb8u2) ...

root@AOL-Debian:~# 





2. Seafile 서버 다운받기


https://github.com/haiwen/seafile-rpi/releases


root@AOL-Debian:~# wget https://github.com/haiwen/seafile-rpi/releases/download/v6.3.4/seafile-server_6.3.4_stable_pi.tar.gz

--2018-12-18 20:30:58--  https://github.com/haiwen/seafile-rpi/releases/download/v6.3.4/seafile-server_6.3.4_stable_pi.tar.gz

Resolving github.com (github.com)... 192.30.255.113, 192.30.255.112

Connecting to github.com (github.com)|192.30.255.113|:443... connected.

HTTP request sent, awaiting response... 302 Found

Location: https://github-production-release-asset-2e65be.s3.amazonaws.com/34115988/0a542500-cf9a-11e8-977c-497a70acf021?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20181218%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20181218T113052Z&X-Amz-Expires=300&X-Amz-Signature=4fa490732705d23742f38346ab4421b2b28ca9b41de74f0550fab3c16acd7898&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3Dseafile-server_6.3.4_stable_pi.tar.gz&response-content-type=application%2Foctet-stream [following]

--2018-12-18 20:30:59--  https://github-production-release-asset-2e65be.s3.amazonaws.com/34115988/0a542500-cf9a-11e8-977c-497a70acf021?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20181218%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20181218T113052Z&X-Amz-Expires=300&X-Amz-Signature=4fa490732705d23742f38346ab4421b2b28ca9b41de74f0550fab3c16acd7898&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3Dseafile-server_6.3.4_stable_pi.tar.gz&response-content-type=application%2Foctet-stream

Resolving github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)... 52.216.131.107

Connecting to github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)|52.216.131.107|:443... connected.

HTTP request sent, awaiting response... 200 OK

Length: 43254025 (41M) [application/octet-stream]

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


eafile-server_6.3.4_stable_pi.tar.  24%[==============>                                                   ]   9.98M  1.79MB/s   eta 25s   



/home/ 폴더에 풀기


root@AOL-Debian:~# mkdir -p /home/seafile

root@AOL-Debian:~# tar xf seafile-server_6.3.4_stable_pi.tar.gz -C /home/seafile/





3. 설치 진행하기


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

root@AOL-Debian:/home/seafile/seafile-server-6.3.4# ls

check_init_admin.py  runtime    seaf-fuse.sh  seafile     seahub setup-seafile-mysql.py setup-seafile.sh

reset-admin.sh      seaf-fsck.sh  seaf-gc.sh seafile.sh  seahub.sh setup-seafile-mysql.sh upgrade


root@AOL-Debian:/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]: 192.168.0.151


Where would you like to store your seafile data? 

Note: Please use a volume with enough free space.


# 경로 설정 EX : /mnt/media_rw/sda1/seafile

[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:   192.168.0.151

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.





4. 설정 바꾸기


웹 포트 8000번 중복으로 9000번으로 SeaHub 포트 수정


root@AOL-Debian:/home/seafile/seafile-server-6.3.4# cd ..

root@AOL-Debian:/home/seafile# cd conf/

root@AOL-Debian:/home/seafile/conf# ls

ccnet.conf  gunicorn.conf  seafdav.conf  seafile.conf  seahub_settings.py

root@AOL-Debian:/home/seafile/conf# nano ccnet.conf 



[General]

USER_NAME = djjproject

ID = 5405fa16c70b4dc1cc78bd53ee78549d218095d9

NAME = djjproject

SERVICE_URL = http://192.168.0.151:9000


[Client]

PORT = 13419


root@AOL-Debian:/home/seafile/conf# nano gunicorn.conf

import os

daemon = True
workers = 5

# default localhost:8000
bind = "0.0.0.0:9000"

# Pid
pids_dir = '/home/seafile/pids'
pidfile = os.path.join(pids_dir, 'seahub.pid')

# for file upload, we need a longer timeout value (default is only 30s, too short)
timeout = 1200

limit_request_line = 8190





5. 서버 시작하기


로컬 폴더 마운트 과정을 거쳐야 파일을 암호화 하지 않고 사용이 가능합니다.


파일을 백업할 것이 아니라면 필요한 과정이 아님으로 넘어가겠습니다.


root@AOL-Debian:/home/seafile/seafile-server-latest# ./seafile.sh start


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

Starting seafile server, please wait ...

Seafile server started


Done.

root@AOL-Debian:/home/seafile/seafile-server-latest# ./seahub.sh start 9000


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

Starting seahub at port 9000 ...


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

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.





6. 접속하기


접속이 안됩니다.. 아래의 로그가 확인되고 있네요.


root@AOL-Debian:/home/seafile/logs# tail -f seahub.log 

    __import__(name)

  File "/home/seafile/seafile-server-6.3.4/seahub/seahub/urls.py", line 12, in <module>

    from seahub.views.file import view_history_file, view_trash_file,\

  File "/home/seafile/seafile-server-6.3.4/seahub/seahub/views/file.py", line 41, in <module>

    from seahub.wopi.utils import get_wopi_dict

  File "/home/seafile/seafile-server-6.3.4/seahub/seahub/wopi/utils.py", line 7, in <module>

    import requests

  File "/home/seafile/seafile-server-6.3.4/seahub/thirdpart/requests-2.18.4-py2.7.egg/requests/__init__.py", line 90, in <module>

    from urllib3.exceptions import DependencyWarning

ImportError: cannot import name DependencyWarning




다시 한번 시도해 봅니다. 와 이 문제.. 파이썬 모듈 관련 에러인데 정말 힘들었네요 ㅎㅎ


root@AOL-Debian:/home/seafile/logs# easy_install pip

Searching for pip

Reading https://pypi.python.org/simple/pip/

Best match: pip 18.1

Downloading https://files.pythonhosted.org/packages/45/ae/8a0ad77defb7cc903f09e55156=c0a292bd977ef590379a3f05d7b7f65135487b67470f6281289a94e015650ea1

Processing pip-18.1.tar.gz

Writing /tmp/easy_install-_N0GTU/pip-18.1/setup.cfg

Running pip-18.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-_N0GTU/pip-18.

/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option

  warnings.warn(msg)

warning: no files found matching 'docs/docutils.conf'

warning: no previously-included files found matching '.coveragerc'

warning: no previously-included files found matching '.mailmap'

warning: no previously-included files found matching '.travis.yml'

warning: no previously-included files found matching 'tox.ini'

warning: no previously-included files found matching 'appveyor.yml'

warning: no files found matching 'Makefile' under directory 'docs'

warning: no files found matching '*.bat' under directory 'docs'

warning: no previously-included files found matching 'src/pip/_vendor/six'

warning: no previously-included files found matching 'src/pip/_vendor/six/moves'

warning: no previously-included files matching '*.pyi' found under directory 'src/

no previously-included directories found matching '.github'

no previously-included directories found matching 'docs/build'

no previously-included directories found matching 'news'

no previously-included directories found matching 'tasks'

no previously-included directories found matching 'tests'

no previously-included directories found matching 'tools'

Adding pip 18.1 to easy-install.pth file

Installing pip script to /usr/local/bin

Installing pip2.7 script to /usr/local/bin

Installing pip2 script to /usr/local/bin


Installed /usr/local/lib/python2.7/dist-packages/pip-18.1-py2.7.egg

Processing dependencies for pip

Finished processing dependencies for pip


# 이미 설치된 pip 말고 easy_install 로 깔린 버전을 사용하여 명령을 내립니다.

root@AOL-Debian:/home/seafile/seafile-server-latest# /usr/local/bin/pip install requests==2.18.4 urllib3==1.22

Requirement already satisfied: requests==2.18.4 in /usr/local/lib/python2.7/dist-packages (2.18.4)

Collecting urllib3==1.22

  Downloading https://files.pythonhosted.org/packages/63/cb/6965947c13a94236f6d4b8223e21beb4d576dc72e8130bd7880f600839b8/urllib3-1.22-py2.py3-none-any.whl (132kB)

    100% |████████████████████████████████| 133kB 567kB/s 

Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python2.7/dist-packages (from requests==2.18.4) (2018.11.29)

Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python2.7/dist-packages (from requests==2.18.4) (3.0.4)

Requirement already satisfied: idna<2.7,>=2.5 in /usr/local/lib/python2.7/dist-packages (from requests==2.18.4) (2.6)

Installing collected packages: urllib3

  Found existing installation: urllib3 1.23

    Uninstalling urllib3-1.23:

      Successfully uninstalled urllib3-1.23

Successfully installed urllib3-1.22


결국에 로그인에 성공합니다.










라이브러리를 생성하고 폴더를 만들고 미리보기 가능합니다.


업로드의 경우 용량제한은 있을것 같으나 큰 파일도 잘 올라갑니다. 한편 여러파일 한번에 지정 업로드 그리고 폴더 업로드가 지원됩니다.


한편 URL 공유 기능도 있습니다.





정말 기능이 좋습니다.


그런데 데이터 디렉터리로 이동하면 아래와 같이 복구가 불가능하도록 쪼개져서 저장이 됩니다. 이 문제는 fuse 마운트 옵션으로 해결이 가능합니다만, 이 Seafile Server 로 U5의 파일 관리를 하는 목적으로는 쓰는 것은 비추천 드리고 스탠드얼론 느낌으로만 사용하시는게 좋습니다.


root@AOL-Debian:/home/seafile/seafile-server-latest# cd /media/seafile

root@AOL-Debian:/media/seafile# ls

httptemp  library-template  seafile.db storage  tmpfiles

root@AOL-Debian:/media/seafile# cd storage/

root@AOL-Debian:/media/seafile/storage# ls

blocks commits  fs

root@AOL-Debian:/media/seafile/storage# cd blocks/

root@AOL-Debian:/media/seafile/storage/blocks# ls

29ab5590-1504-4682-826d-41a438b40a66  bedfae1b-03b5-4db7-a226-4eafbfcd928f

ab8f5f0d-21ac-429c-b631-15afba1985fd

root@AOL-Debian:/media/seafile/storage/blocks#


안드로이드 / 아이폰 / PC 프로그램이 있습니다. 써보시면 좋을 것 같습니다.


감사합니다.

반응형

댓글