How To Install CachetHQ On a CentOS 7 VPS or Dedicated Server

How To Install CachetHQ On a CentOS 7 VPS or Dedicated Server

Introduction

[openingText]Cachet is a beautifully crafted, open-source status page system that helps system administrators communicate system outages and downtimes to shareholders, teams, and clients. It’s a powerful application that provides a dashboard where users can easily measure instances such as error rates, uptime, or anything random. The solution is highly responsive and works seamlessly on any system.[/openingText]

This tutorial will show you how to install Cachet on your CentOS 7 server.

Ready? Let’s get started!

Before You Begin

For this tutorial to work flawlessly, you require the following:

Step 1 –
[stepName]Installing The LAMP Stack[/stepName]

[step]

[howToDirection]

Installing Apache.

The first step, when installing Cachet on CentOS 7 is to install the LAMP stack. But first, run the command below to update your system’s package index:

sudo yum -y update

[/howToDirection]

[howToDirection]

Next, install the Apache web server:

sudo yum install httpd

[/howToDirection]

[howToDirection]

Once Apache is installed, run the command below to start the service and enable it to start at boot.

sudo systemctl start httpd.service
sudo systemctl enable httpd.service

[/howToDirection]

[howToDirection]

Installing MariaDB.

Now, it’s time to install the database server:

sudo yum install mariadb-server mariadb

[/howToDirection]

[howToDirection]

When the MariaDB is installed, issue the command below to start it:

sudo systemctl start mariadb

[/howToDirection]

[howToDirection]

Installing PHP 7.2.

To get high performance, you need to install PHP 7.2 which is not provided in the YUM repository. For this reason, we need to install it from a third party repository:

First, run the command below to enable EPEL:

sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

[/howToDirection]

[howToDirection]

Then install the yum-utils.

sudo yum install yum-utils

[/howToDirection]

[howToDirection]

Next, run the command below to enable Remi RPM repository:

sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
sudo yum-config-manager --enable remi-php72

[/howToDirection]

[howToDirection]You can now issue the command below to  install PHP 7.2:

sudo yum install php72 php72-php-fpm php72-php-mysqlnd php72-php-opcache php72-php-xml php72-php-xmlrpc php72-php-gd php72-php-mbstring php72-php-json

[/howToDirection]

[howToDirection]

The command above will automatically install PHP 7.2 together with the required extensions. To confirm the PHP version installed, run the command below:

sudo php72 -v

[/howToDirection]

[howToDirection]

This will give the following output:

php72 -v
PHP 7.2.10 (cli) (built: Sep 11 2018 10:09:51) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.10, Copyright (c) 1999-2018, by Zend Technologies

[/howToDirection]

That is it! The LAMP stack is installed in your CentOS 7 server. You can now proceed with the other steps.

[/step]

Step 2 –
[stepName]Installing Memcached[/stepName]

[step]

[howToDirection]

You need an application to cache your resources and Memcached in one of the best caching applications. To install Memcached, run the command below:

sudo yum -y install memcached

[/howToDirection]

[howToDirection]

Next, execute the commands below to start Memcached and activate it to launch at boot:

sudo systemctl enable memcached
sudo systemctl start memcached

[/howToDirection]

[/step]

Step 3 –
[stepName]Setting The Time Zone[/stepName]

[step]

[howToDirection]

Cachet works seamlessly when your system time is in sync. For this reason, you must update your global time zone for the database server, to do so, run the command below to open the database configuration file:

sudo nano /etc/my.cnf

[/howToDirection]

[howToDirection]

Add the line below, immediately after the last line of this file:

default-time-zone='+05:30'

Note: Remember to change the time to match your timezone.

[/howToDirection]

[/step]

Step 4 –
[stepName]Create A Database For Cachet[/stepName]

[step]

[howToDirection]

Before you create a new database for Cache, run the command below to secure MariaDB:

sudo mysql_secure_installation

[/howToDirection]

[howToDirection]You will be prompted to enter your root password. Since you have just implemented MariaDB and no password has been set yet, press ENTER to continue. Create a strong password for the database and respond to all the other questions with Y.[/howToDirection]

[howToDirection]

Once everything is set, run the command below to log in to the MariaDB command line:

sudo mysql -u root -p

[/howToDirection]

[howToDirection]Type the password you created above and hit ENTER to continue. When you access the MariaDB shell, issue the command below to fashion a new database called cachet_data.[/howToDirection]

[howToDirection]

MariaDB [(none)]>

CREATE DATABASE cachet_data;

[/howToDirection]

[howToDirection]

Next, create a user called cachet_user

MariaDB [(none)]>

CREATE USER 'cachet_user'@'localhost' IDENTIFIED BY 'StrongPassword';

[/howToDirection]

[howToDirection]

Lastly, run the command below to grant the user all privileges:

MariaDB [(none)]>

GRANT ALL PRIVILEGESON cachet_data.* TO 'cachet_user'@'localhost';

[/howToDirection]

[howToDirection]

Issue the command below to implement the changes:

MariaDB [(none)]>

FLUSH PRIVILEGES;

[/howToDirection]

[/step]

Step 5 –
[stepName]Installing Cachet[/stepName]

[step]

[howToDirection]

By now everything is set and it should be a breeze to install Cachet. But before you install Cachet, run the command below to install Composer; PHP’s dependency manager:

curl -sS https://getcomposer.org/installer | php mv composer.phar /usr/bin/composer

[/howToDirection]

[howToDirection]

Change to Apache’s webroot directory and download Cachet;

cd /var/www git clone https://github.com/cachethq/Cachet.git cachet

