How To Install MODX CMS on Ubuntu 18.04 LTS

How To Install MODX CMS on Ubuntu 18.04 LTS


MODX is an open source secure and effective content management system that is based on PHP language. Since it features an easy to use interface, it allows webmasters and other users to create responsive and powerful content websites.

For those searching for a simple but reliable content management platform to manage the activities of your blogs or websites, MODX is a great option. This tutorial will take you through the process of installing MODX CMS on Ubuntu 18.04 LTS.


Before you begin, you will need the following:

  • A virtual machine running on Ubuntu 18.04
  • A non-root user with sudo privileges.

With these items in check, we are good to go.

MODX requires a web server based on PHP languages and also utilizes MariaDB database for its functioning. For this reason, you need to install MariaDB,PHP, and Apache on your system.

To install LAMP stack follow the steps below:

Step 1- Installing Apache Server

Run the command below to update your system:

$ sudo apt update

To install Apache2 on Ubuntu, run the following command:

$ sudo apt install apache2

Once Apache is installed, disable the directory listing by running the command below:

$ sudo sed -i "s/Options Indexes FollowSymLinks/Options FollowSymLinks/" /etc/apache2/apache2.conf

Next, you should start and enable Apache2 service to ensure it always starts when the server boots.

$ sudo systemctl start apache2.service
$ sudo systemctl enable apache2.service

Step 2 – Installing MariaDB Database

Akeneo requires a database server to work properly and MariaDB is a good database server to start with. Run the command below to install it.

$ sudo apt-get install mariadb-server mariadb-client

Once you have installed MariaDB, use the command below to start and enable the newly installed MariaDB service and ensure it start every time the server boots.

$ sudo systemctl start mariadb.service
$ sudo systemctl enable mariadb.service

Once you’re done, run the command below to secure the MariaDB service.

$ sudo mysql_secure_installation

You will be prompted to answer a few questions as shown below:

Enter current password for root (enter for none): Since you just installed MariaDB and no password is set, Press Enter.

Set root password? [Y/n]: Press Y
New password: Enter password
Re-enter new password: Repeat the 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

Now restart the MariaDB server

$ sudo systemctl restart mysql.service

Step 3 – Installing PHP Modules

You may not find PHP 7.1 on default repositories on Ubuntu 18.04. So, to install this service, you have to download it from third-party repositories.

To add a third party repository (Ondrej PHP repository), run the following commands:

$ sudo apt-get install software-properties-common
$ sudo add-apt-repository ppa:ondrej/php

Now, update the settings and upgrade the service to PHP 7.1.

$ sudo apt update

To install PHP 7.1 and it’s related modules, run the following commands:

$ sudo apt install php7.1 libapache2-mod-php7.1 php7.1-apcu php7.1-bcmath php7.1-common php7.1-mbstring php7.1-xmlrpc php7.1-soap php7.1-gd php7.1-xml php7.1-intl php7.1-mysql php7.1-cli php7.1-mcrypt php7.1-ldap php7.1-zip php7.1-curl

Once PHP is installed, open the default file for Apache2 PHP using the following commands:

$ sudo nano /etc/php/7.1/apache2/php.ini

Now, make the following changes by editing the lines in the file then save.

file_uploads = On
allow_url_fopen = On
memory_limit = 256M
upload_max_filesize = 100M
max_execution_time = 30
max_input_vars = 1500
date.timezone = America/Chicago

Step 2: Creating A Database for MODX CMS

After securing MariaDB, now log into MariaDB shell:

$ sudo mysql -u root -p

Create a database and a root password for MODX:

MariaDB [(none)]> CREATE DATABASE modxdb;

You also need to create a user for MODX database and grant it privileges:

MariaDB [(none)]> CREATE USER 'modx'@'localhost' IDENTIFIED BY 'password';
MariaDB [(none)]> GRANT ALL ON modxdb.* TO 'modx'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;

The next step is to flush out the privileges using the command below:


Now, save and exit the MariaDB shell:

MariaDB [(none)]> exit;

Step 3: Installing MODX

The first step here is to download the current stable version of MODX from their website. Use the command below to download it:

$ wget

After completing the download, extract the file using the command below:

$ unzip

