Overview
- Requirements
- Automate Setup Cachet Process
- Manual process
- Install avaibale updates
- Install required repository
- Install required packages
- Setup MySQL
- Install composer
- Clone cachet repository
- Setup permission
- Setup composer
- Database migration
- Setup NGINX configuration
- Restart NGINX and PHP-FPM services
- Start NGINX and PHP-FPM After Reboot/Restart
- Configure Cachet
Requirements
- CentOS 7
- Knowledge of command line
Automate Setup Cachet Process
[mitesh@status.example.com ~]$ wget -c https://goo.gl/1IjimY -O status-page.sh
[mitesh@status.example.com ~]$ sudo bash status-page.sh http://status.example.com
The installation may take a little time, so grab a cup of coffee and relax.
Manual process
Install avaibale updates
[mitesh@status.example.com ~]$ yum -y update
Install required repository
[mitesh@status.example.com ~]$ yum -y install epel-release http://rpms.famillecollet.com/enterprise/remi-release-7.rpm http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
Install required packages
[mitesh@status.example.com ~]$ yum --enablerepo=remi,remi-php56 install nginx php-fpm php-common php-mcrypt php-mbstring php-apcu php-xml php-pdo php-intl php-mysql php-cli php-gd openssl mysql-community-server vim curl git
Setup MySQL
# Restart MySQL
[mitesh@status.example.com ~]$ sudo service mysql restart
# Chnage MySQL root password
[mitesh@status.example.com ~]$ sudo mysqladmin -u root password ROOT_PASSWORD
# Store MySQL root password
[mitesh@status.example.com ~]$ echo -e "[client]\nuser=root\npassword=ROOT_PASSWORD" > ~/.my.cnf
# Create cachet database
[mitesh@status.example.com ~]$ mysql -e "create database cachet"
# Create cachet user
[mitesh@status.example.com ~]$ mysql -e "create user 'cachet'@'localhost' identified by 'CACHET_USER_PASSWORD'"
[mitesh@status.example.com ~]$ mysql -e "grant all privileges on cachet.* to 'cachet'@'localhost'"
[mitesh@status.example.com ~]$ mysql -e "flush privileges"
Install composer
[mitesh@status.example.com ~]$ curl -sS https://getcomposer.org/installer | php -- --install-dir=/bin --filename=composer
Clone cachet repository
[mitesh@status.example.com ~]$ mkdir /var/www && cd /var/www
[mitesh@status.example.com /var/www]$ git clone https://github.com/cachethq/Cachet.git
[mitesh@status.example.com /var/www/Cachet]$ cd Cachet && cp -v .env.example .env
- Open
.env
file and update it as shown below
[mitesh@status.example.com /var/www/Cachet]$ cat .env
APP_ENV=local
APP_DEBUG=false
APP_URL=http://status.example.com
APP_KEY=UyIXoUsiAzvWrnfZwp1DAC50SQHuH5b2
DB_DRIVER=mysql
DB_HOST=127.0.0.1
DB_DATABASE=cachet
DB_USERNAME=cachet
DB_PASSWORD=CACHET_USER_PASSWORD
CACHE_DRIVER=apc
SESSION_DRIVER=apc
QUEUE_DRIVER=database
MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
Setup permission
# php-fpm running as apache user
[mitesh@status.example.com /var/www/Cachet]$ chown -R apache:apache /var/www/Cachet/
Setup composer
[mitesh@status.example.com /var/www/Cachet]$ composer install --no-dev -o
Database migration
[mitesh@status.example.com /var/www/Cachet]$ php artisan migrate
Setup NGINX configuration
[mitesh@status.example.com /var/www/Cachet]$ cat /etc/nginx/conf.d/cachet.conf
server {
listen 80;
server_name status.example.com;
root /var/www/Cachet/public;
index index.php;
location / {
try_files $uri /index.php$is_args$args;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
fastcgi_keep_conn on;
}
}
Restart NGINX and PHP-FPM services
[mitesh@status.example.com ~]$ sudo systemctl restart nginx && sudo systemctl restart php-fpm
Start NGINX and PHP-FPM After Reboot/Restart
[mitesh@status.example.com ~]$ sudo systemctl is-enabled nginx
disabled
[mitesh@status.example.com ~]$ sudo systemctl is-enabled php-fpm
disabled
[mitesh@status.example.com ~]$ sudo systemctl enable nginx
ln -s '/usr/lib/systemd/system/nginx.service' '/etc/systemd/system/multi-user.target.wants/nginx.service'
[mitesh@status.example.com ~]$ sudo systemctl enable php-fpm
ln -s '/usr/lib/systemd/system/php-fpm.service' '/etc/systemd/system/multi-user.target.wants/php-fpm.service'
Configure Cachet
- Once installation done open http://status.example.com
- Now setup CachetHQ as shown in the images below.