글 작성자: drizzle_
728x90

Seafile은 개인 서버에서 자체 환경에서 호스팅하는 고성능 및 안정성을 갖춘 진정한 오픈 소스, 자체 호스팅 클라우드 스토리지 서비스이다.

Dropbox 및 기타 클라우드 스토리지 서비스와 마찬가지로 Seafile은 유사한 기능을 제공하며 다른 독점 스토리지 제공 업체와 달리 Seafile은 무료로 사용할 수 있다. OwnCloud, NextCloud 및 기타 스토리지 서비스를 사용해 보았지만 무겁다거나 자신의 서버랑 안 맞는 사람들은 대신 Seafile을 사용해보는걸 추천한다.

Seafile은 사용자 자신의 서버에서 개인 클라우드 서비스를 활성화한다. 자체 호스팅 파일 동기화 및 공유 앱 플랫폼이며,이를 통해 여러 기기에서 파일, 연락처 및 데이터에 액세스하고 동기화 할 수 있다.

 

우분투 18.04에서 진행하였다.


기본적인 서버 설정하기

1. Apache2를 우분투에 설치하기

웹서버인 Apache2를 우분투에 설치해야한다. apt를 업데이트하고 설치한다.

sudo apt update
sudo apt install apache2

Apache2를 설치한 후, 시스템이 재시작되면 Apache가 자동으로 실행될 수 있게 설정한다.

sudo systemctl stop apache2.service
sudo systemctl start apache2.service
sudo systemctl enable apache2.service

잘 설치 되었는지 확인하기 위해, http://서버아이피 로 접속해본다. Apache Default Page가 뜨면 성공이다.

2. DB를 설치하기

MariaDB는 Seafile에 쓰기에 훌륭한 오픈소스 데이터베이스이다.

sudo apt-get install mariadb-server mariadb-client

마찬가지로 MariaDB도 재시작시 자동으로 실행될 수 있게 해준다.

sudo systemctl stop mariadb.service
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service

2-1. 보안설정

아무 설정도 하지 않은 DB는 보안에 취약하기에 보안 설정을 해줘야 한다.

sudo mysql_secure_installation

몇가지의 질문이 있을 것이다.

Enter current password for root (enter for none): 엔터

2-2. MariaDB설정

그리고, MariaDB를 설정해줘야한다.

sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf

아래의 문장을 추가해준다.

innodb_file_format = Barracuda
innodb_large_prefix = 1
innodb_file_per_table = 1
innodb_default_row_format = dynamic

MariaDB를 재시작한다.

2-3. 테스트

sudo mysql -u root -p

Seafile 설치하기

3. Seafile을 실행하는데 필요한 패키지 설치

Seafile을 실행하기 위해서는 몇몇개의 패키지들이 설치되어야한다.

sudo apt install python2.7 libpython2.7 python-setuptools python-pil python-ldap python-urllib3 ffmpeg python-pip python-mysqldb python-memcache python-requests

4. SeafileDB만들기

먼저, Mysql에 로그인한다.

sudo mysql -u root -p

그리고,  seafiledb, ccnetdb, seahubdb이라는 DB를 만든다.

CREATE DATABASE seafiledb;
CREATE DATABASE ccnetdb;
CREATE DATABASE seahubdb;

그리고, seafileuser라는 계정을 만든다.

CREATE USER 'seafileuser'@'localhost' IDENTIFIED BY '비밀번호';

seafileuser에게 모든 권한을 준다.

GRANT ALL ON seafiledb.* TO 'seafileuser'@'localhost' IDENTIFIED BY '비밀번호' WITH GRANT OPTION;
GRANT ALL ON ccnetdb.* TO 'seafileuser'@'localhost' IDENTIFIED BY '비밀번호' WITH GRANT OPTION;
GRANT ALL ON seahubdb.* TO 'seafileuser'@'localhost' IDENTIFIED BY '비밀번호' WITH GRANT OPTION;

저장하고 빠져나온다.

FLUSH PRIVILEGES;
EXIT;

5. 최신 버전의 Seafile을 다운로드

