<\/span><\/h2>\r\n\r\n\r\n\r\nFirst, log in to your CentOS 8 server via SSH as the root user:<\/p>\r\n\r\n\r\n\r\n
ssh root@IP_Address -p Port_number<\/pre>\r\n\r\n\r\n\r\nYou will need to replace \u2018IP_Address\u2018 and \u2018Port_number\u2018 with your server\u2019s respective IP address and SSH port number. Additionally, replace \u2018root\u2019 with the username of the admin account if necessary.<\/p>\r\n\r\n\r\n\r\n
Before starting, you have to make sure that all CentOS packages installed on the server are up to date. You can do this by running the following commands:<\/p>\r\n\r\n\r\n\r\n
dnf update -y<\/pre>\r\n\r\n\r\n\r\n<\/span>Step 2: Install Node.js and Redis<\/span><\/h2>\r\n\r\n\r\n\r\nWiki.js is built on Node.js. So you will need to install Node.js in your system. First, install all required dependencies with the following command:<\/p>\r\n\r\n\r\n\r\n
dnf install epel-release git curl unzip -y<\/pre>\r\n\r\n\r\n\r\nOnce all the dependencies are installed, add the Node.js repository with the following command:<\/p>\r\n\r\n\r\n\r\n
curl -sL https:\/\/rpm.nodesource.com\/setup_12.x | bash -<\/pre>\r\n\r\n\r\n\r\nNext, install Node.js and Redis with the following command:<\/p>\r\n\r\n\r\n\r\n
dnf install nodejs -y\r\ndnf install redis -y<\/pre>\r\n\r\n\r\n\r\nAfter installing both packages, start the Redis service and enable it to start at system reboot with the following command:<\/p>\r\n\r\n\r\n\r\n
systemctl start redis\r\nsystemctl enable redis<\/pre>\r\n\r\n\r\n\r\n<\/span>Step 3: Install Nginx and MariaDB<\/span><\/h2>\r\n\r\n\r\n\r\nNext, will need to install the Nginx web server and MariaDB database server to your system. You can install both packages with the following command:<\/p>\r\n\r\n\r\n\r\n
dnf install nginx @mariadb -y<\/pre>\r\n\r\n\r\n\r\nOnce both packages are installed, start the Nginx and MariaDB service and enable them to start at system reboot with the following command:<\/p>\r\n\r\n\r\n\r\n
systemctl start nginx\r\nsystemctl start mariadb\r\nsystemctl enable nginx\r\nsystemctl enable mariadb<\/pre>\r\n\r\n\r\n\r\nOnce installed, secure the MariaDB installation by running the following command:<\/p>\r\n\r\n\r\n\r\n
mysql_secure_installation<\/code><\/p>\r\n\r\n\r\n\r\nAnswer all the questions as shown below to set the MariaDB root password and secure the installation:<\/p>\r\n\r\n\r\n\r\n
Enter current password for root (enter for none):\r\nSet root password? [Y\/n] Y\r\nNew password:\r\nRe-enter new password:\r\nRemove anonymous users? [Y\/n] Y\r\nDisallow root login remotely? [Y\/n] Y\r\nRemove test database and access to it? [Y\/n] Y\r\nReload privilege tables now? [Y\/n] Y\r\n<\/pre>\r\n\r\n\r\n\r\nOnce the MariaDB is secured, log in to the MariaDB console with the following command:<\/p>\r\n\r\n\r\n\r\n
mysql -u root -p<\/pre>\r\n\r\n\r\n\r\nOnce login, create a database and user for Wiki.js with the following command:<\/p>\r\n\r\n\r\n\r\n
MariaDB [(none)]> CREATE DATABASE wikidb;\r\nMariaDB [(none)]> GRANT ALL PRIVILEGES ON wikidb.* TO 'wiki'@'localhost' IDENTIFIED BY 'password';<\/pre>\r\n\r\n\r\n\r\nNext, flush the privileges and exit from the MariaDB with the following command:<\/p>\r\n\r\n\r\n\r\n
MariaDB [(none)]> FLUSH PRIVILEGES;\r\nMariaDB [(none)]> EXIT;<\/pre>\r\n\r\n\r\n\r\nOnce the MariaDB is configured, you can proceed to install Wiki.js.<\/p>\r\n\r\n\r\n\r\n
<\/span>Step 4: Install Wiki.js<\/span><\/h2>\r\n\r\n\r\n\r\nFirst, create a separate user and group for Wiki.js with the following command:<\/p>\r\n\r\n\r\n\r\n
groupadd --system wiki\r\nuseradd -s \/sbin\/nologin --system -g wiki wiki<\/pre>\r\n\r\n\r\n\r\nNext, download the latest version of Wiki.js with the following command:<\/p>\r\n\r\n\r\n\r\n
curl -s https:\/\/api.github.com\/repos\/Requarks\/wiki\/releases\/latest | grep browser_download_url | grep -v windows | cut -d '\"' -f 4 | wget -qi -<\/pre>\r\n\r\n\r\n\r\nNext, create a directory for Wiki.js and extract the downloaded file to the \/var\/www\/html\/wiki directory:<\/p>\r\n\r\n\r\n\r\n
mkdir -p \/var\/www\/html\/wiki\r\ntar zxf wiki-js.tar.gz -C \/var\/www\/html\/wiki<\/pre>\r\n\r\n\r\n\r\nNext, change the directory to the wiki and copy the sample configuration file:<\/p>\r\n\r\n\r\n\r\n
cd \/var\/www\/html\/wiki\r\ncp config.sample.yml config.yml<\/pre>\r\n\r\n\r\n\r\nNext, edit the config.yml file and define your MariaDB database:<\/p>\r\n\r\n\r\n\r\n
nano config.yml<\/pre>\r\n\r\n\r\n\r\nDefine your MariaDB database details as shown below:<\/p>\r\n\r\n\r\n\r\n
db:\r\n type: mariadb\r\n\r\n # PostgreSQL \/ MySQL \/ MariaDB \/ MS SQL Server only:\r\n host: localhost\r\n port: 3306\r\n user: wiki\r\n pass: password\r\n db: wikidb\r\n ssl: false\r\n<\/pre>\r\n\r\n\r\n\r\nSave and close the file then change the ownership of the wiki directory with the following command:<\/p>\r\n\r\n\r\n\r\n
chown -R wiki:wiki \/var\/www\/html\/wiki<\/pre>\r\n\r\n\r\n\r\nNext, verify the Wiki.js with the following command:<\/p>\r\n\r\n\r\n\r\n
node server<\/pre>\r\n\r\n\r\n\r\nIf everything is fine, you should get the following output:<\/p>\r\n\r\n\r\n\r\n
Loading configuration from \/var\/www\/html\/wiki\/config.yml... OK\r\n2020-11-09T08:16:24.205Z [MASTER] info: =======================================\r\n2020-11-09T08:16:24.207Z [MASTER] info: = Wiki.js 2.5.170 =====================\r\n2020-11-09T08:16:24.207Z [MASTER] info: =======================================\r\n2020-11-09T08:16:24.207Z [MASTER] info: Initializing...\r\n2020-11-09T08:16:24.801Z [MASTER] info: Using database driver mysql2 for mariadb [ OK ]\r\n2020-11-09T08:16:24.805Z [MASTER] info: Connecting to database...\r\n2020-11-09T08:16:24.834Z [MASTER] info: Database Connection Successful [ OK ]\r\n2020-11-09T08:16:27.571Z [MASTER] warn: DB Configuration is empty or incomplete. Switching to Setup mode...\r\n2020-11-09T08:16:27.572Z [MASTER] info: Starting setup wizard...\r\n2020-11-09T08:16:27.747Z [MASTER] info: Starting HTTP server on port 3000...\r\n2020-11-09T08:16:27.747Z [MASTER] info: HTTP Server on port: [ 3000 ]\r\n2020-11-09T08:16:27.751Z [MASTER] info: HTTP Server: [ RUNNING ]\r\n2020-11-09T08:16:27.751Z [MASTER] info: \r\n2020-11-09T08:16:27.751Z [MASTER] info: \r\n2020-11-09T08:16:27.751Z [MASTER] info: Browse to http:\/\/YOUR-SERVER-IP:3000\/ to complete setup!\r\n2020-11-09T08:16:27.751Z [MASTER] info: \r\n2020-11-09T08:16:27.751Z [MASTER] info: \r\n<\/pre>\r\n\r\n\r\n\r\n