In this tutorial, we will learn how to install Wiki.js on NixOS.
Firstly, you need to update your system to make sure that you have the latest version of the packages on your system.
sudo nix-channel --update
sudo nixos-rebuild switch
Before we install Wiki.js, we need to install some of its dependencies so that our application can run without any problem.
sudo nix-env -iA nixos.nodejs-lts-14_x
sudo nix-env -iA nixos.postgresql
In this step, we will download and install Wiki.js on our NixOS machine.
sudo mkdir /var/wiki
sudo chown $USER /var/wiki
cd /var/wiki
sudo npm install wiki.js@latest
To use Wiki.js, we need to create a PostgreSQL database and user.
Create a new database:
sudo -i -u postgres
createdb wikijs
Create a new PostgreSQL user and set a password:
createuser wikijs
psql
ALTER USER wikijs PASSWORD 'wikijs_password';
GRANT ALL PRIVILEGES ON DATABASE wikijs TO wikijs;
\q
Now that we have Wiki.js and PostgreSQL installed, we need to configure Wiki.js to use PostgreSQL.
Copy the sample configuration file:
cd /var/wiki
cp config.sample.yml config.yml
Edit the config file to include your PostgreSQL database details:
nano config.yml
Update the following fields:
# ...
db:
client: pg
connection:
host: localhost
port: 5432
database: wikijs
user: wikijs
password: wikijs_password
# ...
Now that we have configured Wiki.js, we need to start the application.
cd /var/wiki
sudo npm start
You should see the following message indicating that the server has started:
Wiki.js v2.x.x
Environment : production
Port : 3000
Process ID : XXX
Node Version : v14.x.x
Database : PostgreSQL
Open your web browser and go to http://localhost:3000
to access your Wiki.js site.
In this tutorial, we learned how to install Wiki.js on NixOS. We also configured PostgreSQL and started Wiki.js successfully. Enjoy exploring Wiki.js!
If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!
Alternatively, for the best virtual desktop, try Shells!