Download Trilium from their official GitHub page
wget https://github.com/zadam/trilium/releases/download/v0.50.2/trilium-linux-x64-server-0.50.2.tar.xz
Unpack the download and move it into /opt/trilium
tar -xvf trilium-linux-x64-server-0.50.2.tar.xz
mv trilium-linux-x64-server/* /opt/trilium/
Create a new user and change file permissions
adduser trilium --disabled-password
chown trilium:trilium /opt/trilium/ -R
Create a new systemd file
vim /etc/systemd/system/trilium.service
Use the following config
[Unit]
Description=Trilium Daemon
After=syslog.target network.target
[Service]
User=trilium
Group=trilium
Type=simple
ExecStart=/opt/trilium/trilium.sh
WorkingDirectory=/opt/trilium/
TimeoutStopSec=20
# KillMode=process leads to error, according to https://www.freedesktop.org/software/systemd/man/systemd.kill.html
Restart=always
[Install]
WantedBy=multi-user.target
Enable and start Trilium
systemctl enable trilium.service
systemctl start trilium.service
systemctl status trilium.service
Navigate to http://[hostname-or-ip]:8080
and follow the wizard.