Setup Trilium Notes On Arch Linux

·

2 min read

Trilium is a self-hosted, single-user note taking application. Trilium server is a web application which provides responsive UI for note taking. The desktop client synchronises with the server. It does not have mobile app, but it has a mobile web frontend which is optimized for touch based devices - smartphones and tablets.

In this post I will provide instruction for hosting the server application in Arch Linux.

Prerequisites:

  • Docker is installed and running.

  • Install docker-compose package.

  • Add yourself to docker user group.
    sudo usermod -a -G docker <username>

Prepare Docker Compose File

Create a docker-compose.yaml file. You can save it in any folder you like, mine is kept in ~/dev/docker/trilium/.

services:
  trilium:
    image: 'zadam/trilium:0.63.7'
    restart: always
    ports:
      - '8080:8080'
    volumes:
      - '~/.trilium-data:/home/node/trilium-data'

The container will be listening on port 8080. If you want to change the port number to 3000, set the ports configuration value to '3000:8080'.

I want the note data to be saved in ~/.trilium-data/. If you prefer other location, change the volumes configuration value to '/path/to/your/folder:/home/node/trilium-data'.

Create And Start Container

# Go to folder containing compose file
cd ~/dev/docker/trilium
docker-compose up -d && docker-compose logs -f

docker-compose logs -f command is optional. It will show the log output so that you can check if there is any error when launching the container. Once Trilium is running well, you can press Ctrl + C to exit from the logging.

Trilium shall be accessible by launching http://<you-server-ip>:8080 in browser. Choose "I'm a new user, ..." on the webpage, and it will guide you to setup a password and get started on note taking.

Setup Apache Reverse Proxy

This setup is optional. I am running Trilium in my home server with Apache web server installed. Setting up a reverse proxy allows me to access Trilium remotely.

Apache virtual host config:

<VirtualHost *:80>
    ServerName www.mydomain.com

    RewriteEngine On
    RewriteCond %{HTTP:Connection} Upgrade [NC]
    RewriteCond %{HTTP:Upgrade} websocket [NC]
    RewriteRule /(.*) ws://localhost:8080/$1 [P,L]

    ProxyPreserveHost On
    ProxyPass / http://127.0.0.1:8080/
    ProxyPassReverse / http://127.0.0.1:8080/
</VirtualHost>

References

Did you find this article valuable?

Support Hong by becoming a sponsor. Any amount is appreciated!