GNU/Linux >> Linux Esercitazione >  >> Ubuntu

Come installare il server EteSync su Ubuntu 20.04

EteSync è una soluzione open source per sincronizzare contatti, calendari e attività. È self-hosted, fornisce la crittografia end-to-end e consente di condividere i dati con altri utenti. Può essere integrato con i desktop GNOME e KDE. È possibile accedervi tramite client desktop, Web, Android e iOS.

In questo tutorial ti mostrerò come installare EteSync con Apache su Ubuntu 20.04.

Prerequisiti

  • Un server che esegue Ubuntu 20.04.
  • Un nome di dominio valido puntato all'IP del tuo server.
  • Sul server è configurata una password di root.

Per iniziare

Innanzitutto, aggiorna i pacchetti di sistema alla versione aggiornata eseguendo il comando seguente:

apt-get update -y

Una volta aggiornati tutti i pacchetti, puoi procedere al passaggio successivo.

Installazione del server MariaDB

Per impostazione predefinita, EteSync utilizza il database SQLite per memorizzare le sue informazioni. Qui installeremo e utilizzeremo MariaDB come backend di database.

Innanzitutto, installa le dipendenze richieste utilizzando il comando seguente:

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

Quindi, aggiungi la chiave e il repository MariaDB GPG utilizzando il seguente comando:

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'

Quindi, aggiorna il repository MariaDB e installa l'ultima versione di MariaDB con il seguente comando:

apt-get install mariadb-server -y

Dopo aver installato il server MariaDB, accedi alla shell MariaDB con il seguente comando:

mysql

Una volta effettuato l'accesso, crea un database e un utente per EteSync con il seguente comando:

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

Successivamente, concedi tutti i privilegi al database EteSync con il seguente comando:

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

Quindi, svuota i privilegi ed esci da MariaDB con il seguente comando:

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

Una volta terminato, puoi procedere al passaggio successivo.

Installazione e configurazione di EteSync

Innanzitutto, dovrai installare alcune dipendenze Python richieste per EteSync. Puoi installarli tutti con il seguente comando:

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

Dopo aver installato tutte le dipendenze, scarica l'ultima versione di EteSync utilizzando il seguente comando:

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

Una volta completato il download, cambia la directory in etesync e crea un ambiente virtuale Python con il seguente comando:

cd etesync
virtualenv -p python3 .venv

Successivamente, attiva l'ambiente virtuale con il seguente comando:

source .venv/bin/activate

Quindi, installa tutti i requisiti usando il seguente comando:

pip install -r requirements.txt

Quindi, copia il file di configurazione di esempio:

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

Quindi, modifica il file di configurazione utilizzando il comando seguente:

nano etebase-server.ini

Aggiungi o modifica le seguenti righe secondo la tua configurazione:

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

Salva e chiudi il file, quindi installa altri moduli utilizzando il seguente comando:

pip3 install daphne
pip3 install mysqlclient
pip3 install aioredis

Quindi, genera i file statici e migra il database con il seguente comando:

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

Infine, avvia il server EteSync con il seguente comando:

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

Se tutto va bene, dovresti ottenere il seguente output:

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

Premi CTRL + C per fermare il server.

Quindi, crea un utente amministrativo utilizzando il seguente comando:

./manage.py createsuperuser

Fornisci il tuo nome utente, password ed e-mail come mostrato di seguito:

Username: etesync
Email address: [email protected]
Password: 
Password (again): 
Superuser created successfully.

Successivamente, disattiva dall'ambiente virtuale Python con il seguente comando:

deactivate

Crea un file di unità di sistema per EteSync

Successivamente, dovrai creare un file di unità systemd per la gestione di EteSync. Puoi crearlo con il seguente comando:

nano /etc/systemd/system/etesync.service

Aggiungi le seguenti righe:

[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

Salva e chiudi il file, quindi ricarica il demone systemd per applicare le modifiche alla configurazione:

systemctl daemon-reload

Successivamente, avvia e abilita il servizio EteSync con il seguente comando:

systemctl start etesync
systemctl enable etesync

Per verificare lo stato del servizio EteSync, eseguire il comando seguente:

systemctl status etesync

Otterrai il seguente output:

? 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

A questo punto EteSync viene avviato e rimane in ascolto sulla porta 8001. Ora puoi procedere al passaggio successivo.

Configurazione di Apache come proxy inverso

Si consiglia inoltre di installare e utilizzare Apache come proxy inverso per accedere a EteSync. Innanzitutto, installa il server Apache con il seguente comando:

apt-get install apache2 -y

Dopo aver installato il server Apache, abilita tutti i moduli proxy con il seguente comando:

a2enmod proxy proxy_http headers proxy_wstunnel

Quindi, crea un nuovo file di configurazione dell'host virtuale Apache:

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

Aggiungi le seguenti righe:

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

Salva e chiudi il file, quindi attiva l'host virtuale Apache con il seguente comando:

a2ensite etesync.conf

Quindi, riavvia Apache per aggiornare le modifiche:

systemctl restart apache2

Ora puoi verificare lo stato di Apache usando il seguente comando:

systemctl status apache2

Dovresti ottenere il seguente output:

? 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>

Accedi alla Console di amministrazione EteSync

Ora apri il tuo browser web e accedi all'interfaccia di amministrazione di EteSync utilizzando l'URL http://etesync.example.com/admin/ . Verrai reindirizzato alla seguente pagina:

Fornisci il nome utente e la password dell'amministratore e fai clic su Accedi pulsante. Dovresti vedere la seguente pagina:

EteSync protetto con Let's Encrypt SSL

Innanzitutto, dovrai installare il client Certbot Let's Encrypt per scaricare e installare il certificato SSL per il tuo dominio.

Puoi installarlo con il seguente comando:

apt-get install python3-certbot-apache -y

Una volta installato, puoi eseguire il seguente comando per installare il certificato Let's Encrypt per il tuo dominio etesync.example.com.

certbot --apache -d etesync.example.com

Durante l'installazione, ti verrà chiesto di fornire il tuo indirizzo e-mail e di accettare i termini del servizio come mostrato di seguito:

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

Quindi, digita 2 e premi Invio per scaricare e installare un certificato SSL gratuito per il tuo dominio. Una volta che l'installazione è stata completata con successo. Dovresti ottenere il seguente output:

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

Conclusione

Congratulazioni! hai installato con successo EteSync sul server Ubuntu 20.04 con Let's Encrypt SSL. Ora puoi sincronizzare il tuo calendario e contattare facilmente con EteSync.


Ubuntu
  1. Come installare Zimbra 8.6 su Ubuntu 14.04 Server

  2. Come installare Logstash su Ubuntu 18.04

  3. Come installare Minecraft Server su Ubuntu 20.04 LTS

  4. Come installare TeamSpeak Server su Ubuntu 18.04 e 20.04

  5. Come installare R su Ubuntu 18.04

Come installare il server OpenSIPS su Ubuntu 15.04

Come installare Consul Server su Ubuntu 16.04

Come installare il server EteSync 2.0 (Etebase) su Ubuntu

Come installare Apache Tomcat Server su Ubuntu 22.04

Come installare Consul Server su Ubuntu 20.04

Come installare il server EteSync su Ubuntu 20.04