docs(user): how to set data dir on Windows (closes #4853)

This commit is contained in:
Elian Doran
2025-11-05 08:09:15 +02:00
parent abeeea584f
commit ab298cbb3b
7 changed files with 154 additions and 141 deletions

View File

@@ -1,12 +1,12 @@
<p>Data directory contains:</p>
<ul>
<li><code>document.db</code> - <a href="#root/_help_wX4HbRucYSDD">database</a>
<li data-list-item-id="e02c8e6918e645272972d94bf51bd34e1"><code>document.db</code> - <a href="#root/_help_wX4HbRucYSDD">database</a>
</li>
<li><code>config.ini</code> - instance level settings like port on which the
<li data-list-item-id="ee3b386f752a4d2de88a1362ff4bc447a"><code>config.ini</code> - instance level settings like port on which the
Trilium application runs</li>
<li><code>backup</code> - contains automatically <a href="#root/_help_ODY7qQn5m2FT">backup</a> of
<li data-list-item-id="e9acb98fe27a493914c7f61574b277d59"><code>backup</code> - contains automatically <a href="#root/_help_ODY7qQn5m2FT">backup</a> of
documents</li>
<li><code>log</code> - contains application log files</li>
<li data-list-item-id="e9f5de6d3c7f8d79710eb8c8e2ccac979"><code>log</code> - contains application log files</li>
</ul>
<h2>Location of the data directory</h2>
<p>Easy way how to find out which data directory Trilium uses is to look
@@ -18,30 +18,42 @@
<p>Data directory is normally named <code>trilium-data</code> and it is stored
in:</p>
<ul>
<li><code>/home/[user]/.local/share</code> for Linux</li>
<li><code>C:\Users\[user]\AppData\Roaming</code> for Windows Vista and up</li>
<li><code>/Users/[user]/Library/Application Support</code> for Mac OS</li>
<li>user's home is a fallback if some of the paths above don't exist</li>
<li>user's home is also a default setup for [[docker|Docker server installation]]</li>
<li data-list-item-id="e52706d339ce2332e73c5cfdc51edf81d"><code>/home/[user]/.local/share</code> for Linux</li>
<li data-list-item-id="e5709c767479c028d2ef60d17124ea924"><code>C:\Users\[user]\AppData\Roaming</code> for Windows Vista and up</li>
<li
data-list-item-id="eae590672aea8b24e625f372fb22d1f1b"><code>/Users/[user]/Library/Application Support</code> for Mac OS</li>
<li
data-list-item-id="e150ab7fc3c436d7cbac192acf3fe433f">user's home is a fallback if some of the paths above don't exist</li>
<li
data-list-item-id="e5f476ac39d8fa453e19b8399073a79d7">user's home is also a default setup for [[docker|Docker server installation]]</li>
</ul>
<p>If you want to back up your Trilium data, just backup this single directory
- it contains everything you need.</p>
<h3>Changing the location of data directory</h3>
<p>If you want to use some other location for the data directory than the
default one, you may change it via TRILIUM_DATA_DIR environment variable
to some other location:</p>
default one, you may change it via <code>TRILIUM_DATA_DIR</code> environment
variable to some other location:</p>
<h3>Windows</h3>
<ol>
<li data-list-item-id="e8597645795a4e5b079b8e2e4a772a7d7">Press the Windows key on your keyboard.</li>
<li data-list-item-id="ee32856df1db7c2d206baa480a672eeac">Search and select “Edit the system variables”.</li>
<li data-list-item-id="e08c7cdc0659b414465a07c78dfdaeb34">Press the “Environment Variables…” button in the bottom-right of the newly
opened screen.</li>
<li data-list-item-id="e6c7bae2590161a2661b6229c0853021c">On the top section ("User variables for [user]"), press the “New…” button.</li>
<li
data-list-item-id="effac7dc3976f17d309958dd3374cfa8d">In the <em>Variable name</em> field insert <code>TRILIUM_DATA_DIR</code>.</li>
<li
data-list-item-id="e3b74fdd03536563bb461e11111fae5ff">Press the <em>Browse Directory…</em> button and select the new directory
where to store the database.</li>
<li data-list-item-id="ed6df567f0fa772a14610b3904a0cb635">Close all the windows by pressing the <em>OK</em> button for each of them.</li>
</ol>
<h4>Linux</h4><pre><code class="language-text-x-trilium-auto">export TRILIUM_DATA_DIR=/home/myuser/data/my-trilium-data</code></pre>
<h4>Mac OS X</h4>
<p>You need to create a <code>.plist</code> file under <code>~/Library/LaunchAgents</code> to
load it properly each login.</p>
<p>To load it manually, you need to use <code>launchctl setenv TRILIUM_DATA_DIR &lt;yourpath&gt;</code>
</p>
<p>Here is a pre-defined template, where you just need to add your path to:</p><pre><code class="language-text-x-trilium-auto">
Label
<p>Here is a pre-defined template, where you just need to add your path to:</p><pre><code class="language-text-x-trilium-auto"> Label
set.trilium.env
RunAtLoad
@@ -50,21 +62,19 @@
launchctl
setenv
TRILIUM_DATA_DIR
/Users/YourUserName/Library/Application Support/trilium-data
</code></pre>
/Users/YourUserName/Library/Application Support/trilium-data </code></pre>
<h3>Create a script to run with specific data directory</h3>
<p>An alternative to globally setting environment variable is to run only
the Trilium Notes with this environment variable. This then allows for
different setup styles like two <a href="#root/_help_wX4HbRucYSDD">database</a> instances
or "portable" installation.</p>
<p>To do this in unix based systems simply run trilium like this:</p><pre><code class="language-text-x-trilium-auto">TRILIUM_DATA_DIR=/home/myuser/data/my-trilium-data trilium</code></pre>
<p>To do this in Unix-based systems simply run <code>trilium</code> like this:</p><pre><code class="language-text-x-trilium-auto">TRILIUM_DATA_DIR=/home/myuser/data/my-trilium-data trilium</code></pre>
<p>You can then save the above command as a shell script on your path for
convenience.</p>
<h2>Fine-grained directory/path location</h2>
<p>Apart from the data directory, some of the subdirectories of it can be
moved elsewhere by changing an environment variable:</p>
<figure class="table">
<table>
<thead>
<tr>
@@ -123,3 +133,4 @@
</tr>
</tbody>
</table>
</figure>

View File

@@ -15,6 +15,20 @@
"type": "text",
"mime": "text/html",
"attributes": [
{
"type": "relation",
"name": "internalLink",
"value": "T2W7WCZrYZBU",
"isInheritable": false,
"position": 10
},
{
"type": "relation",
"name": "internalLink",
"value": "cxfTSHIUQtt2",
"isInheritable": false,
"position": 20
},
{
"type": "label",
"name": "label:shareAlias",
@@ -35,20 +49,6 @@
"value": "developer-guide",
"isInheritable": false,
"position": 30
},
{
"type": "relation",
"name": "internalLink",
"value": "T2W7WCZrYZBU",
"isInheritable": false,
"position": 40
},
{
"type": "relation",
"name": "internalLink",
"value": "cxfTSHIUQtt2",
"isInheritable": false,
"position": 50
}
],
"format": "markdown",
@@ -817,7 +817,7 @@
"name": "internalLink",
"value": "Jg7clqogFOyD",
"isInheritable": false,
"position": 20
"position": 10
},
{
"type": "label",

View File

@@ -383,7 +383,7 @@ for (const blob of orphanedBlobs) {
**Process:**
```sh
```
# Check for vulnerabilities
npm audit
@@ -424,7 +424,7 @@ npm audit fix --force
**pnpm Patches:**
```sh
```
# Create patch
pnpm patch @ckeditor/ckeditor5

View File

@@ -9,7 +9,7 @@ Trilium implements a **bidirectional synchronization system** that allows users
## Sync Architecture
```mermaid
```
graph TB
Desktop1[Desktop 1<br/>Client]
Desktop2[Desktop 2<br/>Client]

View File

@@ -1,5 +1,5 @@
# Documentation
There are multiple types of documentation for Trilium:<img class="image-style-align-right" src="api/images/45okJ9xpVO32/Documentation_image.png" width="205" height="162">
There are multiple types of documentation for Trilium:<img class="image-style-align-right" src="api/images/6iUHD6bZIVmd/Documentation_image.png" width="205" height="162">
* The _User Guide_ represents the user-facing documentation. This documentation can be browsed by users directly from within Trilium, by pressing <kbd>F1</kbd>.
* The _Developer's Guide_ represents a set of Markdown documents that present the internals of Trilium, for developers.

View File

@@ -25,56 +25,35 @@
{
"type": "relation",
"name": "internalLink",
"value": "BFs8mudNFgCS",
"value": "gh7bpGYxajRS",
"isInheritable": false,
"position": 20
},
{
"type": "relation",
"name": "internalLink",
"value": "BFs8mudNFgCS",
"isInheritable": false,
"position": 30
},
{
"type": "relation",
"name": "internalLink",
"value": "GTwFsgaA0lCt",
"isInheritable": false,
"position": 30
},
{
"type": "label",
"name": "shareAlias",
"value": "user-guide",
"isInheritable": false,
"position": 10
},
{
"type": "label",
"name": "label:shareAlias",
"value": "promoted,alias=Slug,single,text",
"isInheritable": true,
"position": 20
},
{
"type": "label",
"name": "iconClass",
"value": "bx bx-help-circle",
"isInheritable": false,
"position": 30
"position": 40
},
{
"type": "relation",
"name": "internalLink",
"value": "poXkQfguuA0U",
"isInheritable": false,
"position": 40
},
{
"type": "relation",
"name": "internalLink",
"value": "WOcw2SLH6tbX",
"isInheritable": false,
"position": 50
},
{
"type": "relation",
"name": "internalLink",
"value": "gh7bpGYxajRS",
"value": "WOcw2SLH6tbX",
"isInheritable": false,
"position": 60
},
@@ -98,6 +77,27 @@
"value": "9qPsTWBorUhQ",
"isInheritable": false,
"position": 90
},
{
"type": "label",
"name": "shareAlias",
"value": "user-guide",
"isInheritable": false,
"position": 10
},
{
"type": "label",
"name": "label:shareAlias",
"value": "promoted,alias=Slug,single,text",
"isInheritable": true,
"position": 20
},
{
"type": "label",
"name": "iconClass",
"value": "bx bx-help-circle",
"isInheritable": false,
"position": 30
}
],
"format": "markdown",

