How to Install ExpressionEngine CMS on Ubuntu 18.04 LTS

Updated on November 21, 2023
How to Install ExpressionEngine CMS on Ubuntu 18.04 LTS header image

ExpressionEngine is a mature, flexible, secure and free open-source content management system (CMS) written in PHP. Its source code is hosted on Github. With ExpressionEngine, you can build full-featured websites, create a web app or serve content to mobile applications. All without requiring complex programming skills. This guide will walk you through the ExpressionEngine installation process on a fresh Ubuntu 18.04 LTS Vultr instance using PHP, MySQL as a database, and Nginx as a web server.

Requirements

ExpressionEngine requires a web server running PHP and MySQL. The recommend software stack and versions are:

  • PHP version 7.0 or greater, running with PHP-FPM and with the following PHP extensions:
  • gd
  • fileinfo
  • intl
  • mbstring
  • MySQL version 5.6 or greater or Percona version 5.6 or greater. This tutorial will use MySQL.
  • A web server like Nginx or Apache. This guide will 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 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-gd php7.2-intl php7.2-mysql

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.10-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies

Install MySQL

Install MySQL.

sudo apt install -y mysql-server

Check the version.

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

Run the mysql_secure_installation script to improve the security of your MySQL installation.

sudo mysql_secure_installation

Log into MySQL as the root user.

sudo mysql -u root -p
# Enter password:

Create a new MySQL database and database user, and remember the credentials.

mysql> CREATE DATABASE dbname;
mysql> GRANT ALL ON dbname.* TO 'username' IDENTIFIED BY 'password';
mysql> FLUSH PRIVILEGES;
mysql> quit

NOTE: Replace dbname and username with appropriate names for your setup. Replace password with a strong password.

Install Nginx

Install Nginx.

sudo apt install -y nginx

Check the version.

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

Configure Nginx for ExpressionEngine. Run sudo vim /etc/nginx/sites-available/expressionengine.conf and populate the file with the following configuration.

server {

  listen [::]:80;
  listen 80;
  
  server_name example.com;
  root /var/www/expressionengine;
  
  index index.php;
  
  location / {
    index index.php;
    try_files $uri $uri/ @ee;
  }
  
  location @ee {
    rewrite ^(.*) /index.php?$1 last;
  }
  
  location ~* \.php$ {
    fastcgi_pass unix:/run/php/php7.2-fpm.sock;
    include fastcgi_params;
    fastcgi_index index.php5;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  }

}

Save the file and exit with Colon+W+Q.

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

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

Test the configuration.

sudo nginx -t

Reload Nginx.

sudo systemctl reload nginx.service

Install ExpressionEngine

Create a document root directory.

sudo mkdir -p /var/www/expressionengine

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

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

Navigate to the document root folder.

cd /var/www/expressionengine

Download the latest release of ExpressionEngine and unzip the files to a folder on your server.

wget -O ee.zip --referer https://expressionengine.com/ 'https://expressionengine.com/?ACT=243'
unzip ee.zip
rm ee.zip

Change ownership of the /var/www/expressionengine directory to www-data.

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

Point your browser to the URL of the admin.php file you uploaded. For example: http://example.com/admin.php. Follow the on-screen instructions to install ExpressionEngine. Once the installation wizard is finished, you should rename or remove the system/ee/installer/ directory from your server.