Organize Your Thoughts with Trilium - A Free, Open-Source Solution
Complete Guide on Install and Configure Trilium Notes App using Nginx, Docker, and Oracle Cloud
Feeling overwhelmed by scattered notes and too much information? Try Trilium , a powerful open-source tool that helps you organize and connect your thoughts. With its flexible structure and impressive features, Trilium is more than just a note-taking app; it’s your personal knowledge management system.
This article will explore how to install and configure trilium notes step by step.
overview
Trilium provides a rich set of out-of-box features. Its hierarchical structure, rich text editing, and robust search capabilities make it an ideal platform for organizing information, taking notes, and capturing ideas. With features like code highlighting, mind mapping, and customizable templates, Trilium offers a versatile workspace for students, researchers, and knowledge workers alike.
Trilium can be installed on a desktop or on your own server. The most common approach is to use Docker to set up the App on a cloud VM so you can access it from anywhere. There are 3rd party paid services to host a Trilium instance for you and some free options.
Let’s walk through the process of hosting it on an Oracle always free VM instance .
Oracle forever free VM
Oracle Cloud offers a generous “Forever Free” program, providing users with access to a range of cloud services at no cost. This includes the ability to spin up free virtual machines for development and testing purposes. With specific limitations on CPU, memory, and storage, these free VMs are ideal for small-scale projects, learning, and experimentation.
Recently, I migrated a MySQL server to Oracle forever-free VM. The free ARM-based VM has three core CPUs and 18 G memory, and its current CPU and memory utilization is very low, as shown below.
Its remaining capability is more than enough to host a Trilium App.
Let’s do it.
Install the App on Docker
Firstly, we need to install docker on the Oracle VM. I won’t go through the process in detail, as it is described on the official Docker site . Below are the essential commands for the installation.
1 | sudo apt-get update |
Now we can pull the Trilium docker image and run it as below.
1 | sudo docker pull zadam/trilium:0.58.7 |
In the above commands, the following actions are performed
- The trilium image version 0.58.7 (the latest available at the time of writing) is pulled.
- The data volume is mapped to the
/trilium-data
directory on the host machine - The Docker port is mapped to port 8080 on the host machine
- Access to the app is allowed from any IP address
As you can see, it is pretty straightforward to run a trilium app with Docker.
If you test the new instance from your browser using the URL:[http://[IP](http://[ip/) address]:8080
, the setup screen should be shown.
Secure the App with Ngnix and SSL certificate.
The next step is to secure the App, make it accessible behind a reverse proxy and install an SSL certificate to protect the communication between the browser and the server.
Firstly, let’s install the Nginx server.
1 | sudo apt install nginx # install |
We can verify that the new instance is listening to port 80.
1 | sudo netstat -tulpn |
Once Nginx is installed, a free Let’s Encrypt SSL certificate can be created, and the appropriate configuration can be added to Nginx.
1 | sudo apt-get install certbot |
To set up the auto-renew of the certificate:
1 | #setup auto renew certificate |
If you own a domain name, you can set up a sub domain for your new Trilium app. For example, create an A record fornotes.xxx.com
, and map it to your VM IP address. This will allow you to access the URL [https://notes.xxx.com](https://notes.xxx.com/)
in the browser.
The final step is to configure the redirect in the Nginx. The Nginx configuration file can typically be found in either /etc/nginx/nginx.conf
or /etc/nginx/sites-enabled/default
. The default setting is something like the one below.
1 | server_name notes.xxx.com; # managed by Certbot |
The location section needs to be updated as below, so the request to port 443 will be directed to port 8080 at the VM.
1 | location / { |
To make the change effective, we should restart Nginx. Then, you can enjoy the new App instance by accessing https://notes.xxx.com
.
Troubleshooting: Notes don’t refresh
If you got an issue where refreshing the browser is necessary to view changes in Trillium Notes, It may be caused by the missing nginx proxy setting to support the web socket.
To determine whether it is the cause, open the Chrome dev tools, to check for the below error is shown.
To fix the issue, log in to the server and update Nginx config file as follows:
1 | location / { |
After the update, don’t forget to restart the Ngnix server.
Installing Multiple Trilium Instances on a Single VM
Installing multiple instances of Trilium on a single VM requires careful isolation to prevent conflicts between the instances. This can be achieved through a combination of virtual environments and directory structures.
Create Isolated Environments:
Virtual Environments: Use tools like virtualenv (Python) or conda to create separate environments for each Trilium instance. This ensures that dependencies and configurations are isolated.
User Accounts: Consider creating separate user accounts on the VM for each Trilium instance. This provides additional isolation at the operating system level.Install Trilium in Separate Directories:
Create dedicated directories for each Trilium instance.
Install Trilium within these directories, ensuring no overlap in configuration or data files.Configure Database Connections:
If using a database for Trilium, configure each instance to use a separate database or database user. This prevents data conflicts.Port Configuration:
Assign different port numbers to each Trilium instance to avoid conflicts when accessing them through a web browser.
Conclusion
Trilium is a great note-taking App. It is lightweight, able to work offline, fast, and works well on a mobile browser.
I hope you find this post useful. Happy noting!
- Title: Organize Your Thoughts with Trilium - A Free, Open-Source Solution
- Author: Sunny Sun
- Created at : 2023-02-12 00:00:00
- Updated at : 2024-07-28 21:11:18
- Link: http://coffeethinkcode.com/2023/02/12/organize-your-thoughts-with-trilium/
- License: This work is licensed under CC BY-NC-SA 4.0.