Skip to content
STAGE33R

Guides · Server software · 6 steps · reviewed

How to update Joomla safely from the command line (core and extensions)

Joomla core and extension vulnerabilities are exploited quickly after disclosure. Joomla 4 and 5 include a command-line tool that checks and applies updates, which is faster and easier to repeat than the admin screen.

  1. Back up first

    Database and files, outside the web root.

    cd /path/to/joomla
    mysqldump DBNAME > ~/joomla-$(date +%F).sql
    tar czf ~/joomla-files-$(date +%F).tgz .
  2. Check the version and updates

    The CLI is run as the site user.

    sudo -u SITEUSER php cli/joomla.php core:check-updates
  3. Take the site offline

    So nobody uses it during the update.

    sudo -u SITEUSER php cli/joomla.php site:down
  4. Update core

    Run it and read the output for errors.

    sudo -u SITEUSER php cli/joomla.php core:update
  5. Update extensions and templates

    Use the admin Extensions, Update screen: the CLI updates core only. Update everything that has a security release.

  6. Bring the site back and verify

    Clear caches and test login, forms and key pages.

    sudo -u SITEUSER php cli/joomla.php site:up
    sudo -u SITEUSER php cli/joomla.php cache:clean

Common mistakes

  • Updating on a PHP version Joomla does not support yet.
  • Third-party extensions that lag behind core: check each one first.
  • Working as root and changing file ownership.

How to undo it

Restore the database dump and the files archive.

Sources

Commands are for Debian and Ubuntu unless noted. Test on a copy first and keep a backup: you are responsible for changes on your own systems.