Learn How To Install Automad CMS on Ubuntu 18.04

March 7, 2019

Table of Contents

If you are using a different system, please check our other tutorials.

Automad is an open source file-based content management system (CMS) and template engine written in PHP. Automad’s source code is hosted on Bitbucket. This guide will show you how to install Automad CMS on Ubuntu 18.04 IT Web Services instance.

Requirements

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

Before you begin

Check the Ubuntu version.

lsb_release -ds
# Ubuntu 18.04.2 LTS

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

adduser johndoe --gecos "John Doe"
usermod -aG sudo johndoe
su - johndoe

NOTE: Replace johndoe with your username.

Set up the timezone.

sudo dpkg-reconfigure tzdata

Ensure that your system is up to date.

sudo apt update && sudo apt upgrade -y

Install the needed packages.

sudo apt install -y zip unzip curl wget git

Install PHP

Install PHP, as well as the necessary PHP extensions.

sudo apt install -y php7.2 php7.2-cli php7.2-fpm php7.2-common php7.2-mbstring php7.2-xmlrpc php7.2-soap php7.2-gd php7.2-xml php7.2-curl php7.2-zip

Check the version.

php --version
# PHP 7.2.19-0ubuntu0.18.04.1 (cli) (built: Jun  4 2019 14:48:12) ( NTS )
# Copyright (c) 1997-2018 The PHP Group
# Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
#     with Zend OPcache v7.2.19-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies

Install Nginx

Install Nginx.

sudo apt install -y nginx

Check the version.

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

Run sudo vim /etc/nginx/sites-available/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 unix:/var/run/php/php7.2-fpm.sock;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
  }
}

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

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

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 www-data.

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

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.

Need help?

Do you need help setting up this on your own service?
Please contact us and we’ll provide you the best possible quote!