이 글을 쓸 때의 최신 버전은 6.3.4이다. 이 글을 보는 시점에 따라 버전이 달라질 수 있다. 되도록 최신 버전으로 다운로드하시는걸 추천한다.

cd /tmp
wget https://download.seadrive.org/seafile-server_6.3.4_x86-64.tar.gz
tar -xvzf seafile-server_6.3.4_x86-64.tar.gz
sudo mv seafile-server-6.3.4 /var/www/html/seafile

5-1. Seafile 설정

cd /var/www/html/seafile
sudo ./setup-seafile-mysql.sh

물어보는것에 대해 대답한다.

What is the name of the server? It will be displayed on the client.
3 - 15 letters or digits
[ server name ] Seafile

What is the ip or domain of the server?
For example: www.mycompany.com, 192.168.1.101
[ This server's ip or domain ] 서버의 아이피 또는 도메인

Where do you want to put your seafile data?
Please use a volume with enough free space
[ default "/var/www/html/seafile-data" ] 

Which port do you want to use for the seafile fileserver?
[ default "8082" ]

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

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

[ 1 or 2 ] 2

What is the host of mysql server?
[ default "localhost" ] 

What is the port of mysql server?
[ default "3306" ] 

Which mysql user to use for seafile?
[ mysql user for seafile ] seafileuser

What is the password for mysql user "seafileuser"?
[ password for seafileuser ] DB비밀번호입력

verifying password of user seafileuser ...  done

Enter the existing database name for ccnet:
[ ccnet database ] ccnetdb

verifying user "seafileuser" access to database ccnetdb ...  done

Enter the existing database name for seafile:
[ seafile database ] seafiledb

verifying user "seafileuser" access to database seafiledb ...  done

Enter the existing database name for seahub:
[ seahub database ] seahubdb

verifying user "seafileuser" access to database seahubdb ...  done

혹시 모를 충돌을 방지하기 위해, Seafile 폴더의 권한을 설정한다.

sudo chown -R www-data:www-data /var/www/html/
sudo chmod -R 755 /var/www/html/

6. Apache 설정

seafile.conf라는 파일을 만든다.

sudo nano /etc/apache2/sites-available/seafile.conf

아래의 라인을 추가한다.

<VirtualHost *:80>
     ServerAdmin 이메일주소
     DocumentRoot /var/www/html/seafile/
     ServerName 서버URL
     ServerAlias www.서버URL
  
     Alias /media "/var/www/html/seahub/media"

     <Directory /var/www/html/seafile/>
        Options +FollowSymlinks
        AllowOverride All
        Require all granted
          <IfModule mod_dav.c>
            Dav off
          </IfModule>
        SetEnv HOME /var/www/html/seafile
        SetEnv HTTP_HOME /var/www/html/seafile
     </Directory>

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined
     
     ProxyRequests Off
        <Proxy *>
          Order deny,allow
          Allow from all
        </Proxy>    
     ProxyPass / http://127.0.0.1:8000/
     ProxyPassReverse / http://127.0.0.1:8000/

     ProxyPass /seafhttp http://127.0.0.1:8082
     ProxyPassReverse /seafhttp http://127.0.0.1:8082
     RewriteRule ^/seafhttp - [QSA,L]

</VirtualHost>

7. Rewrite모듈 설정

sudo a2ensite seafile.conf
sudo a2enmod rewrite
sudo a2enmod headers
sudo a2enmod env
sudo a2enmod dir
sudo a2enmod mime
sudo a2enmod proxy
sudo a2enmod proxy_http

8. Seafile설정

cd /var/www/html/seafile
sudo su -p -l www-data -s /bin/bash -c "./seafile.sh start"
sudo su -p -l www-data -s /bin/bash -c "./seafile.sh stop"
sudo su -p -l www-data -s /bin/bash -c "./seahub.sh start"

Admin Account를 설정한다.

What is the email for the admin account?
[ admin email ] 메일주소
What is the password for the admin account?
[ admin password ] 비밀번호
Enter the password again:
[ admin password again ] 비밀번호

이제 http://서버아이피 에 접속해본다.

아까 설정했던 Admin Account로 로그인한다.

완료 :D

728x90
Email: b1@yeonw.me / 여기를 눌러 다른 연락 수단들 알아보기