Trilium免费开源笔记软件安装与使用-自建笔记服务 打造个人知识库
Trilium Notes是一个分层的笔记应用程序,专注于建立大型个人知识库。 支持相当丰富的 markdown,包括 mermaid 和 latex,而且即时渲染,和 typora 一样。支持代码类型的笔记,有高亮。 Trilium与其说是笔记软件,不如说是个人wiki。
个人知识数据库、收藏夹、代码块、手账、思维导图等等Trilium都可以帮你实现,Trilium不只是分层级,更可以无限嵌套,加密、历史版本、多媒体等支持,Trilium可以自定义插件和模板,有强大的Attributes 系统,开源且易于部署。

更多的个人效率办公软件和工具还有:
- 利用WebMonitor实时监控网页变化-支持手机微信,邮箱,TG等通知提醒
- 自建免费在线思维导图工具-用Docker安装draw.io在线思维导图程序
- Wallabag安装与使用-自建网页收藏服务-手机APP和浏览器离线保存网页
一、Trilium安装前准备
网站:
- GitHub:https://github.com/zadam/trilium
- Docker:https://hub.docker.com/r/zadam/trilium/
- 教程:https://trilium.netlify.app
- 汉化GitHub:https://github.com/Nriver/trilium-translation
- 中文说明:https://github.com/Nriver/trilium-translation/blob/main/README_CN.md
- 汉化Release:https://github.com/Nriver/trilium-translation/releases
- 第三方css界面:https://github.com/zadam/trilium/wiki/Themes
1.1 准备VPS主机
Docker需要VPS运行,现在的VPS主机基本上也是白菜价了,有关于VPS主机评测查看:VPS主机排行榜单。
1.2 Docker环境
有了VPS主机,现在你就可以需要在VPS主机上配置好Docker环境,这里有一个一键安装Docker环境的命令,配置起来非常地简单:Docker 和 Docker Compose 一键安装脚本 可手动选择安装版本和下载源。
二、Trilium服务器安装
2.1 普通安装
到Release里下载对应客户端,解压运行(Linux桌面运行trilium, Linux服务端运行trilium.sh, Windows 运行trilium.exe, macOS 运行trilium.app)。

2.2 Docker安装
- https://raw.githubusercontent.com/Nriver/trilium-translation/main/docker-compose.yml
下载docker-compose配置文件。
cd ~ mkdir trilium cd trilium wget https://raw.githubusercontent.com/Nriver/trilium-translation/main/docker-compose.yml
编辑docker-compose.yml
。
vim docker-compose.yml
注意:你可以调整Trilium的数据存储路径,你可以自己做相应的调整。
version: '3' services: trilium-cn: image: nriver/trilium-cn restart: always ports: - "8080:8080" volumes: # 把同文件夹下的 trilium-data 目录映射到容器内 - ./trilium-data:/root/trilium-data environment: # 环境变量表示容器内笔记数据的存储路径 - TRILIUM_DATA_DIR=/root/trilium-data
最后启动运行Docker。
docker-compose up -d

它会从Docker Hub直接拉镜像运行:https://hub.docker.com/repository/docker/nriver/trilium-cn,浏览器打开 http://127.0.0.1:8080
访问服务端,笔记数据会在 docker-compose.yml
同目录下。

2.3 Docker更新
cd到docker-compose.yml所在目录,先停止trilium
docker-compose down
拉取最新镜像
docker-compose pull
运行
docker-compose up -d
2.4 绑定域名访问
Trilium服务器使用IP+端口的形式访问,不如使用域名访问方便。给Trilium服务器反向绑定域名有三种方式:
宝塔面板反向绑定域名Trilium服务器。如果你的VPS主机上安装了宝塔面板(教程:新版宝塔面板安装与使用教程-利用宝塔面板在VPS主机上搭建网站),先在宝塔面板上添加域名网站,并且申请好SSL证书,然后进入到反向绑定域名界面。
如下图填写你的Trilium服务器的IP:端口地址,点击保存,重启Nginx生效。

Docker一键反向绑定域名。如果你在你的Docker安装了Nginx反向绑定域名管理工具,反向绑定域名就更简单了,先添加SSL证书。
然后添加反向绑定域名,填写你的Trilium服务器的IP+端口地址,保存,完成。

