Installing Cachet on Red Hat Enterprise Linux 7 (RHEL)

Below is my attempt at documenting the steps that I performed to successfully install Cachet on RHEL 7.  I had to use not only the official installation guide from Cachet, but several other guides provided by people who have successfully installed it on Ubuntu and Centos. Here for reference are the guides I used to install Cachet:

Install and Configure MariaDB

yum install mariadb
systemctl enable mariadb
systemctl start mariadb
#Secure the MariaDB installation and set root password
mysql_secure_installation
#Create cachet database
mysql -e "create database cachet"
#Create cachet user
mysql -e "create user 'cachet'@'localhost' identified by 'CACHET_USER_PASSWORD'"
mysql -e "grant all privileges on cachet.* to 'cachet'@'localhost'"
mysql -e "flush privileges"

Configure Additional Repositories

Enable ‘optional’ repository (rhel-7-server-optional-rpms) and the ‘extras’ repository (rhel-7-server-extras-rpms).

Do this by modifying the /etc/yum.repos.d/redhat.repo file

Look for the [rhel-7-server-optional-rpms] and [rhel-7-server-extras-rpms] sections

modify the enabled = 0 to enabled = 1 for both repositories

Install the Extra Packages for Enterprise Linux

Now install EPEL by running

yum install epel-release

Install the Remi Repository for PHP packages that are not available  with the default system repositories.

rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

Install the Cachet package dependencies

yum --enablerepo=remi,remi-php56 install php-fpm php-common php-mcrypt php-mbstring php-apcu php-xml php-pdo php-intl php-mysql php-cli php-gd git

PHP configuration

#verify installed php version(s)
rpm -qa | grep -i php
#Enable php-fpm to run at startup
systemctl enable php-fpm
#Start php-fpm
systemctl start php-fpm

By default php-fpm will listen to 127.0.0.1:9000. The listen directive “127.0.0.1:9000” will be used in the apache virtualhost config detailed below.  If you want to change this default port, modify the following file:

vi /etc/php-fpm.d/www.conf

Install Composer

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

Install Cachet

Clone the Cachet Repository

cd /var/www/
git clone https://github.com/cachethq/Cachet.git
cd Cachet/
git tag -l
git checkout v2.3.9
cp -v .env.example .env

Modify the Cachet configuration file to look like the following

[user@myserver Cachet]# cat .env
APP_ENV=local
APP_DEBUG=false
APP_URL=http://myserver.mydomain.com
APP_KEY=base64:myAPPKEY448574944755NotReal383857kdhf=

DB_DRIVER=mysql
DB_HOST=127.0.0.1
DB_DATABASE=cachet
DB_USERNAME=cachet
DB_PASSWORD=myDBpassword

CACHE_DRIVER=apc
SESSION_DRIVER=apc
QUEUE_DRIVER=database

MAIL_DRIVER=smtp
MAIL_HOST=mymailserver.mydomain.com
MAIL_PORT=25
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ADDRESS=myserver@mydomain.com

Set apache user:group permissions for Cachet

chown -R apache:apache /var/www/Cachet/

Compose the site

cd /var/www/Cachet
composer install --no-dev -o

Generate a Application Key used for encryption

php artisan key:generate

Run the installer that seeds the database

php artisan app:install

Configuring Apache

Install and configure Apache service

yum install httpd
systemctl enable httpd
systemctl start httpd

Create a virtualhost configuration file called vhost.conf within the /etc/httpd/conf.d/ directory. It should look like the following:

[user@myserver Cachet]# cat /etc/httpd/conf.d/vhost.conf
<VirtualHost *:80>
    ServerName myserver.mydomain.com
    ServerAlias myserver.mydomain.com
    DocumentRoot "/var/www/Cachet/public"
    <Directory "/var/www/Cachet/public">
        Require all granted
        Options Indexes FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
<FilesMatch \.php$>
            SetHandler "proxy:fcgi://127.0.0.1:9000"
</FilesMatch>
</VirtualHost>

Notice the <FilesMatch \.php$> directive. This was required in order to get php working within apache. Otherwise, you will get an error page when navigating to the cachet dashboard page.

I also modified the /etc/httpd/conf/httpd.conf file and included the DirectoryIndex index.php option.

<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>

Test Cachet Status Page

navigate to the following address in your browser: http://yourcachetserver.yourdomain.com

You should be redirected to the /setup page

Congratulations!!

Other useful links

EPEL

Install PHP and Apache on Red Hat

 

Advertisements

About Parker Jardine

Manager of Systems Administration in the Information Technology Higher Education space. I enjoy biking, climbing, hockey, camping, mountaineering, hunting, paragliding, and just being outdoors. You can read my Make Magazine project articles about a diy solar panel and solar systems design in volumes 12 and 14.
This entry was posted in Cachet, Linux, PHP, RHEL7. Bookmark the permalink.

One Response to Installing Cachet on Red Hat Enterprise Linux 7 (RHEL)

  1. I always spent my half an hour to read this blog’s articles or reviews every day along with a cup of coffee.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s