trilium-next
大约 2 分钟tools
安装
下面步骤安装在乐达电信天翼云 ubuntu22server 上,访问地址是 trilium.染厂云域名,设置了 nginx 自动跳转 https,nginx 配置文件在 /etc/nginx/sites-enabled/ 下
cd /root
sudo mkdir trilium-next
sudo chmod +x trilium-next
cd trilium-next
# 下载 docker-compose
sudo wget https://raw.githubusercontent.com/TriliumNext/Trilium/master/docker-compose.yml
# 或者直接拷贝下面的内容保存为 docker-compose.yml - 上面的命令就是为了下载这个配置文件
# Running `docker-compose up` will create/use the "trilium-data" directory in the user home
# Run `TRILIUM_DATA_DIR=/path/of/your/choice docker-compose up` to set a different directory
# To run in the background, use `docker-compose up -d`
services:
trilium:
# Optionally, replace `latest` with a version tag like `v0.90.3`
# Using `latest` may cause unintended updates to the container
image: triliumnext/trilium:latest
# Restart the container unless it was stopped by the user
restart: unless-stopped
environment:
- TRILIUM_DATA_DIR=/home/node/trilium-data
ports:
# By default, Trilium will be available at http://localhost:8080
# It will also be accessible at http://<host-ip>:8080
# You might want to limit this with something like Docker Networks, reverse proxies, or firewall rules,
# however be aware that using UFW is known to not work with default Docker installations, see:
# https://docs.docker.com/engine/network/packet-filtering-firewalls/#docker-and-ufw
- '8080:8080'
volumes:
# Unless TRILIUM_DATA_DIR is set, the data will be stored in the "trilium-data" directory in the home directory.
# This can also be changed with by replacing the line below with `- /path/of/your/choice:/home/node/trilium-data
- ${TRILIUM_DATA_DIR:-~/trilium-data}:/home/node/trilium-data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
# 修改配置文件中的端口号,修改使用宿主机的端口号为 11808
sudo vim docker-compose.yml
# 由于魔法的问题,在运行下面命令之前先设置 docker-compose 使用魔法下载依赖
# 查看文章:develop > devOps > docker > 03.国内镜像仓库
sudo docker-compose up -d
设置服务器地址
在路径 menu > options > sync 中设置要素 server instance address 中设置云端服务器的域名(如果是按照官方提供的 nginx 代码 - 自动跳转 https - 就不需要带有端口号),不需要设置要素 sync proxy server,保存后即会自动同步数据到云端
备份与恢复
在桌面端的菜单项路径是:menu > options > backup 备份后形成的文件 xx.db 恢复到新的服务器的数据目录下即可,一般数据文件的路径在 ~/trilium-data 下(具体要看安装时用的文件 docker-compose.yml),先停止服务 docker-compose down 然后拷贝备份文件到 ~/trilium-data 下并重命名为 document.db 然后启动服务 docker-compose up -d (执行 docker-compose 命令时都要保证当前目录处于 ~/trilium-next/ 下,即和配置文件 docker-compose.yml 同目录)
