How to Install ZoneMinder on Ubuntu 22.04 | 20.04 LTS

Zoneminder is a free and open-source surveillance camera management software available for Linux only. Here we will learn the steps to install ZoneMinder on Ubuntu 20.04 Focal Fossa or Ubuntu 22.04 Jammy JellyFish.

What is ZoneMinder?

ZoneMinder is a software application meant to run on a Linux system for monitoring via closed-circuit television. It offers a web interface to easily use and controls standard cameras (via a capture card, USB, FireWire, etc.) or IP -based camera devices.

We can operate the software in three modes:

Monitoring (without recording)
Recording after detected movement
Permanent recording

Steps to install ZoneMinder on Ubuntu 22.04 | 20.04 LTS

The steps given here can also be used on other versions of Ubuntu as well as other operating systems based on it such as POP OS, Linux Mint, Elementary OS, MX Linux, and more…

1. Requirements for Tutorial

Ubuntu 22.04/20.04/18.04
Apache Web Server
A non-root user with sudo right at least
Internet Connection


2. Run system update

As we required multiple packages to get installed using the system repository, hence let’s first run the system update command to ensure our system is up to date.

sudo apt update -y


3. Install the LAMP server on Ubuntu 20.04 | 22.04

We need an Apache web server, PHP, and MySQL to run ZoneMinder, hence first let’s set up the full LAMP server on our system.

sudo apt install apache2 mysql-server php

Enable service

sudo systemctl enable --now apache2 mysql

To check status 

sudo systemctl  status apache2 mysql


4. Add PPA for ZoneMinder’s latest version

Well, the best thing is the ZoneMinder is available to install using the APT package manager and base repository of both Ubuntu 20.04 and 22.04, hence we can run a single command to get it. However, the version from the official repository will not be the latest one.

To get the latest version use its PPA,  available on launchpad. For example, in our case, it was 1.36. In the same way, you will also have one. Use that version with the above PPA repo to add the same-


sudo add-apt-repository ppa:iconnor/zoneminder-version


sudo add-apt-repository ppa:iconnor/zoneminder-1.36

Add PPA ZoneMinder repository

Once you have added the repository, run the system update command:

sudo apt update && sudo apt upgrade


4. Install ZoneMinder on Ubuntu 22.04 | 20.04

Well, we have added the repository to get the latest version of ZoneMinder, now can easily use the APT package manager to install it with all required dependencies.

sudo apt install zoneminder


We already have installed MySQL, just set the sql_mode = NO_ENGINE_SUBSTITUTION using MySQL configuration file.

sudo rm /etc/mysql/my.cnf  
sudo cp /etc/mysql/mysql.conf.d/mysqld.cnf /etc/mysql/my.cnf

Edit the file:

sudo nano /etc/mysql/my.cnf

At the end of the file, add the following line:


Save the file by pressing Ctrl+O, hitting the Enter key, and then exiting- Ctrl+X.



6. Set Apache user permissions

Permit ZoneMinder files access to the apache-user so that it can access them.

sudo chmod 740 /etc/zm/zm.conf
sudo chown root:www-data /etc/zm/zm.conf
sudo chown -R www-data:www-data /usr/share/zoneminder/

Enable Apache modules:

sudo a2enmod cgi rewrite expires headers

Enable ZoneMinder virtual host configuration file

sudo a2enconf zoneminder

Set Date and Time zone in PHP.ini

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

Press Ctrl + w and then type – Date after that hit the Enter key. This will search and take you to the area from where we can configure the Time zone: You can see your TimeZone in the Official PHP doc.

Replace ; from the front of the line- date.timezone and after that add your timezone.

Set TIme zone in PHP

Save the file- Ctrl+O, press Enter Key and then Ctrl+X.


7. Start and Enable ZoneMinder Service

We have configured almost everything, let’s start the ZoneMinder system service, also enable it to make sure it run automatically with system boot or in case gets crashed.

sudo systemctl enable zoneminder
sudo systemctl start zoneminder

Also, reload the Apache service to apply the changes we have made so far.

sudo systemctl reload apache2


8. Access the Web interface

Let’s take the final step to access the web interface of ZoneMinder, simply open your browser on your system or the one that can access the IP address of the server where you have installed this monitoring & surveillance software.

Point it to :


Note: Replace, the server-ip-address with the actual address of your Ubuntu system. If you don’t know the Ip-address then we can get that using the command – ip a

Accept terms and conditions ZoneMinder Web interface install Ubuntu 22.04 20.04

Uninstall or Remove

In the future, if you want to remove this Linux software then simply run the given commands to not only uninstall ZoneMinder but also its repository.

sudo apt autoremove --purge zoneminder
sudo add-apt-repository --remove ppa:iconnor/zoneminder-version

Here our version is 1.36 then the command will be:

sudo add-apt-repository --remove ppa:iconnor/zoneminder-1.36

For removing Lamp Server:

sudo apt autoremove --purge apache2 mysql-server php


To know about this tool further, refer to the official documentation.


Other Articles:

Add repository to Install MySQL 5.7 on Ubuntu 20.04 LTS Linux
Script to install LAMP & WordPress on Ubuntu 20.04 LTS
How to install Deepin DDE on Ubuntu 20.04 | 19.04 | 18.04 LTS Linux



9 thoughts on “How to Install ZoneMinder on Ubuntu 22.04 | 20.04 LTS”

  1. Nice instructions. Please note that the mysql engine substution stuff isn’t necessary anymore.
    Also the timezone stuff can now be set in ZM options -> System -> TimeZone which might be easier for many.
    Might also want to address that php default memory limits can be too low (128Mb) and some views like Montage Review might want more.

  2. Thanks for instructions, I was able to follow, and I can start it up.

    However I get and error when I’m trying to Add a monitor in “Console”: “Width must be set to a valid value. Height must be set to a valid value” when I try to save. I see no errors in the logs, it must be a UI issue.

  3. how did you guys get it working following these instructions? step 8 won’t work without setting up mysql. there is a zmuser that needs to be setup with a password.

  4. Excelent, good instructions,make the install very easy. Installed in Ubuntu (desktop 22.04) and ready for work! Thanks to Heyan Maurya, for this step by step guide.

  5. I screwed-up my server yesterday, and I decided to reinstall. These instructions were honestly clearer and faster than the official ones. Thank you for taking the time to make this!

  6. How to Install ZoneMinder on Ubuntu 22.04
    Step 8: Access the Web page faults to a file and will not go to the ZM webpage. Any ideas.
    Thanks for listening, Rick

  7. AH00526: Syntax error on line 33 of /etc/apache2/conf-enabled/zoneminder.conf:
    Invalid command ‘RewriteEngine’, perhaps misspelled or defined by a module not included in the server configuration

    Any help, what did i do wrong


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.