How to Install MODX CMS on Ubuntu 18.04 LTS

MODX is a free, open source and fast content management system written in PHP language. It is specially designed for ease of use that allows web admin to create powerful and dynamic content websites. MODX comes with a graphical web-based installer, so any normal user can install and build sites of any size.

In this tutorial, we will learn how to install MODX on Ubuntu 18.04 LTS (Bionic Beaver).

Requirements

  • A server running Ubuntu 18.04.
  • A non-root user with sudo privileges.

Install LAMP Server

MODX runs on the web server, written in PHP language and uses MariaDB as the database, so you will need to install Apache, MariaDB, and PHP to your server. You can install all of them by just running the following command:

sudo apt-get install apache2 mariadb-server php7.2 libapache2-mod-php7.2 libapache2-mod-php7.2 php7.2-common php7.2-mbstring php7.2-xmlrpc php7.2-soap php7.2-gd php7.2-xml php7.2-intl php7.2-mysql php7.2-cli php7.2-mcrypt php7.2-ldap php7.2-zip php7.2-curl php7.2-sqlite3 -y

Once all the packages are installed, start Apache and MariaDB service and enable them to start on boot using the following command:

sudo systemctl start apache2
sudo systemctl enable apache2
sudo systemctl start mariadb
sudo systemctl enable mariadb

Next, you will need to make some changes in php.ini file:

sudo nano /etc/php/7.2/apache2/php.ini

Make the following changes:

file_uploads = On
allow_url_fopen = On
memory_limit = 256M
upload_max_file_size = 128M
max_execution_time = 340
max_input_vars = 1500

Save and close the file, when you are finished.

Configure MariaDB

By default, MariaDB is not secured, so you will need to secure it first. You can do this by running the following command:

sudo mysql_secure_installation

Answer all the questions as shown below:

    Enter current password for root (enter for none): Just press the Enter
    Set root password? [Y/n]: n
    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

Once MariaDB is secured, log in to MariaDB shell:

mysql -u root -p

Enter your root password, then create a database for MODX:

MariaDB [(none)]> CREATE DATABASE modxdb;

Next, create a user for MODX and grant 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;

Next, flush the privileges with the following command:

MariaDB [(none)]> FLUSH PRIVILEGES;

Finally, exit from the MariaDB shell:

MariaDB [(none)]> exit;

Install MODX

First, you will need to download the latest version of the MODX from their official website. You can download it with the following command:

wget https://modx.s3.amazonaws.com/releases/2.6.3/modx-2.6.3-pl.zip

Once the download is completed, extract the downloaded file with the following command:

unzip modx-2.6.3-pl.zip

Next, copy the extracted directory to the Apache web root directory:

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

Next, give proper permissions to the modx directory:

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

Next, you will need to create an apache virtual host directive for MODX.

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

Add the following lines:

<VirtualHost *:80>
     ServerAdmin [email protected]
     DocumentRoot /var/www/html/modx
     ServerName example.com
     ServerAlias www.example.com

     <Directory /var/www/html/modx/>
        Options +FollowSymlinks
        AllowOverride All
        Require all granted
    </Directory>

     ErrorLog ${APACHE_LOG_DIR}/modx_error.log
     CustomLog ${APACHE_LOG_DIR}/modx_access.log combined

</VirtualHost>

Save the file, when you are finished, then enable MODX virtual host file and Apache rewrite module with the following command:

sudo a2ensite modx.conf
sudo a2enmod rewrite

Finally, restart Apache service using the following command:

sudo systemctl restart apache2

Access MODX

Open your web browser and type the URL http://example.com/setup, you will be redirected to the following page:

MODX installer

Now, select your language and click on the Select button, you should see the following page:

Welcome to MODX installation program

Now, click on the Next button to start MODX installation, you should see the following page:

Install options

Now, select New Installation option and Click on the Next button, you should see the following page:

Database connection

Database connection - part 2

Now, Provide your database and admin credential, then click on the Next button, you should see the following page:

Installation summary

Now, click on the Install button to start the installation, once the installation is completed, you should see the following page:

Installation completed

Now, click on the Next button, you should see the following page:

MODX Revolution installed

Now, click on the Login button, you should see the following page:

Login to MODX Backend

Now, provide your admin login credential and click on the Login button, you should see the following page:

MODX Dashboard

Share this page:

Suggested articles

1 Comment(s)

Add comment

Comments

By: Fraglich at: 2018-07-27 22:57:53

Thanks a LOT Man!!!