How to Install Croogo CMS on Ubuntu 18.04 LTS

Croogo is a free, open source Content Management System (CMS) written in PHP. It is powered by CakePHP MVC framework. Croogo CMS source code is hosted on Github. In this tutorial we will walk you through the Croogo CMS installation process on a fresh Ubuntu 18.04 LTS server.

Requirements

  • PHP 5.6 or higher
  • MySQL 5.7 or higher
  • Apache with mod_rewrite or Nginx

Prerequisites

  • A server running Ubuntu 18.04
  • A non-root user with sudo privileges.

Initial steps

Check the Ubuntu version:

lsb_release -ds
# Ubuntu 18.04 LTS

Set up the timezone:

timedatectl list-timezones
sudo timedatectl set-timezone 'Region/City'

Update your operating system’s packages:

sudo apt update && sudo apt upgrade -y

Install vim, git and socat packages:

sudo apt install -y vim git socat

Step 1 - Install PHP

Install PHP and required PHP extensions:

sudo apt install -y php7.2 php7.2-cli php7.2-fpm php7.2-common php7.2-xml php7.2-intl php7.2-mbstring php7.2-mysql php7.2-pgsql php7.2-sqlite3 php7.2-curl php7.2-xmlrpc php7.2-zip php7.2-gd

Check PHP version:

php --version
# PHP 7.2.7-0ubuntu0.18.04.2 (cli) (built: Jul  4 2018 16:55:24) ( NTS )

Run

sudo vim /etc/php/7.2/fpm/php.ini

and setup the following directives:

memory_limit = 256M
upload_max_filesize = 100M
max_execution_time = 360
date.timezone = Region/City

After the change restart PHP-FPM service:

sudo systemctl restart php7.2-fpm.service

Step 2 - Install MySQL and create a database for Croogo

Croogo supports MySQL/MariaDB, PostgreSQL and SQLite3 databases. In this tutorial, we will use MySQL as database server.

Install MySQL database server:

sudo apt install -y mysql-server

Check MySQL version:

mysql --version
# mysql  Ver 14.14 Distrib 5.7.23, for Linux (x86_64) using  EditLine wrapper

Run mysql_secure installation script to improve MySQL security and set the password for MySQL root user:

sudo mysql_secure_installation

Answer each of the questions:

Would you like to setup VALIDATE PASSWORD plugin? N
New password: your_secure_password
Re-enter new password: your_secure_password
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y

Connect to MySQL shell as the root user:

sudo mysql -u root -p
# Enter password

Create an empty MySQL database with utf8mb4 charset and utf8m4_unicode_ci collation and user for Croogo and remember the credentials:

mysql> CREATE DATABASE dbname CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
mysql> GRANT ALL ON dbname.* TO 'username' IDENTIFIED BY 'password';
mysql> FLUSH PRIVILEGES;

Exit from MySQL:

mysql> exit

Replace dbname, username and password with your own names.

Step 3 - Install Acme.sh client and obtain Let's Encrypt certificate (optional)

Securing your website with HTTPS is not necessary, but it is a good practice to secure your site traffic. In order to obtain SSL certificate from Let's Encrypt we will use Acme.sh client. Acme.sh is a pure unix shell software for obtaining SSL certificates from Let's Encrypt with zero dependencies. 

Download and install Acme.sh:

sudo mkdir /etc/letsencrypt
git clone https://github.com/Neilpang/acme.sh.git
cd acme.sh
sudo ./acme.sh --install --home /etc/letsencrypt --accountemail [email protected]
cd ~

Check Acme.sh version:

/etc/letsencrypt/acme.sh --version
# v2.8.0

Obtain RSA and ECC/ECDSA certificates for your domain/hostname:

# RSA 2048
sudo /etc/letsencrypt/acme.sh --issue --standalone --home /etc/letsencrypt -d example.com --ocsp-must-staple --keylength 2048
# ECDSA
sudo /etc/letsencrypt/acme.sh --issue --standalone --home /etc/letsencrypt -d example.com --ocsp-must-staple --keylength ec-256

After running the above commands, your certificates and keys will be in:

  • For RSA: /etc/letsencrypt/example.com directory.
  • For ECC/ECDSA: /etc/letsencrypt/example.com_ecc directory.

Step 4 - Install and configure Nginx

Croogo can work fine with many web servers. In this tutorial, we selected Nginx. 

Install Nginx:

sudo apt install -y nginx

Check Nginx version:

sudo nginx -v
# nginx version: nginx/1.14.0 (Ubuntu)

Configure Nginx for Croogo by running:

sudo vim /etc/nginx/sites-available/croogo.conf

And populate the file with the following configuration:

server {

  listen 80;
  listen [::]:80;
  listen 443 ssl;
  listen [::]:443 ssl;

  server_name example.com;

  root /var/www/croogo/webroot;

  index index.php;

  ssl_certificate /etc/letsencrypt/example.com/fullchain.cer;
  ssl_certificate_key /etc/letsencrypt/example.com/example.com.key;
  ssl_certificate /etc/letsencrypt/example.com_ecc/fullchain.cer;
  ssl_certificate_key /etc/letsencrypt/example.com_ecc/example.com.key;

  location / {
    try_files $uri /index.php$is_args$args;
  }

  location ~ \.php$ {
    try_files $uri =404;
    include fastcgi_params;
    fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_index index.php;
    fastcgi_keep_conn on;
  }

}

Activate the new croogo.conf configuration by linking the file to the sites-enabled directory:

sudo ln -s /etc/nginx/sites-available/croogo.conf /etc/nginx/sites-enabled/

Test NGINX configuration:

sudo nginx -t

Reload Nginx:

sudo systemctl reload nginx.service

Step 5 - Install Composer

Install Composer, the PHP dependency manager globally:

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"

php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"

php composer-setup.php

php -r "unlink('composer-setup.php');"

sudo mv composer.phar /usr/local/bin/composer

Check Composer version:

composer --version
# Composer version 1.7.2 2018-08-16 16:57:12

Step 6 - Install Croogo

Create a document root directory where Croogo should reside in:

sudo mkdir -p /var/www/croogo

Navigate to the document root directory:

cd /var/www/croogo

Change ownership of the /var/www/croogo directory to johndoe.

sudo chown -R johndoe:johndoe /var/www/croogo

Install unzip package:

sudo apt install -y unzip

Download the latest release of Croogo CMS by utilizing Composer:

composer create-project croogo/app .
composer install

Edit database settings in config/app.php file by running:

vim config/app.php

Edit the following settings according to your chosen names:

'username' => 'your_db_username',
'password' => 'your_db_password',
'database' => 'your_db_name',
'encoding' => 'utf8mb4'

Change the above settings in both, default and test sections.

Change ownership of the /var/www/croogo directory to www-data:

sudo chown -R www-data:www-data /var/www/croogo

Open your site in a web browser and follow the instructions on the screen to finish Croogo installation.

Step 7 - Complete the Croogo setup

Open your site in a web browser. If all requirements are fulfilled initiate the installation by pressing "Start installation" button:

Start the installation

Enter your database settings:

Database settings

Create admin user account:

Create admin account

Complete the setup:

Croogo installation successful

To access Croogo admin append /admin to your site URL/IP address.

Share this page:

0 Comment(s)