웹사이트 검색

Ubuntu 20.04에 EteSync 서버를 설치하는 방법


이 페이지에서

  1. 전제 조건
  2. 시작하기\n
  3. MariaDB 서버 설치
  4. EteSync 설치 및 구성
  5. EteSync용 Systemd Unit 파일 생성
  6. Apache를 리버스 프록시로 구성\n
  7. EteSync 관리 콘솔 액세스
  8. Lets Encrypt SSL을 통한 보안 EteSync\n
  9. 결론

EteSync는 연락처, 일정 및 작업을 동기화하는 오픈 소스 솔루션입니다. 자체 호스팅되고 종단 간 암호화를 제공하며 다른 사용자와 데이터를 공유할 수 있습니다. GNOME 및 KDE 데스크탑과 통합할 수 있습니다. 데스크톱, 웹, Android 및 iOS 클라이언트를 통해 액세스할 수 있습니다.

이 튜토리얼에서는 Ubuntu 20.04에서 Apache와 함께 EteSync를 설치하는 방법을 보여줍니다.

전제 조건

  • Ubuntu 20.04를 실행하는 서버.\n
  • 서버 IP를 가리키는 유효한 도메인 이름입니다.\n
  • 루트 암호는 서버에서 구성됩니다.\n

시작하기

먼저 다음 명령을 실행하여 시스템 패키지를 업데이트된 버전으로 업데이트합니다.

apt-get update -y

모든 패키지가 업데이트되면 다음 단계로 진행할 수 있습니다.

MariaDB 서버 설치

기본적으로 EteSync는 SQLite 데이터베이스를 사용하여 정보를 저장합니다. 여기에서는 MariaDB를 데이터베이스 백엔드로 설치하고 사용합니다.

먼저 다음 명령을 사용하여 필요한 종속 항목을 설치합니다.

apt-get install software-properties-common gnupg2 -y

다음으로 다음 명령을 사용하여 MariaDB GPG 키와 리포지토리를 추가합니다.

apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://mirror.lstn.net/mariadb/repo/10.5/ubuntu focal main'

그런 다음 MariaDB 리포지토리를 업데이트하고 다음 명령을 사용하여 최신 버전의 MariaDB를 설치합니다.

apt-get install mariadb-server -y

MariaDB 서버를 설치한 후 다음 명령을 사용하여 MariaDB 셸에 로그인합니다.

mysql

로그인한 후 다음 명령을 사용하여 EteSync용 데이터베이스 및 사용자를 생성합니다.

MariaDB [(none)]> create database etesync;
MariaDB [(none)]> create user identified by 'securepassword';

다음으로 다음 명령을 사용하여 EteSync 데이터베이스에 대한 모든 권한을 부여합니다.

MariaDB [(none)]> grant all privileges on etesync.* to ;

다음으로 다음 명령을 사용하여 권한을 플러시하고 MariaDB를 종료합니다.

MariaDB [(none)]> flush privileges;
MariaDB [(none)]> exit;

완료되면 다음 단계로 진행할 수 있습니다.

EteSync 설치 및 구성

먼저 EteSync에 필요한 일부 Python 종속 항목을 설치해야 합니다. 다음 명령으로 모두 설치할 수 있습니다.

apt-get install python3-virtualenv python3-pip gcc libmysqlclient-dev build-essential git -y

모든 종속성을 설치한 후 다음 명령을 사용하여 최신 버전의 EteSync를 다운로드합니다.

git clone https://github.com/etesync/server.git etesync

다운로드가 완료되면 디렉터리를 etesync로 변경하고 다음 명령을 사용하여 Python 가상 환경을 만듭니다.

cd etesync
virtualenv -p python3 .venv

그런 다음 다음 명령을 사용하여 가상 환경을 활성화합니다.

source .venv/bin/activate

다음으로 다음 명령을 사용하여 모든 요구 사항을 설치합니다.

pip install -r requirements.txt

다음으로 샘플 구성 파일을 복사합니다.

cp etebase-server.ini.example etebase-server.ini

다음으로 아래 명령을 사용하여 구성 파일을 편집합니다.

nano etebase-server.ini

구성에 따라 다음 줄을 추가하거나 수정합니다.

media_root = /opt
allowed_host1 = etesync.example.com

;engine = django.db.backends.sqlite3
;name = db.sqlite3

