# Running Cachet Open Source Status Page System on Linux

## What is Cachet?

> Cachet is a beautiful and powerful open source status page system. -https://github.com/CachetHQ/Cachet

## Installation

1. Log into the Linux device
2. Run the following commands in a terminal window:
   # update software respositories
   sudo apt update
   # install available software updates
   sudo apt upgrade -y
   # install prerequisites
   sudo apt install git openssl curl wget zip composer -y
   # install Apache HTTPD and MySQL
   sudo apt install apache2 mariadb-server mariadb-client -y
   # install PHP components
   sudo apt install php7.3 libapache2-mod-php7.3 php7.3-curl php7.3-tokenizer php7.3-ldap php7.3-cli php7.3-json php7.3-gd php7.3-mbstring php7.3-mysql php7.3-xml php7.3-zip php7.3-bcmath php7.3-fpm -y
   # configure the MySQL database
   sudo su
   mysql_secure_installation
3. Press Enter to login as root
4. Type Y and press Enter to set a root password, type the password twice to confirm
5. Type Y and press Enter to remove anonymous users
6. Type Y and press Enter to disallow root login remotely
7. Type Y and press Enter to remove the test database
8. Type Y and press Enter to reload privilege tables
9. Run the following command to login into MySQL:
   mysql -u root -p
10. Authenticate with the root password set earlier
11. Run the following commands to create the Cachet database and database user
    CREATE DATABASE cachet;
    GRANT ALL ON cachet.* to 'cachet_rw'@'localhost' IDENTIFIED BY 'C@ch3t!!';
    FLUSH PRIVILEGES;
    EXIT;
    exit
12. Continue with the following commands:
    # clone cachet from github
    sudo git clone https://github.com/cachethq/Cachet.git /var/www/cachet
    # change directories to cachet
    cd /var/www/cachet
    # create a copy of the sample .env file
    sudo cp /var/www/cachet/.env.example /var/www/cachet/.env
    # edit the .env file
    sudo nano /var/www/cachet/.env
13. Edit the following environment variables as needed

    APP_ENV=production
    APP_DEBUG=false
    APP_URL=http://localhost/cachet
    APP_TIMEZONE=America/New_York
    APP_KEY=
    DEBUGBAR_ENABLED=false

    DB_DRIVER=mysql
    DB_HOST=localhost
    DB_UNIX_SOCKET=false
    DB_DATABASE=cachet
    DB_USERNAME=cache_rw
    DB_PASSWORD=C@ch3t!!
    DB_PORT=null
    DB_PREFIX=null

    CACHE_DRIVER=database
    SESSION_DRIVER=database
    QUEUE_DRIVER=database
    CACHET_EMOJI=false

    MAIL_DRIVER=smtp
    MAIL_HOST=smtp.i12bretro.local
    MAIL_PORT=25
    MAIL_USERNAME=null
    MAIL_PASSWORD=null
    MAIL_ADDRESS=null
    MAIL_NAME="Cachet"
    MAIL_ENCRYPTION=null

    REDIS_HOST=null
    REDIS_DATABASE=null
    REDIS_PORT=null

    GITHUB_TOKEN=null

14. Press CTRL+O, Enter, CTRL+X to write the changes to .env
15. Continue with the following commands:
    # set the owner of the cachet directory
    sudo chown -R www-data:www-data /var/www/cachet
    # setup composer working directory
    sudo mkdir /var/www/.composer
    sudo chown -R www-data:www-data /var/www/.composer
    # install dependencies with composer
    sudo -u www-data composer install --no-dev -o
    # generate app key, type yes to confirm generating a new key
    sudo php artisan key:generate
    # run cachet install, answer No and then Yes
    sudo php artisan cachet:install
    # create cachet apache configuration
    sudo nano /etc/apache2/sites-available/cachet.conf
16. Paste the following configuration into cachet.conf

    Alias /cachet "/var/www/cachet/public"
    <Directory /var/www/cachet/public>
    Require all granted
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
    </Directory>

17. Press CTRL+O, Enter, CTRL+X to write the changes to cachet.conf
18. Run the following command to enable the cachet site
    # enable rewrite module
    sudo a2enmod rewrite
    # enable the cachet site
    sudo a2ensite cachet
    # restart the apache2 service
    sudo systemctl restart apache2

## Cachet Web Installer

1. Open a web browser and navigate to http://DNSorIP/cachet/setup
2. The Cachet setup screen should be displayed
3. Set the Cache, Queue and Session drivers to Database
4. Optionally setup the SMTP host and email address > Click Next
5. Enter a site name, set the timezone and language > Click Next
6. Create an administrator account by entering a username, email address and password > Click Complete Setup
7. Click the Go to dashboard button
8. Login with the administator account created earlier
9. Welcome to Cachet
10. To view the status page navigate to http://DNSorIP:8000