Oneinstack或者LNMP反向绑定域名。如果你的VPS主机上安装了Oneinstack或者LNMP一键包,那你可以直接修改你的域名Nginx配置文件达到反向绑定域名的目的了。
- https://docs.min.io/docs/setup-nginx-proxy-with-minio.html
- Oneinstack教程:https://wzfou.com/oneinstack-list/
- LNMP教程:https://wzfou.com/lnmp-yjb/
此部分需要一定的Nginx知识,Nginx反向绑定域名示例如下:
server { listen 443; server_name trilium.example.net; #change trilium.example.net to your domain without HTTPS or HTTP. ssl_certificate /etc/ssl/note/example.crt; #change /etc/ssl/note/example.crt to your path of crt file. ssl_certificate_key /etc/ssl/note/example.net.key; #change /etc/ssl/note/example.net.key to your path of key file. ssl on; ssl_session_cache builtin:1000 shared:SSL:10m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4; ssl_prefer_server_ciphers on; access_log /var/log/nginx/access.log; #check the path of access.log, if it doesn't fit your file, change it # 反向绑定域名部分 location / { 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-Proto $scheme; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_pass http://IP:port; #改成你的IP与端口 proxy_read_timeout 90; proxy_redirect http://IP:port https://mm.wzfou.com; #此部分修改成你自己的IP地址、端口和域名 } } # 反向绑定域名部分 }
Trilium服务器使用域名访问如下:

三、Trilium服务器使用
3.1 Trilium登录
首次进入到Trilium,点击选择“我是新用户”,然后设置Trilium账号密码。

Trilium的笔记界面如下,Trilium汉化得相当不错了,用起来也不复杂。

3.2 Trilium设置
在Trilium的左上角可以点击“选项”,这里有Trilium丰富的设置选项。

Trilium可以设置外观、密码、备份、同步等。

3.3 Trilium备份
Trilium支持简单的备份方案,该方案可在以下情况下保存文档副本:
一天一次
每周一次
每月一次
在将数据库迁移到较新版本之前
因此,总共您最多可以从不同的时间点获得4个备份,这可以保护您免受各种问题的影响。这些备份默认情况下存储在数据目录中的backup
目录中。

如果你找不到Trilium的数据存储路径,你可以点击选项“关于Trilium”,这里会有Trilium存储详细信息。

然后,你就可以在VPS主机服务器里找到Trilium笔记存储的数据了。

3.3 Trilium恢复
假设您要还原每周备份,请按以下步骤操作:
查找Trilium使用的数据目录-简单的方法是从左上角的“Menu”中打开“About Trilium Notes”,然后查看“data directory”
从现在开始我将
~/trilium-data
称为数据目录查找
~/trilium-data/backup/backup-weekly.db
文件-这是文档备份此时停止/终止Trilium
删除
~/trilium-data/document.db
、~/trilium-data/document.db-wal
和~/trilium-data/document.db-shm
(后面两个文件是自动生成的)复制并将
~/trilium-data/backup/backup-weekly.db
重命名为~/trilium-data/document.db
-这将删除文档的当前状态,因此您可能需要将其备份到其他位置确保文件是可写的,例如
chmod 600 document.db
再次启动Trilium
如果已配置同步,则需要在同步集群的所有成员之间进行同步,否则将检测到文档的旧版本(还原的备份)并将其同步到新版本。
四、Trilium客户端使用
4.1 Trilium本地登录
下载Trilium本地客户端,启动Trilium,然后选择“我已经有了Trilium账户”。

这里就可以填写你刚刚架构好的Trilium服务器地址和密码了。

稍等一会儿,Trilium本地客户端就可以从你的Trilium服务器同步数据了。

4.2 Trilium本地使用
这个是Trilium本地客户端的界面。(点击放大)

在Trilium本地客户端左下方可以看到是已经连接到Trilium服务器,表示正常同步中。


4.3 Trilium笔记操作
Trilium笔记功能非常地强大,这里挑选几个有特色的功能作介绍。
日记笔记。Trilium笔记可以直接根据日历来显示笔记,方便你自己来查看。

待办清单。Trilium笔记可以当作简单的待办事项工具。


课程表。Trilium笔记提供了课程表功能。

代码块。Trilium笔记支持代码笔记。

数学公式。Trilium笔记可以直接写数据公式。

统计表格。Trilium笔记提供了一些数据统计以及表格等功能。

画布笔记。Trilium笔记提供类似思维导图功能。


4.4 Trilium导入导出
Trilium笔记可以很方便地导入其他笔记软件的笔记。

也可以打印笔记。

4.5 Trilium备份恢复
Trilium笔记本地客户端备份恢复与Trilium笔记服务器端备份恢复是一样的,在备份选项中设置备份。

在Trilium笔记软件中点击一键备份。

在Trilium笔记选项中可以查看本地客户端数据存储路径。

五、Trilium浏览器扩展
Trilium笔记浏览器扩展可以直接保存网页内容。

你可以快速保存自己喜欢的内容到Trilium笔记当中。

六、总结
Trilium作为一个笔记软件功能强大,并且Trilium服务器端可以完美地与Trilium笔记本地客户端整合,操作起来非常地方便。不过,Trilium笔记最大的问题就是没有手机APP,目前的解决办法就是打开Trilium笔记服务器端,切换到手机浏览器模式即可。

文章出自:挖站否 https://wzfou.com/trilium/, 版权所有。本站文章除注明出处外,皆为作者原创文章,可自由引用,但请注明来源。
- 密码管理软件整理汇总-好用免费和付费的密码管理软件推荐
- 替代Evernote免费开源笔记Joplin-网盘同步笔记历史版本Markdown可视化
- Bitwarden自建密码存储系统图文教程-开源免费的bitwarden_rs安装与使用
- 免费开源笔记软件Joplin同步策略-WebDAV,NextCloud,S3云存储和Joplin Server
- Cyberduck免费的服务器和云存储文件管理软件-支持 FTP/SFTP/WebDAV/Amazon S3等
- Buttercup开源免费的密码管理器-支持网盘WebDAV同步/跨平台/手机APP
- Trilium免费开源笔记软件安装与使用-自建笔记服务 打造个人知识库
- Vaultwarden(原Bitwarden_RS)自建密码库教程-安装方法 绑定域名 Https证书

服务器到期后笔记不会丢失吗