engine = django.db.backends.mysql
name = etesync
user = etesync
password = securepassword
host = 127.0.0.1
port = 3306

파일을 저장하고 닫은 후 다음 명령을 사용하여 다른 모듈을 설치합니다.

pip3 install daphne
pip3 install mysqlclient
pip3 install aioredis

다음으로 다음 명령을 사용하여 정적 파일을 생성하고 데이터베이스를 마이그레이션합니다.

./manage.py collectstatic
./manage.py migrate

마지막으로 다음 명령을 사용하여 EteSync 서버를 시작합니다.

daphne -b 0.0.0.0 -p 8001 etebase_server.asgi:application

모든 것이 정상이면 다음과 같은 결과가 표시됩니다.

2021-07-09 05:42:28,510 INFO     Starting server at tcp:port=8001:interface=0.0.0.0
2021-07-09 05:42:28,510 INFO     HTTP/2 support not enabled (install the http2 and tls Twisted extras)
2021-07-09 05:42:28,511 INFO     Configuring endpoint tcp:port=8001:interface=0.0.0.0
2021-07-09 05:42:28,512 INFO     Listening on TCP address 0.0.0.0:8001

CTRL + C를 눌러 서버를 중지합니다.

다음으로 다음 명령을 사용하여 관리 사용자를 만듭니다.

./manage.py createsuperuser

아래와 같이 사용자 이름, 비밀번호 및 이메일을 제공하십시오.

Username: etesync
Email address: 
Password: 
Password (again): 
Superuser created successfully.

그런 다음 다음 명령을 사용하여 Python 가상 환경에서 비활성화합니다.

deactivate

EteSync용 Systemd Unit 파일 생성

다음으로 EteSync를 관리하기 위한 시스템 단위 파일을 생성해야 합니다. 다음 명령으로 만들 수 있습니다.

nano /etc/systemd/system/etesync.service

다음 줄을 추가합니다.

[Unit]
Description=EteSync: End-to-End Encryption to Sync Calender, Contacts, Tasks and Notes.

[Service]
WorkingDirectory=/root/etesync
ExecStart=/root/etesync/.venv/bin/daphne -b 127.0.0.1 -p 8001 -u /tmp/etebase_server.sock etebase_server.asgi:application
User=root
Group=root
Restart=always
RestartSec=5s

[Install]
WantedBy=multi-user.target

파일을 저장하고 닫은 다음 systemd 데몬을 다시 로드하여 구성 변경 사항을 적용합니다.

systemctl daemon-reload

그런 다음 다음 명령을 사용하여 EteSync 서비스를 시작하고 활성화합니다.

systemctl start etesync
systemctl enable etesync

EteSync 서비스의 상태를 확인하려면 다음 명령을 실행하십시오.

systemctl status etesync

다음과 같은 결과가 표시됩니다.

? etesync.service - EteSync: End-to-End Encryption to Sync Calender, Contacts, Tasks and Notes.
     Loaded: loaded (/etc/systemd/system/etesync.service; disabled; vendor preset: enabled)
     Active: active (running) since Fri 2021-07-09 05:45:45 UTC; 5s ago
   Main PID: 16213 (daphne)
      Tasks: 1 (limit: 2353)
     Memory: 48.7M
     CGroup: /system.slice/etesync.service
             ??16213 /root/etesync/.venv/bin/python /root/etesync/.venv/bin/daphne -b 127.0.0.1 -p 8001 -u /tmp/etebase_server.sock etebase_se>

Jul 09 05:45:45 node1 systemd[1]: Started EteSync: End-to-End Encryption to Sync Calender, Contacts, Tasks and Notes..
Jul 09 05:45:46 node1 daphne[16213]: 2021-07-09 05:45:46,993 INFO     Starting server at tcp:port=8001:interface=127.0.0.1, unix:/tmp/etebase_>
Jul 09 05:45:46 node1 daphne[16213]: 2021-07-09 05:45:46,995 INFO     HTTP/2 support not enabled (install the http2 and tls Twisted extras)
Jul 09 05:45:46 node1 daphne[16213]: 2021-07-09 05:45:46,995 INFO     Configuring endpoint tcp:port=8001:interface=127.0.0.1
Jul 09 05:45:46 node1 daphne[16213]: 2021-07-09 05:45:46,997 INFO     Listening on TCP address 127.0.0.1:8001
Jul 09 05:45:46 node1 daphne[16213]: 2021-07-09 05:45:46,998 INFO     Configuring endpoint unix:/tmp/etebase_server.sock

