How to Install Automad CMS on CentOS 7

Published on: Fri, Sep 13, 2019 at 11:29 am EST
CMS CentOS Linux Guides Server Apps

Automad is an open source file-based content management system (CMS) and template engine written in PHP. The Automad source code is hosted on Bitbucket. This guide will show you how to install Automad CMS on a CentOS 7 Vultr instance.

Requirements

  • PHP version 5.4 or higher.
  • Web server software. In this guide, we use Nginx.

Before you begin

Check the CentOS version.

cat /etc/centos-release
# CentOS Linux release 7.6.1810 (Core)

Create a new non-root user account with sudo access and switch to it.

useradd -c "John Doe" johndoe && passwd johndoe
usermod -aG wheel johndoe
su - johndoe

NOTE: Replace johndoe with your username.

Set up the timezone.

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

Ensure that your system is up to date.

sudo yum check-upgrade || sudo yum upgrade -y

Install the needed packages.

sudo yum install -y socat git vim unzip epel-release

Disable SELinux and Firewall.

sudo setenforce 0 ; sudo systemctl stop firewalld ; sudo systemctl disable firewalld

Install PHP

Setup the Webtatic YUM repo.

sudo rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

Install PHP, as well as the necessary PHP extensions.

sudo yum install -y php72w php72w-cli php72w-fpm php72w-common php72w-mbstring php72w-xmlrpc php72w-soap php72w-gd php72w-xml php72w-curl php72w-zip php72w-json

Check the version.

php --version

# PHP 7.2.17 (cli) (built: May 13 2019 18:03:04) ( NTS )
# Copyright (c) 1997-2018 The PHP Group
# Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

Start and enable PHP-FPM service.

sudo systemctl start php-fpm.service
sudo systemctl enable php-fpm.service

Install Nginx

Install Nginx.

sudo yum install -y nginx

Check the version.

nginx -v
# nginx version: nginx/1.12.2

Start and enable Nginx.

sudo systemctl start nginx.service
sudo systemctl enable nginx.service

Run sudo vim /etc/nginx/conf.d/automad.conf and populate the file with the following configuration.

server {

  listen 80;

  server_name example.com;

  root /var/www/automad;

  index index.php index.html;

  client_max_body_size 100M;

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

  location ~ \.php$ {
    fastcgi_index index.php;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
  }

}

Test the configuration.

sudo nginx -t

Reload Nginx.

sudo systemctl reload nginx.service

Install Automad

Create a document root directory.

sudo mkdir -p /var/www/automad

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

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

Navigate to the document root.

cd /var/www/automad

Using curl download the latest release of Automad CMS. Don't forget to bump up the version numbers if there is a newer release.

curl -O -J -L https://automad.org/download

Uncompress the zip archive.

unzip marcantondahmen-automad-6fff2a0456dc.zip

Move all Automad files to the document root and remove zip archive.

mv marcantondahmen-automad-6fff2a0456dc/* . && mv marcantondahmen-automad-6fff2a0456dc/.* .
rm marcantondahmen-automad-6fff2a0456dc.zip
rmdir marcantondahmen-automad-6fff2a0456dc

Change ownership of the /var/www/automad directory to nginx.

sudo chown -R nginx:nginx /var/www/automad

Run sudo vim /etc/php-fpm.d/www.conf and set the user and group to nginx. Initially, they are set to apache.

sudo vim /etc/php-fpm.d/www.conf
# user = nginx
# group = nginx

Restart the PHP-FPM service.

sudo systemctl restart php-fpm.service

As the last step, create a user account to use the browser-based user interface called the Dashboard. Therefore navigate to https://yoursite.com/dashboard and follow the instructions.

Want to contribute ?

You could earn up to $300 by adding new articles