Zoneminder is a free and open source surveillance camera management software available only for Linux. 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 intended to run on a Linux system for CCTV surveillance. It offers a web interface to easily operate and control standard cameras (via capture card, USB, FireWire, etc.) or IP-based cameras.
We can run the software in three modes:
• Monitoring (without recording)
• Recording after motion detected
• Permanent record
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, etc.
1. Requirements for the tutorial
• Ubuntu 22.04/20.04/18.04
• Apache webserver
• PHP and MySQL
• A non-root user with sudo just at least
• Internet connection
2. Run System Update
Since we needed several packages to be installed using the system repository, let’s run the system update command first to make sure our system is up to date.
sudo apt update -y
3. Install LAMP Server on Ubuntu 20.04 | 22.04
We need an Apache, PHP and MySQL web server to run ZoneMinder. Therefore, let’s first configure the complete LAMP server on our system. Well, the user can install the LAMP elements one by one, but instead we will take a holistic approach here using the tasksel tool.
sudo apt install tasksel
Once the Tasksel is on your system, you can run a single command to automate the process of installing Apache, PHP, and MySQL, including enabling their services.
sudo tasksel install lamp-server
Accept the LAMP install prompt by pressing Yes and knock Enter key.
4. Add PPA for latest version of ZoneMinder
Well, the best thing is that ZoneMinder can be installed using APT package manager and base repository of Ubuntu 20.04 and 22.04, so we can run a single command to get it. However, the official repository version will not be the most recent.
Therefore, we recommend using the following PPA repository, run:
sudo add-apt-repository ppa:iconnor/zoneminder
When you run the above command, the system will automatically request the repository that provides the latest version. For example, in our case it was 1.36. In the same way, you will also have one. Use this version with the PPA repository above to add the same-
syntax:
sudo add-apt-repository ppa:iconnor/zoneminder-version
Example:
sudo add-apt-repository ppa:iconnor/zoneminder-1.36
Once you’ve 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 you 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 MySQL installed, just set the sql_mode = NO_ENGINE_SUBSTITUTION
using the 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+Opress the Enter key, then exit- Ctrl+X.
6. Set Apache User Permissions
Grant access to ZoneMinder files to the apache user so that he 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
hurry Ctrl+w then type – Dated after that press the Enter key. This will search and take you to the area from which we can configure the timezone: You can see your timezone in the official PHP doc.
To replace ;
from the front of the line- date.timezone
and after that add your time zone.
Save the file- CTRL+Ohurry Enter Key then CTRL+X.
7. Start and activate the ZoneMinder service
We have configured almost everything, start the ZoneMinder system service, also enable it to ensure that it runs automatically with system startup or in the event of a crash.
sudo systemctl enable zoneminder sudo systemctl start zoneminder
Also reload the Apache service to apply the changes we’ve made so far.
sudo systemctl reload apache2
8. Access the web interface
Let’s go to the last step to access the web interface of ZoneMinder, just 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
To note: Replace the server-ip-address
with the real address of your Ubuntu system. If you don’t know the IP address, we can get it using the command – ip a
Uninstall or remove
In future, if you want to remove this Linux software, just run the given commands to not only uninstall ZoneMinder but also its repository.
sudo apt remove zoneminder
sudo add-apt-repository --remove ppa:iconnor/zoneminder-version
Here is our version 1.36 then the command will be:
sudo add-apt-repository --remove ppa:iconnor/zoneminder-1.36
To remove Lamp Server:
sudo tasksel remove lamp-server
Other Items:
• 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 Linux LTS