The next step is to copy this file to the web root directory on Apache:

$ sudo cp -r modx-2.6.3-pl /var/www/html/modx

Now, grant permissions to MODX directory:

$ sudo chown -R www-data:www-data /var/www/html/modx
$ sudo chmod -R 775/var/www/html/modx

MODX needs an apache virtual host directive, we’ll execute the commands below to to create one.

$ sudo nano /etc/apache2/sites-available/modx.conf

Now, include these lines to your configuration:

<VirtualHost *:80>
     DocumentRoot /var/www/html/modx

     <Directory /var/www/html/modx/>
        Options +FollowSymlinks
        Requireall granted

     CustomLog${APACHE_LOG_DIR}/modx_access.log combined


Save and exit the file once you’re done.

Next execute the commands below to start MODX virtual host file and enable Apache rewrite module using:

$ sudo a2ensite modx.conf
$ sudo a2enmod rewrite

Once, that is done, run the command below to restart apache.

$ sudo systemctl restart apache2

Step 4: Accessing MODX

Go to your web browser then enter the URL Then follow the on-screen instructions until MODX is successfully installed.

First, select the language you want then press the Select .

How To Install MODX CMS on Ubuntu 18.04 LTS

Press the Next to initiate the installation.

How To Install MODX CMS on Ubuntu 18.04 LTS

Select New installation then press Next to proceed.

How To Install MODX CMS on Ubuntu 18.04 LTS

Now, enter the admin and database information, then click the Next.

How To Install MODX CMS on Ubuntu 18.04 LTS

How To Install MODX CMS on Ubuntu 18.04 LTS

Next, press the Install button start installing MODX on your system. The page below will appear:

How To Install MODX CMS on Ubuntu 18.04 LTS

The page below will appear. Click the Next button:

How To Install MODX CMS on Ubuntu 18.04 LTS

Then, click Login:

How To Install MODX CMS on Ubuntu 18.04 LTS

Enter the admin login details and press the Login as shown below:

How To Install MODX CMS on Ubuntu 18.04 LTS

You should see the page below to show MODX is installed successfully:

How To Install MODX CMS on Ubuntu 18.04 LTS


At this point, you should see a congratulations message to show you that you have successfully installed MODX on Ubuntu 18.04 LTS. Over to you now, try these steps and enjoy creating more powerful and dynamic websites.

Check out these top 3 Linux hosting services

£2.00 /mo
Starting price
Visit HostArmada
Rating based on expert review
  • User Friendly
  • Support
  • Features
  • Reliability
  • Pricing
£2.40 /mo
Starting price
Visit Hostinger
Rating based on expert review
  • User Friendly
  • Support
  • Features
  • Reliability
  • Pricing
£1.44 /mo
Starting price
Visit FastComet
Rating based on expert review
  • User Friendly
  • Support
  • Features
  • Reliability
  • Pricing

How To Install Akeneo PIM on Ubuntu 18.04 LTS

This brief tutorial is going to show you how to install Akeneo on Ubuntu 18.04 L
4 min read
Idan Cohen
Idan Cohen
Marketing Expert

How To Install Apache, MariaDB, and PHP (LAMP stack) in Ubuntu 18.04

This tutorial will help install Apache, MariaDB, and PHP (LAMP stack) on Ubuntu
5 min read
Arvind Singh
Arvind Singh
Hosting Expert

How To Reset A MySQL Root Password On Ubuntu 18.04?

This tutorial will help you reset your MySQL password in case you forgotten it
3 min read
David Malcom
David Malcom

How to Install OpenCart on an Ubuntu 18.04 Server or VPS with Apache, MariaDB and PHP 7

In this how-to, you'll learn how to install OpenCart, an open source shopping ca
3 min read
Angela Olaru
Angela Olaru
Senior Writer & Hosting Expert provides professional web hosting reviews fully independent of any other entity. Our reviews are unbiased, honest, and apply the same evaluation standards to all those reviewed. While monetary compensation is received from a few of the companies listed on this site, compensation of services and products have no influence on the direction or conclusions of our reviews. Nor does the compensation influence our rankings for certain host companies. This compensation covers account purchasing costs, testing costs and royalties paid to reviewers.
Click to go to the top of the page
Go To Top