Install CachetHQ on Debian 7 VPS

install-cachethq-on-debian-7-vpsIn this tutorial we’ll see how to install CachetHQ on a Debian 7 (Wheezy) VPS with MariaDB, PHP-FPM and Nginx. CachetHQ makes it simple to create a status page for your application, service or network and it’s based on Laravel 4.2 framework. This guide should work on other Linux VPS systems as well but was tested and written for Debian 7 VPS.

Login to your VPS via SSH

ssh user@myVPS

Update the system and install necessary packages

user@myVPS:~# sudo apt-get update && sudo apt-get -y upgrade
user@myVPS:~# sudo apt-get install python-software-properties git curl openssl vim build-essential

Install MariaDB 10.0

user@myVPS:~# sudo apt-key adv --recv-keys --keyserver 0xcbcb082a1bb943db
user@myVPS:~# sudo add-apt-repository 'deb wheezy main'
user@myVPS:~# sudo apt-get update
user@myVPS:~# sudo apt-get install mariadb-server
When installation is complete, run the following command to secure your installation:

Next, we need to create a database for our CachetHQ instance.

mysql -uroot -p
MariaDB [(none)]> CREATE DATABASE cachet;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON cachet.* TO 'cachetuser'@'localhost' IDENTIFIED BY 'cachetuser_passwd';
MariaDB [(none)]> \q

Install and configure PHP and Nginx

The latest version of Nginx 1.6.2 and PHP 5.6 are 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@myVPS:~# sudo vim /etc/apt/sources.list
deb wheezy all
deb wheezy-php56 all

Next, fetch and install the GnuPG key:

user@myVPS:~# wget -qO - | sudo apt-key add -

Update the system and install Nginx, PHP and all necessary extensions:

user@myVPS:~# sudo apt-get update
user@myVPS:~# sudo apt-get install nginx php5-fpm php5-cli php5-mbstring php5-mcrypt php5-apcu

Install Composer

Composer is a dependency manager for PHP with which you can install packages. Composer will pull in all the required libraries and dependencies you need for your project.

user@myVPS:~# curl -sS | php
user@myVPS:~# sudo mv composer.phar /usr/local/bin/composer

Install Node Gulp and Bower

user@myVPS:~# sudo curl -sL | bash -
user@myVPS:~# apt-get install -y nodejs
user@myVPS:~# npm install -g bower
user@myVPS:~# npm install -g gulp

Install CachetHQ

Create a root directory for your application.

user@myVPS:~# mkdir -p ~/your_cachet_site

Clone the project repository from GitHub:

user@myVPS:~# git clone ~/your_cachet_site
user@myVPS:~# cd  ~/your_cachet_site

Create a new production environment file:

user@myVPS:~# vim .env.php
return [
    'DB_DRIVER'   => 'mysql',
    'DB_HOST'     => 'localhost',
    'DB_DATABASE' => 'cachet',
    'DB_USERNAME' => 'cachetuser',
    'DB_PASSWORD' => 'cachetuser_passwd',

Install all dependencies:

user@myVPS:~# export ENV=production
user@myVPS:~# composer install --no-dev -o

Run database migrations and seed the database with sample data:

user@myVPS:~# php artisan migrate
user@myVPS:~# php artisan db:seed

Build assets:

user@myVPS:~# npm install
user@myVPS:~# bower install
user@myVPS:~# gulp       

Configure Nginx and PHP

Create a new PHP-FPM pool for your user:

user@myVPS:~# sudo nano /etc/php5/fpm/pool.d/your_user.conf
user = your_user  
group = your_user  
listen = /var/run/php5-fpm-your_user.sock  
listen.owner = your_user = your_user  
listen.mode = 0666  
pm = ondemand  
pm.max_children = 5  
pm.process_idle_timeout = 10s;  
pm.max_requests = 200  
chdir = /  

Do not forget to change your_user with your username.

Restart PHP-FPM

user@myVPS:~# sudo service php5-fpm restart

Generate ssl certificate:

user@myVPS:~# sudo mkdir -p /etc/nginx/ssl
user@myVPS:~# cd /etc/nginx/ssl
user@myVPS:~# sudo openssl genrsa -des3 -passout pass:x -out cachet.pass.key 2048
user@myVPS:~# sudo openssl rsa -passin pass:x -in cachet.pass.key -out cachet.key
user@myVPS:~# sudo rm cachet.pass.key
user@myVPS:~# sudo openssl req -new -key cachet.key -out cachet.csr
user@myVPS:~# sudo openssl x509 -req -days 365 -in cachet.csr -signkey cachet.key -out cachet.crt

Next, create a new Nginx server block:

user@myVPS:~# sudo vim /etc/nginx/sites-available/your_cachet_site
server {
    listen      443 default;
    server_name your_cachet_site;

    ssl on;
    ssl_certificate     /etc/nginx/ssl/cachet.crt;
    ssl_certificate_key /etc/nginx/ssl/cachet.key;
    ssl_session_timeout 5m;

    ssl_ciphers               'AES128+EECDH:AES128+EDH:!aNULL';
    ssl_protocols              TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;

    root /home/your_user/your_cachet_site/public;

    index index.html index.htm index.php;

    charset utf-8;

    location / {
        try_files $uri $uri/ /index.php?$query_string;

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    access_log  /var/log/nginx/cachet.access.log;
    error_log   /var/log/nginx/cachet.error.log;

    sendfile off;

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm-your_user.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_intercept_errors off;
        fastcgi_buffer_size 16k;
        fastcgi_buffers 4 16k;
        fastcgi_param ENV "production";

    location ~ /\.ht {
        deny all;

server {
    listen      80;
    server_name your_cachet_site;

    add_header Strict-Transport-Security max-age=2592000;
    rewrite ^ https://$server_name$request_uri? permanent;

Do not forget to change your_user with your username.

Activate the server block by creating a symbolic link and restart nginx:

user@myVPS:~# sudo ln -s /etc/nginx/sites-available/your_cachet_site /etc/nginx/sites-enabled/your_cachet_site
user@myVPS:~# sudo /etc/init.d/nginx restart

That’s it. You have successfully installed CachetHQ on your Debian Wheezy VPS. For more information about CachetHQ ,please refer to the CachetHQ 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

To prove you are human please solve the following *