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> <p>Data directory contains:</p>
<ul> <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>
<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> 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> 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> </ul>
<h2>Location of the data directory</h2> <h2>Location of the data directory</h2>
<p>Easy way how to find out which data directory Trilium uses is to look <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 <p>Data directory is normally named <code>trilium-data</code> and it is stored
in:</p> in:</p>
<ul> <ul>
<li><code>/home/[user]/.local/share</code> for Linux</li> <li data-list-item-id="e52706d339ce2332e73c5cfdc51edf81d"><code>/home/[user]/.local/share</code> for Linux</li>
<li><code>C:\Users\[user]\AppData\Roaming</code> for Windows Vista and up</li> <li data-list-item-id="e5709c767479c028d2ef60d17124ea924"><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
<li>user's home is a fallback if some of the paths above don't exist</li> data-list-item-id="eae590672aea8b24e625f372fb22d1f1b"><code>/Users/[user]/Library/Application Support</code> for Mac OS</li>
<li>user's home is also a default setup for [[docker|Docker server installation]]</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> </ul>
<p>If you want to back up your Trilium data, just backup this single directory <p>If you want to back up your Trilium data, just backup this single directory
- it contains everything you need.</p> - it contains everything you need.</p>
<h3>Changing the location of data directory</h3> <h3>Changing the location of data directory</h3>
<p>If you want to use some other location for the data directory than the <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 default one, you may change it via <code>TRILIUM_DATA_DIR</code> environment
to some other location:</p> 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>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> <h4>Mac OS X</h4>
<p>You need to create a <code>.plist</code> file under <code>~/Library/LaunchAgents</code> to <p>You need to create a <code>.plist</code> file under <code>~/Library/LaunchAgents</code> to
load it properly each login.</p> 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>To load it manually, you need to use <code>launchctl setenv TRILIUM_DATA_DIR &lt;yourpath&gt;</code>
</p> </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"> <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
Label
set.trilium.env set.trilium.env
RunAtLoad RunAtLoad
@@ -50,76 +62,75 @@
launchctl launchctl
setenv setenv
TRILIUM_DATA_DIR TRILIUM_DATA_DIR
/Users/YourUserName/Library/Application Support/trilium-data /Users/YourUserName/Library/Application Support/trilium-data </code></pre>
</code></pre>
<h3>Create a script to run with specific data directory</h3> <h3>Create a script to run with specific data directory</h3>
<p>An alternative to globally setting environment variable is to run only <p>An alternative to globally setting environment variable is to run only
the Trilium Notes with this environment variable. This then allows for the Trilium Notes with this environment variable. This then allows for
different setup styles like two <a href="#root/_help_wX4HbRucYSDD">database</a> instances different setup styles like two <a href="#root/_help_wX4HbRucYSDD">database</a> instances
or "portable" installation.</p> 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 <p>You can then save the above command as a shell script on your path for
convenience.</p> convenience.</p>
<h2>Fine-grained directory/path location</h2> <h2>Fine-grained directory/path location</h2>
<p>Apart from the data directory, some of the subdirectories of it can be <p>Apart from the data directory, some of the subdirectories of it can be
moved elsewhere by changing an environment variable:</p> moved elsewhere by changing an environment variable:</p>
<table> <figure class="table">
<thead> <table>
<tr> <thead>
<th>Environment variable</th> <tr>
<th>Default value</th> <th>Environment variable</th>
<th>Description</th> <th>Default value</th>
</tr> <th>Description</th>
</thead> </tr>
<tbody> </thead>
<tr> <tbody>
<td><code>TRILIUM_DOCUMENT_PATH</code> <tr>
</td> <td><code>TRILIUM_DOCUMENT_PATH</code>
<td><code>${TRILIUM_DATA_DIR}/document.db</code> </td>
</td> <td><code>${TRILIUM_DATA_DIR}/document.db</code>
<td>Path to the&nbsp;<a class="reference-link" href="#root/_help_wX4HbRucYSDD">Database</a>&nbsp;(storing </td>
all notes and metadata).</td> <td>Path to the&nbsp;<a class="reference-link" href="#root/_help_wX4HbRucYSDD">Database</a>&nbsp;(storing
</tr> all notes and metadata).</td>
<tr> </tr>
<td><code>TRILIUM_BACKUP_DIR</code> <tr>
</td> <td><code>TRILIUM_BACKUP_DIR</code>
<td><code>${TRILIUM_DATA_DIR}/backup</code> </td>
</td> <td><code>${TRILIUM_DATA_DIR}/backup</code>
<td>Directory where automated&nbsp;<a class="reference-link" href="#root/_help_ODY7qQn5m2FT">Backup</a>&nbsp;databases </td>
are stored.</td> <td>Directory where automated&nbsp;<a class="reference-link" href="#root/_help_ODY7qQn5m2FT">Backup</a>&nbsp;databases
</tr> are stored.</td>
<tr> </tr>
<td><code>TRILIUM_LOG_DIR</code> <tr>
</td> <td><code>TRILIUM_LOG_DIR</code>
<td><code>${TRILIUM_DATA_DIR}/log</code> </td>
</td> <td><code>${TRILIUM_DATA_DIR}/log</code>
<td>Directory where daily&nbsp;<a class="reference-link" href="#root/_help_bnyigUA2UK7s">Backend (server) logs</a>&nbsp;are </td>
stored.</td> <td>Directory where daily&nbsp;<a class="reference-link" href="#root/_help_bnyigUA2UK7s">Backend (server) logs</a>&nbsp;are
</tr> stored.</td>
<tr> </tr>
<td><code>TRILIUM_TMP_DIR</code> <tr>
</td> <td><code>TRILIUM_TMP_DIR</code>
<td><code>${TRILIUM_DATA_DIR}/tmp</code> </td>
</td> <td><code>${TRILIUM_DATA_DIR}/tmp</code>
<td>Directory where temporary files are stored (for example when opening in </td>
an external app).</td> <td>Directory where temporary files are stored (for example when opening in
</tr> an external app).</td>
<tr> </tr>
<td><code>TRILIUM_ANONYMIZED_DB_DIR</code> <tr>
</td> <td><code>TRILIUM_ANONYMIZED_DB_DIR</code>
<td><code>${TRILIUM_DATA_DIR}/anonymized-db</code> </td>
</td> <td><code>${TRILIUM_DATA_DIR}/anonymized-db</code>
<td>Directory where a&nbsp;<a class="reference-link" href="#root/_help_x59R8J8KV5Bp">Anonymized Database</a>&nbsp;is </td>
stored.</td> <td>Directory where a&nbsp;<a class="reference-link" href="#root/_help_x59R8J8KV5Bp">Anonymized Database</a>&nbsp;is
</tr> stored.</td>
<tr> </tr>
<td><code>TRILIUM_CONFIG_INI_PATH</code> <tr>
</td> <td><code>TRILIUM_CONFIG_INI_PATH</code>
<td><code>${TRILIUM_DATA_DIR}/config.ini</code> </td>
</td> <td><code>${TRILIUM_DATA_DIR}/config.ini</code>
<td>Path to&nbsp;<a class="reference-link" href="#root/_help_Gzjqa934BdH4">Configuration (config.ini or environment variables)</a>&nbsp;file.</td> </td>
</tr> <td>Path to&nbsp;<a class="reference-link" href="#root/_help_Gzjqa934BdH4">Configuration (config.ini or environment variables)</a>&nbsp;file.</td>
</tbody> </tr>
</table> </tbody>
</table>
</figure>

