In this tutorial, we will show you how to install EteSync Server on Ubuntu 20.04 LTS. For those of you who didn’t know, EteSync is an open-source, end-to-end encryption solution for syncing your calendars, contacts, tasks, and notes. It can be accessed through desktop, web, Android, and iOS clients.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step installation of the EteSync Server on Ubuntu 20.04 (Focal Fossa). You can follow the same instructions for Ubuntu 18.04, 16.04, and any other Debian-based distribution like Linux Mint.
Prerequisites
- A server running one of the following operating systems: Ubuntu 20.04, 18.04, and any other Debian-based distribution like Linux Mint or elementary OS.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install EteSync Server on Ubuntu 20.04 LTS Focal Fossa
Step 1. First, make sure that all your system packages are up-to-date by running the following apt
commands in the terminal.
sudo apt update sudo apt upgrade sudo apt install python3-virtualenv python3-pip gcc build-essential libmysqlclient-dev
Step 2. Installing MariaDB.
Run the following command to add the GPG key and MariaDB repository with the following command:
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'
Next, install MariaDB to your system:
sudo apt install mariadb-server
By default, MariaDB is not hardened. You can secure MariaDB using the mysql_secure_installation
script. you should read and below each step carefully which will set a root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MariaDB:
mysql_secure_installation
Configure it like this:
- Set root password? [Y/n] y - Remove anonymous users? [Y/n] y - Disallow root login remotely? [Y/n] y - Remove test database and access to it? [Y/n] y - Reload privilege tables now? [Y/n] y
Next, we will need to log in to the MariaDB console and create a database for the EteSync. Run the following command:
mysql -u root -p
This will prompt you for a password, so enter your MariaDB root password and hit Enter. Once you are logged in to your database server you need to create a database for EteSync installation:
MariaDB [(none)]> create database etesyncdb; MariaDB [(none)]> create user etesync@localhost identified by 'your-stronge-passwd'; MariaDB [(none)]> grant all privileges on etesyncdb.* to etesync@localhost; MariaDB [(none)]> flush privileges; MariaDB [(none)]> exit;
Step 3. Installing EteSync Server on Ubuntu 20.04.
Now we download the latest version of EteSync from GitHub:
git clone https://github.com/etesync/server.git etebase
Next, change the directory and create a Python virtual:
cd etebase virtualenv -p python3 .venv source .venv/bin/activate pip install -r requirements.txt
After that, copy the sample configuration file and edit the configuration:
cp etebase-server.ini.example etebase-server.ini nano etebase-server.ini
Change the following lines:
media_root = /mnt allowed_host1 = etesync.your-domain.com ;engine = django.db.backends.sqlite3 ;name = db.sqlite3 engine = django.db.backends.mysql name = etebase user = etebase password = your-strong-password host = 127.0.0.1 port = 3306
Save and close the file then install other modules using the following command below:
pip3 install daphne mysqlclient aioredis
Next, generate the static files and migrate the database with the following command:
./manage.py collectstatic ./manage.py migrate
Then, start the EteSync server with the following command:
daphne -b 0.0.0.0 -p 8001 etebase_server.asgi:application
Step 4. Create a Systemd Service File for EteSync.
Now create a systemd
service unit file for EteSync with the following command:
nano /etc/systemd/system/etebase.service
Add the following lines:
[Unit] Description=EteSync: End-to-End Encryption to Sync Calendar, Contacts, Tasks and Notes. [Service] WorkingDirectory=/root/etebase/ ExecStart=/root/etebase/.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
Save and close the file, then reload the systemd
daemon with the following command:
sudo systemctl daemon-reload sudo systemctl start etebase sudo systemctl enable etebase
Step 5. Configure Nginx.
Now we install Nginx using the following command below:
sudo apt install nginx
Next, create an Nginx virtual host configuration file with the following command:
nano /etc/nginx/conf.d/etebase.conf
Add the following lines:
upstream etebase { server unix:/tmp/etebase_server.sock; } server { listen 80; server_name etesync.your-domain.com; charset utf-8; access_log /var/log/nginx/etebase.access; error_log /var/log/nginx/etebase.error; # max upload size client_max_body_size 64M; location /static/ { alias /root/etebase/static/; } location / { proxy_pass http://etebase; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_redirect of/f; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Host $server_name; } }
Save and close the file, then restart the Nginx service to apply the configuration changes:
sudo systemctl restart nginx
Step 6. Create User Accounts.
First, we change the directory to etebase and activate the virtual environment if not activated:
cd etebase source .venv/bin/activate
Then, create a superuser with the following command:
./manage.py createsuperuser
Provide your username, password, and email as shown below:
Username: admin Email address: admin@your-domain.com Password: Password (again): Superuser created successfully.
Step 7. Access EteSync Server Web Interface.
Once successfully installed, open your web browser and access your EteSync web interface using the URL http://etesync.your-domain.com/admin
. You should see the following page:
Congratulations! You have successfully installed EteSync. Thanks for using this tutorial for installing EteSync Server on Ubuntu 20.04 LTS Focal Fossa system. For additional help or useful information, we recommend you to check the official EteSync website.