[/howToDirection]

[howToDirection]

Once the download is done, navigate to the new Cachet directory and check the releases:

cd cachet git tag-l

[/howToDirection]

[howToDirection]

This will give you the following output:

v0.1.0-alpha
v1.0.0
v1.1.0
...
v2.3.10
v2.3.11

[/howToDirection]

[howToDirection]

Run the command below to confirm the latest releases:

git checkout v2.3.11

[/howToDirection]

[howToDirection]

Then copy the configuration for the example environment:

cp .env.example .env

[/howToDirection]

[howToDirection]

Open the env file

sudo nano .env

[/howToDirection]

[howToDirection]

Update the database settings to match those set when configuring the Cachet databases and assign the database port 3306:

DB_DATABASE=cachet_data
DB_USERNAME=cachet_user
DB_PASSWORD=StrongPassword
DB_PORT=3306

[/howToDirection]

[howToDirection]

Next, execute the command below to install the much-needed Composer dependencies:

sudo composer install --no-dev -o

[/howToDirection]

[howToDirection]

Then generate an APP_KEY for encryption:

sudo php artisan key:generate

[/howToDirection]

[howToDirection]

Once you generate the key, launch Cachet installer:

sudo php artisan app:install

[/howToDirection]

[howToDirection]

Now, run the command below to generate a new virtualhost for web application:

sudo nano /etc/httpd/conf.d/status.yourdomain.com.conf

[/howToDirection]

[howToDirection]

Once this file opens, add the content below:

<VirtualHost *:80>
    ServerAdmin me@liptanbiswas.com
    DocumentRoot"/var/www/cachet/public"
    ServerName status.yourdomain.com
    ServerAlias www.status.yourdomain.com
    <Directory "/var/www/cachet/public">
        Options Indexes FollowSymLinks
        AllowOverrideAll
        Order allow,deny
        Allow from all
        Requireall granted
    </Directory>
    ErrorLog"/var/log/httpd/status.yourdomain.com-error_log"
    CustomLog"/var/log/httpd/status.yourdomain.com-access_log" combined
</VirtualHost>

Note: Remember to amend the line status.yourdomain.com with your authentic domain.

[/howToDirection]

[howToDirection]

Save the changes and exit the nano editor, then execute the command below to restart Apache:

sudo systemctl restart httpd

[/howToDirection]

[howToDirection]

Next, modify the ownership:

sudo chown -R apache:apache /var/www/cachet/public

[/howToDirection]

[howToDirection]

Now, run the command below to permit HTTP traffic via port 80:

sudo firewall-cmd --zone=public --permanent --add-service=http 
sudo firewall-cmd --reload

[/howToDirection]

[howToDirection]

Finally, change the SELinux settings.

To disable SELinux temporarily without having to restart your CentOS 7 server, execute the command below:

sudo setenforce 0

[/howToDirection]

[howToDirection]

Alternatively, to disable the utility permanently, open the SELinux configuration files

sudo nano /etc/selinux/config

[/howToDirection]

[howToDirection]

Replace “enforcing” in the line SELINUX=enforcing, with “disabled” to get:

SELINUX=disabled

[/howToDirection]

[/step]

Conclusion

That is it! You have successfully installed Cachet on your CentOS 7 server. You can now search http://status.yourdomain.com using your favorite web browser to complete the post-installation process.

Check out these top 3 VPS services:

Hostinger
£1.19 /mo
Starting price
Visit Hostinger
Rating based on expert review
  • User Friendly
    4.9
  • Support
    4.9
  • Features
    4.8
  • Reliability
    4.7
  • Pricing
    4.5
Kamatera
£2.98 /mo
Starting price
Visit Kamatera
Rating based on expert review
  • User Friendly
    3.5
  • Support
    3.0
  • Features
    3.9
  • Reliability
    4.0
  • Pricing
    4.3
Hosting.com
£2.23 /mo
Starting price
Visit Hosting.com
Rating based on expert review
  • User Friendly
    4.5
  • Support
    4.0
  • Features
    4.5
  • Reliability
    4.8
  • Pricing
    4.0
  • Check the recommendations for the best VPS and get a suitable one.

How to Install phpMyAdmin on a CentOS 7 VPS or Dedicated Server

Learn how to setup phpMyAdmin on your CentOs 7 VPS server and manage your MySQL/
less than a minute
Max Ostryzhko
Max Ostryzhko
Senior Web Developer, HostAdvice CTO

Part Two: How to Monitor Nginx using Elastic Stack on a CentOS 7 VPS or Dedicated Server

This tutorial will explain how to use the different components of the Elastic St
less than a minute
Idan Cohen
Idan Cohen
Marketing Expert

Part One: How to Monitor Nginx using Elastic Stack on a CentOS 7 VPS or Dedicated Server

This is Part I of a two-part tutorial explaining how to use the different compon
less than a minute
Idan Cohen
Idan Cohen
Marketing Expert

How to install Litespeed Web Server on Centos 7 VPS or Dedicated Server

OpenLiteSpeed is an open source web server characterized by high-performance, li
less than a minute
Max Ostryzhko
Max Ostryzhko
Senior Web Developer, HostAdvice CTO
Click to go to the top of the page
Go To Top
HostAdvice.com provides professional web hosting reviews fully independent of any other entity. Our reviews are unbiased, honest, and apply the same evaluation standards to all those reviewed. While monetary compensation is received from a few of the companies listed on this site, compensation of services and products have no influence on the direction or conclusions of our reviews. Nor does the compensation influence our rankings for certain host companies. This compensation covers account purchasing costs, testing costs and royalties paid to reviewers.