How to Install Schnack on Ubuntu Server

Schnack is a simple self-hosted commenting system. It is built with Node.js and can be installed on Ubuntu Server. In this tutorial, we will go over the steps required to install Schnack on an Ubuntu Server.

Prerequisites

Step 1: Install Git

Schnack is hosted on Github, so we need to install Git to fetch it. Open the terminal and type the following command to install Git.

sudo apt-get update 
sudo apt-get install git 

Step 2: Clone Schnack Repository

Now that Git is installed, we can clone the Schnack repository to our server. Use the following command to clone the repository to your preferred path.

git clone https://github.com/schn4ck/schnack.git 

Step 3: Install Dependencies

Navigate to the directory where you cloned the repository and install the dependencies by running the following command.

cd schnack 
npm install 

Step 4: Configure Schnack

Schnack needs to be configured before it can work correctly. There are two ways to do this. You can either create a config file or set environment variables.

Method 1: Create a config file

Create a new file called config.json which will hold the configuration values.

touch config.json 

Open the config.json file and add the following code:

{
    "host": "localhost",
    "port": "3001",
    "mongo_url": "mongodb://localhost:27017/comments",
    "api_key": "CHANGE_ME",
    "moderation": {
        "enabled": true,
        "user_blacklist": [],
        "word_blacklist": [],
        "mail_notification": {
            "enabled": true,
            "from": "noreply@schnack.domain.com",
            "to": "admin@schnack.domain.com",
            "subject": "[SCHNACK] New Comment Requires Moderation",
            "html": "<p>A new comment requires moderation.</p>"
        }
    }
}

Note: Change the placeholder values with the correct values for your server.

Method 2: Set Environment Variables

Alternatively, you can set environment variables by using the export command, like this:

export SCHNACK_PORT=3001 
export SCHNACK_MONGO_URL=mongodb://localhost:27017/comments 
#... and so on

Step 5: Start Schnack

Finally, we can start Schnack using the npm start command.

npm start 

You should see the following message on your terminal:

schnack listening at http://localhost:3001 

You can now access Schnack on your browser by navigating to http://localhost:3001.

Conclusion

In this tutorial, we went over the steps required to install Schnack on an Ubuntu server. With a few simple steps, you can now have your own self-hosted commenting system to use on your website or blog.

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!