MODX

How To Install MODX on Ubuntu 24.04 or Newer

Welcome to the Greenhost.cloud blog! Today, we’re diving into a step-by-step guide on installing MODX, an excellent content management system (CMS) known for its flexibility and customization capabilities, on Ubuntu 24.04 or newer. Whether you’re a developer looking to build a website or a business owner wanting to manage your content effortlessly, this tutorial will help you get started.

Prerequisites

Before we begin, ensure you have the following:

  1. A server running Ubuntu 24.04 or newer – You can use a VPS or a dedicated server.
  2. Root or sudo access – You’ll need administrative privileges to install packages.
  3. A domain name (optional) – If you plan to make your site public.
  4. A LAMP stack installed – This includes Linux, Apache, MySQL (or MariaDB), and PHP.

Step 1: Update Your System

Open a terminal and ensure your system is up to date by running the following commands:

sudo apt update
sudo apt upgrade -y

Step 2: Install Required Packages

MODX requires a few packages to run smoothly. Install them using the following command:

sudo apt install apache2 mysql-server php php-mysql libapache2-mod-php php-xml php-mbstring php-curl php-zip -y

Step 3: Configure MySQL

Next, you’ll need to create a database and a user for MODX. Log into the MySQL shell:

sudo mysql -u root -p

Once logged in, create a database and user:

CREATE DATABASE modxdb;
CREATE USER 'modxuser'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON modxdb.* TO 'modxuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Make sure to replace your_password with a strong password.

Step 4: Download MODX

Navigate to the /var/www/html directory:

cd /var/www/html

Download the latest version of MODX. You can find the latest release on the MODX download page. To download it via terminal, use:

wget https://modx.com/download/direct/modx-revolution-*.zip

Unzip the downloaded file:

sudo apt install unzip
unzip modx-revolution-*.zip

Then, rename the extracted folder for convenience:

sudo mv modx-*/ modx

Step 5: Set Permissions

After extracting MODX, set the correct permissions for the web server:

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

Step 6: Configure Apache

Create a new configuration file for MODX:

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

Add the following configuration, replacing your_domain.com with your actual domain name:

<VirtualHost *:80>
    ServerAdmin admin@your_domain.com
    DocumentRoot /var/www/html/modx
    ServerName your_domain.com
    ServerAlias www.your_domain.com

    <Directory /var/www/html/modx>
        AllowOverride All
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Enable the new site and the mod_rewrite module:

sudo a2ensite modx.conf
sudo a2enmod rewrite

Finally, restart Apache to apply the changes:

sudo systemctl restart apache2

Step 7: Complete the MODX Installation

Now that everything is set up, open your web browser and navigate to your server’s IP address or domain name:

http://your_domain.com

You should see the MODX installation wizard. Follow the prompts to complete the installation. During the process, you’ll need to enter the database details you created earlier:

  • Database type: MySQL
  • Database host: localhost
  • Database name: modxdb
  • Database user: modxuser
  • Database password: your_password

After filling in the required fields, continue with the installation until completion.

Step 8: Secure Your Installation

Once the installation is complete, for security reasons, it’s crucial to delete the setup/ directory. You can do this with:

sudo rm -rf /var/www/html/modx/setup/

Conclusion

Congratulations! You have successfully installed MODX on Ubuntu 24.04 or newer. You can now begin customizing your website and adding content. MODX offers a plethora of add-ons and templates to enhance your site, making it a powerful choice for any web project.


Feel free to share this guide with anyone looking to set up MODX on Ubuntu. For more tutorials and web hosting tips, stay tuned to our blog!