How to Install Cachet on Debian 8

Updated on November 21, 2023
How to Install Cachet on Debian 8 header image

In this tutorial, you will learn how to install Cachet on Debian 8. Cachet is a powerful open source status page system.

Installation

This tutorial is going to assume you have already installed MySQL on the VPS.

Update your system:

apt-get update -y

Install these libraries:

apt-get install php5 php5-mysql libapache2-mod-php5 php5-fpm php5-cli php5-curl php5-gd git sudo apache2 -y

Then navigate to /var/www:

cd /var/www/

Clone the git repository for Cachet:

git clone https://github.com/cachethq/Cachet.git

Now navigate to the directory /var/www/Cachet:

cd Cachet

Run the following command, which will result in a list of versions:

git tag -l

v2.3.4
v2.3.5
v2.3.6
v2.3.7
v2.3.8
v2.3.9

Choose the latest version, in our case its v2.3.9:

git checkout v2.3.9

Setup

Login to MySQL:

mysql -u root -p

Once you have entered the password, Create a database called cachet:

CREATE DATABASE cachet;

Create a new user for this database, replace `RANDOM_PASSWORD' with a password of your choice:

CREATE USER 'cachet'@'localhost' IDENTIFIED BY 'RANDOM_PASSWORD';
GRANT ALL PRIVILEGES ON cachet.* TO 'cachet'@'localhost';
FLUSH PRIVILEGES;

Rename env.example to .env:

mv .env.example .env

Edit .env with your MySQL details.

Then install composer:

curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

Generate a key:

php artisan key:generate

If you run into the error:

PHP Warning:  require(/root/Cachet/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /root/Cachet/bootstrap/autoload.php on line 28
PHP Fatal error:  require(): Failed opening required '/root/Cachet/bootstrap/../vendor/autoload.php' (include_path='.:/usr/share/php:/usr/share/pear') in /root/Cachet/bootstrap/autoload.php on line 28

... then run the following command:

composer update --no-scripts

If you encounter this error:

[ErrorException]
  proc_open(): fork failed - Cannot allocate memory
  

... then run the following commands:

/bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
/sbin/mkswap /var/swap.1
/sbin/swapon /var/swap.1

Regenerate a key:

php artisan key:generate

Install Cachet:

php artisan app:install 

Enable mod_rewrite:

a2enmod rewrite
a2enmod rewrite
service apache2 restart

Navigate to /etc/apache2/sites-enabled/:

cd /etc/apache2/sites-enabled/

Create a new file to access Cachet:

mv cachet.conf

Inside of the created file copy and paste the following:

<VirtualHost *:80>
# Domain from where Cachet will be accessed
ServerName example.com

DocumentRoot "/var/www/Cachet/public"
<Directory "/var/www/Cachet/public">

    Require all granted 
    # Used by Apache 2.4
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all

</Directory>
</VirtualHost>

Replace example.com with your own domain name which you have linked with your Vultr VPS or with your Vultr Instance's IP Address.

Hit Ctrl+X and then press Enter.

Fix file permissions:

chmod -R 777 storage
rm -rf bootstrap/cache/*
chmod -R 777 bootstrap/

Conclusion

You have successfully installed Cachet on your Vultr VPS.