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
PHP & MySQL
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-

syntax:

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

example:

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

5. Set MySQL- sql_mode = NO_ENGINE_SUBSTITUTION

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:

sql_mode = NO_ENGINE_SUBSTITUTION

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

MySQL sql mode NO ENGINE SUBSTITUTION

 

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 :

http//:server-ip-address/zm

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

 

 

Comments (6)

  1. Isaac Conno February 6, 2022
  2. petrum April 23, 2022
  3. Jack Rainey May 11, 2022
  4. woozy May 27, 2022
  5. Joe May 28, 2022
  6. Ed Balam May 31, 2022

Leave a Reply

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