View File

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

View File

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

View File

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

View File

@@ -1,5 +1,5 @@
# Documentation # 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 _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. * 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", "type": "relation",
"name": "internalLink", "name": "internalLink",
"value": "BFs8mudNFgCS", "value": "gh7bpGYxajRS",
"isInheritable": false, "isInheritable": false,
"position": 20 "position": 20
}, },
{
"type": "relation",
"name": "internalLink",
"value": "BFs8mudNFgCS",
"isInheritable": false,
"position": 30
},
{ {
"type": "relation", "type": "relation",
"name": "internalLink", "name": "internalLink",
"value": "GTwFsgaA0lCt", "value": "GTwFsgaA0lCt",
"isInheritable": false, "isInheritable": false,
"position": 30 "position": 40
},
{
"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
}, },
{ {
"type": "relation", "type": "relation",
"name": "internalLink", "name": "internalLink",
"value": "poXkQfguuA0U", "value": "poXkQfguuA0U",
"isInheritable": false, "isInheritable": false,
"position": 40
},
{
"type": "relation",
"name": "internalLink",
"value": "WOcw2SLH6tbX",
"isInheritable": false,
"position": 50 "position": 50
}, },
{ {
"type": "relation", "type": "relation",
"name": "internalLink", "name": "internalLink",
"value": "gh7bpGYxajRS", "value": "WOcw2SLH6tbX",
"isInheritable": false, "isInheritable": false,
"position": 60 "position": 60
}, },
@@ -98,6 +77,27 @@
"value": "9qPsTWBorUhQ", "value": "9qPsTWBorUhQ",
"isInheritable": false, "isInheritable": false,
"position": 90 "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", "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 ### 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 #### 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: Here is a pre-defined template, where you just need to add your path to:
``` ```
Label Label
set.trilium.env set.trilium.env
RunAtLoad RunAtLoad
@@ -57,17 +62,14 @@ Here is a pre-defined template, where you just need to add your path to:
launchctl launchctl
setenv setenv
TRILIUM_DATA_DIR TRILIUM_DATA_DIR
/Users/YourUserName/Library/Application Support/trilium-data /Users/YourUserName/Library/Application Support/trilium-data
``` ```
### Create a script to run with specific data directory ### 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. 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 TRILIUM_DATA_DIR=/home/myuser/data/my-trilium-data trilium