This tutorial shows you how to install Wiki.js on an Ubuntu 22.04 operating system. It requires MySQL and Node.js. Other databases such as PostgreSQL, MariaDB, MS SQL and SQLite can also be used.
Requirements
- Operating System: Ubuntu 22.04
- MySQL has been installed and a root user (or similar account that can create a new user) is available
MySQL
01. MySQL should be installed on the machine. If not, follow the instructions installation and setting of the root password here.
02. Next is to create the database and user for the Wiki.js. While it is also possible to use the root account, it is not recommended. Execute the following commands. Note that this setup only allows the database to be accessible from 127.0.0.1 (within the system) and cannot be accessed remotely.
sudo mysql -u root -p
Format
CREATE DATABASE <<db-name>>; CREATE USER <<db-username>>@'localhost' IDENTIFIED BY '<<db-password>>'; GRANT ALL PRIVILEGES ON <<db-name>>.* TO <<db-username>>@'localhost' IDENTIFIED BY '<<db-password>>'; FLUSH PRIVILEGES;
Example only (Set your own password, and not just copy paste this as is)
CREATE DATABASE wiki; CREATE USER [email protected] IDENTIFIED WITH mysql_native_password BY 'AVeryLongComplexP@ssw0rdW33'; GRANT ALL ON wiki.* TO 'wiki_dba'@127.0.0.1; FLUSH PRIVILEGES;
We suggest using an SSH tunnel if you intend to access the database.
Node.js
Install Node.js version 16.x. Support for Node.js 18 and later will be supported when Wiki.js 3.0 is released.
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash - && sudo apt-get install -y nodejs
Verify if installed correctly.
curl -sL https://deb.nodesource.com/test | bash -
and check the version
node --version
For other installation instructions see here.
Wiki.js
01. Download the Wiki application to the local file system.
wget https://github.com/Requarks/wiki/releases/latest/download/wiki-js.tar.gz
02. Create the directory and unpack the application
mkdir wiki tar xzf wiki-js.tar.gz -C ./wiki cd ./wiki
03. Make a copy of the sample config file
mv config.sample.yml config.yml
04. Edit the config file and apply the database credentials you created before.
nano config.yml
It will be something like the following
# --------------------------------------------------------------------- # Port the server should listen to # --------------------------------------------------------------------- port: 3000 … db: type: mysql # PostgreSQL / MySQL / MariaDB / MS SQL Server only: host: localhost port: 5432 user: wikijs pass: wikijsrocks db: wiki ssl: false
Update the configuration, specifying the application port and DB credentials. The port can be left as is or changed to port 8080.
# --------------------------------------------------------------------- # Port the server should listen to # --------------------------------------------------------------------- port: 8080 … db: type: mysql # PostgreSQL / MySQL / MariaDB / MS SQL Server only: host: 127.0.0.1 port: 3306 user: wiki_dba pass: AVeryLongComplexP@ssw0rdW33 db: wiki ssl: false


Save the changes.
05. Start the server
node server

06. Access the Wiki on your browser using the link displayed in the console. By default if you did not change the port is 3000. It will be something like http://localhost:3000

Congratulations. You now have your own setup of Wiki.js. In our next guide we will run the Wiki.js as a service and use NGINX as our reverse proxy.