Install PencilBlue on Debian 8

install-pencilblue-on-a-debian-8-vpsIn this blog post we will show you how to install PencilBlue CMS on a Debian 8 VPS with the latest version of Nginx. PencilBlue is an open source content management system built on Node.js. This guide should work on other Linux VPS systems as well but was tested and written for Debian 8 VPS.

Login to your VPS via SSH

ssh user@vps

Update the system and install necessary packages.

[user]$ sudo apt-get update && sudo apt-get -y upgrade
[user]$ sudo apt-get install curl git

Install Node.js

We will install the latest nodejs package from the NodeSource repository:

[user]$ curl --silent --location https://deb.nodesource.com/setup_0.12 | sudo bash -
[user]$ sudo apt-get install nodejs

Install Redis and MongoDB

Install the latest Redis and MongoDB packages from the official Debian repository:

[user]$ sudo apt-get install mongodb redis-server

Install PencilBlue

Clone the PencilBlue git repository from github using the following command:

[user]$ git clone https://github.com/pencilblue/pencilblue.git ~/pencilblue

Pull all dependencies:

[user]$ cd ~/pencilblue
[user]$ npm install

Create a custom configuration file:

cp sample.config.js config.js

Open the config.js file and edit to your liking.

Install and Configure Nginx

The latest version of Nginx, version 1.8 is not available via the default Debian repositories, so we will add the Dotdeb repository. Open the /etc/apt/sources.list file and append the following lines:

[user]$ sudo vim /etc/apt/sources.list
deb http://packages.dotdeb.org jessie all
deb-src http://packages.dotdeb.org jessie all

Fetch and install the GnuPG key:

[user]$ curl -sS http://www.dotdeb.org/dotdeb.gpg | sudo apt-key add -

Update the system and install Nginx:

[user]$ sudo apt-get update
[user]$ sudo apt-get -y install nginx

Create a new Nginx server block with the following content

Need a fast and easy fix?
✔ Unlimited Managed Support
✔ Supports Your Software
✔ 2 CPU Cores
✔ 2 GB RAM
✔ 50 GB PCIe4 NVMe Disk
✔ 1854 GeekBench Score
✔ Unmetered Data Transfer
NVME 2 VPS

Now just $43 .99
/mo

GET YOUR VPS
[user]$ sudo vim /etc/nginx/sites-available/my_pencilblue.com
server {
    server_name my_pencilblue.com;
    listen 80;

    access_log /var/log/nginx/my_pencilblue-access.log;
    error_log /var/log/nginx/my_pencilblue-error.log;

    location / {
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   Host      $http_host;
        proxy_pass         http://127.0.0.1:8080;
    }
 
}

Activate the server block by creating a symbolic link :

[user]$ sudo ln -s /etc/nginx/sites-available/my_pencilblue.com /etc/nginx/sites-enabled/my_pencilblue.com

Test the Nginx configuration and restart nginx:

[user]$ sudo nginx -t
[user]$ sudo service nginx restart

Create an systemd script

[user]$ sudo nano /etc/systemd/system/pencilblue.service
[Unit]
Description=pencilblue
After=network.target

[Service]
ExecStart=/usr/bin/node /home/your_username/pencilblue/pencilblue.js
Restart=always
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=pencilblue
Environment=NODE_ENV=production
User=your_username
Group=your_username

[Install]
WantedBy=multi-user.target

Enable and start your PencilBlue instance with:

[user]$ sudo systemctl enable pencilblue
[user]$  sudo systemctl start pencilblue

That’s it. Now open your browser, type the address of your website and register the site’s first admin account.

For more information about how manage your PencilBlue CMS, please refer to the PencilBlue website.


Of course you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert Linux admins to setup this for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

Leave a Comment