How to upgrade your existing MODX Revolution to a new version

Published on: - 11 months, 1 week ago

An article tagged as: linux, modx

Twitter Google+ Facebook Reddit

Overview

MODX Revolution is regularly updated with new features and security patches. But the process of updating can be rather fiddly. Here is a straight forward way of updating MODX to the current version on your Linux web server using SSH.

Download MODX

First of all SSH into your web-server.

Then find the latest stable version of MODX and download it directly onto your server.

$ wget http://modx.com/download/direct/modx-2.5.0-pl.zip

Unzip the file.

$ unzip modx-2.5.0-pl.zip

For ease of use, rename the extracted folder to something shorter.

$ mv modx-2.5.0-pl modx

Backup existing set-up

Plan for the worst!! So lets backup your current set-up.

Tidy-up MODX

In the Manager, use the menu bar to clear the cache and logout all users.

Dump the database

We want to have a safe copy of our database.

Make sure you have the database password. This can be found in core/config/config.inc.php.

Now dump the database, making sure you replace USERNAME and DBNAME with your database name and username.

$ mysqldump -u USERNAME -p DBNAME > DBNAME.sql

Archive

Use tar to make a safe backup of your files, just in case!

$ tar -cvzf backup.tar.gz .

If for some reason you have files or folders that you want to exclude from the backup, you can use --exclude

$ tar -cvzf backup.tar.gz . --exclude='myfolder'

You can download this archive file using an ftp program like FileZilla.

Install new version

Update files

Navigate to your new modx folder we made earlier.

$ cd modx

Now copy the newly downloaded version over our current one. If rsync is new to you, take a look at this useful article and consider using the --dry-run option.

$ rsync -avP connectors/ ../connectors/
$ rsync -avP core/ ../core/
$ rsync -avP manager/ ../manager/
$ rsync -avP setup/ ../setup/

Check config files

After doing any kind of update it is worth checking that your config files contain the correct settings.

$ nano core/config/config.inc.php

$ nano config.core.php
$ nano connectors/config.core.php
$ nano manager/config.core.php

Check permissions

Depending on how your server is configured, you may need to set the permissions of the setup directory

$ chmod -R 755 setup

Complete instalation

Visit the setup url - yourdomain.com/setup

Follow the instructions, making sure you select Upgrade Existing Install

Once complete, log in to the Manager to check that everything is working as it should.

Troubleshooting

Missing items in Manager

Sometimes items will be missing or unresponsive in the Manager. This can be because some js files are not running due to the wrong permissions. You can try the following

$ chmod 755 manager
$ chmod 755 manager/index.php
$ chmod 755 connectors
$ chmod 755 connectors/index.php
$ chmod 755 connectors/modx.config.js.php
$ chmod 755 connectors/lang.js.php

Hardening your MODX install

MODX, like all CMS's, could be exploited by unscrupulous individuals. Use this article to harden your MODX install.