Learn How To Install Automad CMS on Debian 9

July 30, 2019

Table of Contents

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

Introduction

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

Requirements

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

Before you begin

Check the Debian version.

lsb_release -ds
# Debian GNU/Linux 9.9 (stretch)

Ensure that your system is up to date.

apt update && apt upgrade -y

Install the necessary packages.

apt install -y git unzip curl sudo socat git build-essential

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

Install PHP

Install PHP, as well as the necessary PHP extensions.

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

Check the version.

php --version
# PHP 7.0.33-0+deb9u3 (cli) (built: Mar  8 2019 10:01:24) ( NTS )
# Copyright (c) 1997-2017 The PHP Group
# Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
#     with Zend OPcache v7.0.33-0+deb9u3, Copyright (c) 1999-2017, by Zend Technologies

Install Nginx

Install Nginx.

sudo apt install -y nginx

Check the version.

sudo nginx -v
# nginx version: nginx/1.10.3

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.0-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 the 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!