| title | Linux |
|---|---|
| description | Getting started with a Wiki.js installation on Linux |
| published | true |
| date | 2022-04-04 19:36:18 UTC |
| tags | setup |
| editor | markdown |
| dateCreated | 2019-05-04 04:05:55 UTC |
Before going any further, make sure your system meets all the requirements.
Looking for a complete, easy step-by-step installation guide, including all dependencies and an auto-updater? Check out the Ubuntu-based installation guide. {.is-info}
- Download the latest version of Wiki.js:
wget https://github.com/Requarks/wiki/releases/latest/download/wiki-js.tar.gz- Extract the package to the final destination of your choice:
mkdir wiki
tar xzf wiki-js.tar.gz -C ./wiki
cd ./wiki- Rename the sample config file to
config.yml:
mv config.sample.yml config.yml- Edit the config file and fill in your database and port settings (Configuration Reference):
nano config.yml- For SQLite installations only: (skip this step otherwise) Fetch native bindings for SQLite3:
npm rebuild sqlite3- Run Wiki.js
node server- Wait until you are invited to open to the setup page in your browser.
- Complete the setup wizard to finish the installation.
There are several solutions to run Wiki.js as a background service. We'll focus on systemd in this guide as it's available in nearly all linux distributions.
- Create a new file named
wiki.serviceinside directory/etc/systemd/system.
nano /etc/systemd/system/wiki.service- Paste the following contents (assuming your wiki is installed at
/var/wiki):
[Unit]
Description=Wiki.js
After=network.target
[Service]
Type=simple
ExecStart=/usr/bin/node server
Restart=always
# Consider creating a dedicated user for Wiki.js here:
User=nobody
Environment=NODE_ENV=production
WorkingDirectory=/var/wiki
[Install]
WantedBy=multi-user.target- Save the service file (CTRL+X, followed by Y).
- Reload systemd:
systemctl daemon-reload- Run the service:
systemctl start wiki- Enable the service on system boot.
systemctl enable wikiNote: You can see the logs of the service using journalctl -u wiki