GNU/Linux >> Tutoriales Linux >  >> Ubuntu

Cómo instalar el servidor EteSync en Ubuntu 20.04

EteSync es una solución de código abierto para sincronizar sus contactos, calendarios y tareas. Es autohospedado, proporciona cifrado de extremo a extremo y le permite compartir datos con otros usuarios. Se puede integrar con escritorios GNOME y KDE. Se puede acceder a través de clientes de escritorio, web, Android e iOS.

En este tutorial, le mostraré cómo instalar EteSync con Apache en Ubuntu 20.04.

Requisitos

  • Un servidor con Ubuntu 20.04.
  • Un nombre de dominio válido apuntado con la IP de su servidor.
  • Se configura una contraseña raíz en el servidor.

Cómo empezar

Primero, actualice los paquetes del sistema a la versión actualizada ejecutando el siguiente comando:

apt-get update -y

Una vez que todos los paquetes estén actualizados, puede continuar con el siguiente paso.

Instalando el servidor MariaDB

Por defecto, EteSync utiliza la base de datos SQLite para almacenar su información. Aquí, instalaremos y usaremos MariaDB como base de datos.

Primero, instale las dependencias requeridas usando el siguiente comando:

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

A continuación, agregue la clave GPG de MariaDB y el repositorio con el siguiente 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'

A continuación, actualice el repositorio de MariaDB e instale la última versión de MariaDB con el siguiente comando:

apt-get install mariadb-server -y

Después de instalar el servidor MariaDB, inicie sesión en el shell de MariaDB con el siguiente comando:

mysql

Una vez que haya iniciado sesión, cree una base de datos y un usuario para EteSync con el siguiente comando:

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

A continuación, otorgue todos los privilegios a la base de datos de EteSync con el siguiente comando:

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

A continuación, elimine los privilegios y salga de MariaDB con el siguiente comando:

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

Una vez que haya terminado, puede continuar con el siguiente paso.

Instalando y Configurando EteSync

Primero, deberá instalar algunas dependencias de Python necesarias para EteSync. Puede instalarlos todos con el siguiente comando:

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

Después de instalar todas las dependencias, descargue la última versión de EteSync usando el siguiente comando:

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

Una vez que se complete la descarga, cambie el directorio a etesync y cree un entorno virtual de Python con el siguiente comando:

cd etesync
virtualenv -p python3 .venv

A continuación, active el entorno virtual con el siguiente comando:

source .venv/bin/activate

A continuación, instale todos los requisitos con el siguiente comando:

pip install -r requirements.txt

A continuación, copie el archivo de configuración de muestra:

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

Luego, edite el archivo de configuración usando el siguiente comando:

nano etebase-server.ini

Agregue o modifique las siguientes líneas según su configuración:

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

Guarde y cierre el archivo, luego instale otros módulos usando el siguiente comando:

pip3 install daphne
pip3 install mysqlclient
pip3 install aioredis

A continuación, genere los archivos estáticos y migre la base de datos con el siguiente comando:

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

Finalmente, inicie el servidor EteSync con el siguiente comando:

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

Si todo está bien, debería obtener el siguiente resultado:

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

Presiona CTRL + C para detener el servidor.

A continuación, cree un usuario administrativo con el siguiente comando:

./manage.py createsuperuser

Proporcione su nombre de usuario, contraseña y correo electrónico como se muestra a continuación:

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

A continuación, desactívelo desde el entorno virtual de Python con el siguiente comando:

deactivate

Crear un archivo de unidad Systemd para EteSync

A continuación, deberá crear un archivo de unidad systemd para administrar EteSync. Puedes crearlo con el siguiente comando:

nano /etc/systemd/system/etesync.service

Agregue las siguientes líneas:

[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

Guarde y cierre el archivo, luego vuelva a cargar el demonio systemd para aplicar los cambios de configuración:

systemctl daemon-reload

A continuación, inicie y habilite el servicio EteSync con el siguiente comando:

systemctl start etesync
systemctl enable etesync

Para verificar el estado del servicio EteSync, ejecute el siguiente comando:

systemctl status etesync

Obtendrá el siguiente resultado:

? 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

En este punto, EteSync se inicia y escucha en el puerto 8001. Ahora puede continuar con el siguiente paso.

Configurar Apache como un proxy inverso

También es recomendable instalar y utilizar Apache como proxy inverso para acceder a EteSync. Primero, instale el servidor Apache con el siguiente comando:

apt-get install apache2 -y

Después de instalar el servidor Apache, habilite todos los módulos proxy con el siguiente comando:

a2enmod proxy proxy_http headers proxy_wstunnel

A continuación, cree un nuevo archivo de configuración de host virtual de Apache:

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

Agregue las siguientes líneas:

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

Guarde y cierre el archivo, luego active el host virtual de Apache con el siguiente comando:

a2ensite etesync.conf

A continuación, reinicie Apache para actualizar los cambios:

systemctl restart apache2

Ahora puede verificar el estado de Apache usando el siguiente comando:

systemctl status apache2

Deberías obtener el siguiente resultado:

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

Acceder a la consola de administración de EteSync

Ahora, abra su navegador web y acceda a la interfaz de administración de EteSync usando la URL http://etesync.example.com/admin/ . Será redirigido a la siguiente página:

Proporcione su nombre de usuario y contraseña de administrador y haga clic en Iniciar sesión botón. Debería ver la siguiente página:

Asegure EteSync con Let's Encrypt SSL

Primero, deberá instalar el cliente Certbot Let's Encrypt para descargar e instalar el certificado SSL para su dominio.

Puede instalarlo con el siguiente comando:

apt-get install python3-certbot-apache -y

Una vez instalado, puede ejecutar el siguiente comando para instalar el Certificado Let's Encrypt para su dominio etesync.example.com.

certbot --apache -d etesync.example.com

Durante la instalación, se le pedirá que proporcione su dirección de correo electrónico y acepte el término del servicio como se muestra a continuación:

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

Luego, escriba 2 y presione Enter para descargar e instalar un certificado SSL gratuito para su dominio. Una vez que la instalación se haya completado con éxito. Deberías obtener el siguiente resultado:

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

Conclusión

¡Felicidades! ha instalado con éxito EteSync en el servidor Ubuntu 20.04 con Let's Encrypt SSL. Ahora puedes sincronizar tu calendario y contactar fácilmente con EteSync.


Ubuntu
  1. Cómo instalar Zimbra 8.6 en el servidor Ubuntu 14.04

  2. Cómo instalar Logstash en Ubuntu 18.04

  3. Cómo instalar Minecraft Server en Ubuntu 20.04 LTS

  4. Cómo instalar TeamSpeak Server en Ubuntu 18.04 y 20.04

  5. Cómo instalar R en Ubuntu 18.04

Cómo instalar el servidor OpenSIPS en Ubuntu 15.04

Cómo instalar el servidor Consul en Ubuntu 16.04

Cómo instalar el servidor EteSync 2.0 (Etebase) en Ubuntu

Cómo instalar el servidor Apache Tomcat en Ubuntu 22.04

Cómo instalar el servidor Consul en Ubuntu 20.04

Cómo instalar el servidor EteSync en Ubuntu 20.04