이 시점에서 EteSync가 시작되고 포트 8001에서 수신 대기합니다. 이제 다음 단계를 진행할 수 있습니다.

Apache를 리버스 프록시로 구성

또한 EteSync에 액세스하기 위해 Apache를 리버스 프록시로 설치하고 사용하는 것이 좋습니다. 먼저 다음 명령을 사용하여 Apache 서버를 설치합니다.

apt-get install apache2 -y

Apache 서버를 설치한 후 다음 명령을 사용하여 모든 프록시 모듈을 활성화합니다.

a2enmod proxy proxy_http headers proxy_wstunnel

다음으로 새 Apache 가상 호스트 구성 파일을 만듭니다.

nano /etc/apache2/sites-available/etesync.conf

다음 줄을 추가합니다.

<VirtualHost *:80>
   ServerName etesync.example.com
   ErrorDocument 404 /404.html

   ErrorLog ${APACHE_LOG_DIR}/etebase_error.log
   CustomLog ${APACHE_LOG_DIR}/etebase_access.log combined

   ProxyPreserveHost On
   ProxyPass / http://127.0.0.1:8001/
   ProxyPassReverse / http://127.0.0.1:8001/
   Alias /static /etesync/static

</VirtualHost>

파일을 저장하고 닫은 후 다음 명령을 사용하여 Apache 가상 호스트를 활성화합니다.

a2ensite etesync.conf

다음으로 Apache를 다시 시작하여 변경 사항을 업데이트합니다.

systemctl restart apache2

이제 다음 명령을 사용하여 Apache 상태를 확인할 수 있습니다.

systemctl status apache2

다음 출력이 표시되어야 합니다.

? apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2021-07-09 05:50:26 UTC; 5s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 17551 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 17567 (apache2)
      Tasks: 55 (limit: 2353)
     Memory: 5.3M
     CGroup: /system.slice/apache2.service
             ??17567 /usr/sbin/apache2 -k start
             ??17568 /usr/sbin/apache2 -k start
             ??17569 /usr/sbin/apache2 -k start

Jul 09 05:50:26 node1 systemd[1]: Starting The Apache HTTP Server...
Jul 09 05:50:26 node1 apachectl[17558]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 45.58.3>

EteSync 관리 콘솔에 액세스

이제 웹 브라우저를 열고 URL http://etesync.example.com/admin/을 사용하여 EteSync 관리 인터페이스에 액세스하십시오. 다음 페이지로 리디렉션됩니다.

관리자 사용자 이름, 비밀번호를 제공하고 로그인 버튼을 클릭합니다. 다음 페이지가 표시됩니다.

Lets Encrypt SSL로 안전한 EteSync

먼저 도메인용 SSL 인증서를 다운로드하고 설치하려면 Certbot Lets Encrypt 클라이언트를 설치해야 합니다.

다음 명령으로 설치할 수 있습니다.

apt-get install python3-certbot-apache -y

일단 설치되면 다음 명령을 실행하여 도메인 etesync.example.com에 대한 Lets Encrypt 인증서를 설치할 수 있습니다.

certbot --apache -d etesync.example.com

설치하는 동안 아래와 같이 이메일 주소를 제공하고 서비스 약관에 동의하라는 메시지가 표시됩니다.

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for etesync.example.com
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/etesync-le-ssl.conf
Deploying Certificate to VirtualHost /etc/apache2/sites-available/etesync-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/etesync-le-ssl.conf

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2

그런 다음 2를 입력하고 Enter 키를 눌러 도메인용 무료 SSL 인증서를 다운로드하고 설치합니다. 일단 설치가 성공적으로 완료되었습니다. 다음 출력이 표시되어야 합니다.

Enabled Apache rewrite module
Redirecting vhost in /etc/apache2/sites-enabled/etesync.conf to ssl vhost in /etc/apache2/sites-available/
etesync-le-ssl.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://etesync.example.com

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=etesync.example.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

결론

축하합니다! Lets Encrypt SSL을 사용하여 Ubuntu 20.04 서버에 EteSync를 성공적으로 설치했습니다. 이제 캘린더와 연락처를 EteSync로 쉽게 동기화할 수 있습니다.