View File

@@ -26,7 +26,17 @@ If you want to back up your Trilium data, just backup this single directory - it
### Changing the location of data directory
If you want to use some other location for the data directory than the default one, you may change it via TRILIUM\_DATA\_DIR environment variable to some other location:
If you want to use some other location for the data directory than the default one, you may change it via `TRILIUM_DATA_DIR` environment variable to some other location:
### Windows
1. Press the Windows key on your keyboard.
2. Search and select “Edit the system variables”.
3. Press the “Environment Variables…” button in the bottom-right of the newly opened screen.
4. On the top section ("User variables for \[user\]"), press the “New…” button.
5. In the _Variable name_ field insert `TRILIUM_DATA_DIR`.
6. Press the _Browse Directory…_ button and select the new directory where to store the database.
7. Close all the windows by pressing the _OK_ button for each of them.
#### Linux
@@ -43,11 +53,6 @@ To load it manually, you need to use `launchctl setenv TRILIUM_DATA_DIR <yourpat
Here is a pre-defined template, where you just need to add your path to:
```
Label
set.trilium.env
RunAtLoad
@@ -58,16 +63,13 @@ Here is a pre-defined template, where you just need to add your path to:
setenv
TRILIUM_DATA_DIR
/Users/YourUserName/Library/Application Support/trilium-data
```
### Create a script to run with specific data directory
An alternative to globally setting environment variable is to run only the Trilium Notes with this environment variable. This then allows for different setup styles like two [database](../Advanced%20Usage/Database.md) instances or "portable" installation.
To do this in unix based systems simply run trilium like this:
To do this in Unix-based systems simply run `trilium` like this:
```
TRILIUM_DATA_DIR=/home/myuser/data/my-trilium-data trilium