How to Install CachetHQ on an Ubuntu 16.04 VPS

How to Install CachetHQ on an Ubuntu 16.04 VPS

In this tutorial, we’ll show you how to install CachetHQ on an Ubuntu 16.04 VPS with MySQL and Apache2. CachetHQ makes it simple to create a status page for your application, service or network and it’s based on Laravel framework. This guide should work on other Linux VPS systems as well but was tested and written for Ubuntu 16.04 VPS.

At the time of writing this tutorial, Cachet v2.3.9 is the latest stable version available and it requires:

  • PHP 5.5.9+ or newer installed on your Linux VPS;
  • HTTP server with PHP support (eg: Apache, Nginx, Caddy)
  • Composer
  • A supported database: MySQL, PostgreSQL or SQLite


Login to your VPS via SSH

ssh [email protected]

Update the system

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

Install MariaDB 10.0

To install MariaDB, run the following command:

[user]$ sudo apt-get install -y mariadb-server

Next, we need to create a database for our Cachet installation.

[user]$ mysql -u root -p

MariaDB [(none)]> CREATE DATABASE cachet;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON cachet.* TO 'cachetuser'@'localhost' IDENTIFIED BY 'your-password';
MariaDB [(none)]> q

Do not forget to replace ‘your-password’ with a strong password.

Install Apache2 web server

[user]$ sudo apt-get install apache2

Install PHP and required PHP modules

To install the latest stable version of PHP version 7 and all necessary modules, run:

[user]$ sudo apt-get install php7.0 libapache2-mod-php7.0 php7.0-mbstring php7.0-curl php7.0-zip php7.0-gd php7.0-mysql php7.0-mcrypt curl

Enable the Apache2 rewrite module if it is not already done:

[user]$ sudo a2enmod rewrite

In order to activate the new configuration, restart the Apache web server using the following command:

[user]$ sudo service apache2 restart

Download the source code with Git

[user]$ sudo cd /var/www/html/
[user]$ sudo git clone
[user]$ sudo cd Cachet
[user]$ sudo git checkout v2.3.9

All files have to be readable by the web server, so we need to set a proper ownership

[user]$ sudo chown www-data:www-data -R /var/www/html/Cachet/

Configuring a database

Rename the .env.example file to .env using the following command:

[user]$ sudo mv .env.example .env

Open the .env file and change the following lines:

[user]$ sudo nano .env
APP_URL=http://localhost -> APP_URL=http://your-domain-name
DB_DATABASE=cachet -> DB_DATABASE=your-database-name
DB_USERNAME=homestead -> DB_USERNAME=your-database-username
DB_PASSWORD=secret -> DB_PASSWORD=your-database-password

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]$ sudo curl -sS | sudo php -- --install-dir=/usr/local/bin --filename=composer 

[user]$ sudo composer install --no-dev -o

Set the application key

Before going any further, we need to set the APP_KEY config. This is used for all encryption used in Cachet.

php artisan key:generate

Cachet comes with an installation command that will:

  • Run migrations
  • Run seeders (of which there are none)
php artisan app:install

Create a new virtual host directive in Apache. For example, create a new Apache configuration file named ‘cachet.conf’ on your virtual server:

[user]$ sudo touch /etc/apache2/sites-available/cachet.conf
[user]$ sudo ln -s /etc/apache2/sites-available/cachet.conf /etc/apache2/sites-enabled/cachet.conf
[user]$ sudo nano /etc/apache2/sites-available/cachet.conf

Then, add the following lines:

    # Or whatever you want to use
    # Make this the same as ServerName
    DocumentRoot "/var/www/html/Cachet/public"
        Require all granted 
        # Used by Apache 2.4
        Options Indexes FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all

Restart the Apache web server for the changes to take effect:

[user]$ sudo service apache2 restart

Open your favorite web browser, navigate to and if you properly configured everything the Cachet installer should be starting. You should follow the easy instructions on the install screen inserting the necessary information as requested.

That is it. The Cachet installation is now complete.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.