GNU/Linux >> Linux の 問題 >  >> Ubuntu

Ubuntu20.04にEteSyncサーバーをインストールする方法

EteSyncは、連絡先、カレンダー、およびタスクを同期するためのオープンソースソリューションです。自己ホスト型であり、エンドツーエンドの暗号化を提供し、他のユーザーとデータを共有できるようにします。 GNOMEおよびKDEデスクトップと統合できます。デスクトップ、ウェブ、Android、iOSクライアントからアクセスできます。

このチュートリアルでは、Ubuntu20.04にApacheを使用してEteSyncをインストールする方法を紹介します。

前提条件
  • Ubuntu20.04を実行しているサーバー。
  • サーバーIPで指定された有効なドメイン名。
  • ルートパスワードはサーバーで構成されています。
はじめに

まず、次のコマンドを実行して、システムパッケージを更新されたバージョンに更新します。

apt-get update -y

すべてのパッケージが更新されたら、次のステップに進むことができます。

MariaDBサーバーのインストール

デフォルトでは、EteSyncはSQLiteデータベースを使用して情報を保存します。ここでは、MariaDBをインストールしてデータベースバックエンドとして使用します。

まず、次のコマンドを使用して必要な依存関係をインストールします。

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

次に、次のコマンドを使用して、MariaDBGPGキーとリポジトリを追加します。

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 [email protected] identified by 'securepassword';

次に、次のコマンドを使用して、EteSyncデータベースにすべての権限を付与します。

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

次に、特権をフラッシュし、次のコマンドで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: [email protected]
Password: 
Password (again): 
Superuser created successfully.

次に、次のコマンドを使用してPython仮想環境から非アクティブ化します。

deactivate

EteSync用のsystemdユニットファイルを作成する

次に、EteSyncを管理するためのsystemdユニットファイルを作成する必要があります。次のコマンドで作成できます:

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管理コンソールにアクセス

次に、Webブラウザーを開き、URL http://etesync.example.com/admin/を使用してEteSync管理インターフェースにアクセスします。 。次のページにリダイレクトされます:

管理者のユーザー名とパスワードを入力し、サインインをクリックします ボタン。次のページが表示されます:

SSLを暗号化して安全なEteSync

まず、Certbot Let's Encryptクライアントをインストールして、ドメインのSSL証明書をダウンロードしてインストールする必要があります。

次のコマンドでインストールできます:

apt-get install python3-certbot-apache -y

インストールしたら、次のコマンドを実行して、ドメインetesync.example.comのLet'sEncrypt証明書をインストールできます。

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): [email protected]

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
結論

おめでとう! Let'sEncryptSSLを使用してUbuntu20.04サーバーにEteSyncを正常にインストールしました。これで、カレンダーを同期して、EteSyncと簡単に連絡できます。


Ubuntu
  1. Ubuntu14.04サーバーにZimbra8.6をインストールする方法

  2. Ubuntu18.04にLogstashをインストールする方法

  3. Ubuntu20.04LTSにMinecraftサーバーをインストールする方法

  1. Ubuntu18.04にMySQLをインストールする方法

  2. Ubuntu18.04および20.04にTeamSpeakサーバーをインストールする方法

  3. Ubuntu18.04にRをインストールする方法

  1. Ubuntu18.04にMinecraftサーバーをインストールする方法

  2. Ubuntu20.04にNginxをインストールする方法

  3. Ubuntu20.04にMariaDBをインストールする方法