There are millions of CCTV and IP Camera tools and options on the market. If we want to protect our property then a camera system is a good idea. Physical security companies provide solutions with hardware, software and consultation, but if we want to play with the possibilities and the technology, then ZoneMinder is a great option.
ZoneMinder is an open source video surveillance software system. It can handle multiple different brand cameras attached to the local system or accessed their stream remotely.
It is free and open source, we can play with it and put together a whole CCTV system.
The developers provide precompiled packages and repositories for different Linux systems. We will install ZoneMinder on Debian Bullseye. The ZoneMinder wiki has a great page about the installation, and I will write here the way I installed the base system.
The basic installation does not contain any security measurement! It is for experimenting. We will build the security step by step like authentication for the UI.
All of the operations below must be done as the root user!
Apache2 and MariaDB installation
On Debian we have to install and configure MariaDB for ourselves alongside the Apache http server.
apt install apache2 mariadb-server php libapache2-mod-php php-mysql lsb-release gnupg2
After the installation we have to secure our SQL server. It will set up a root password and clean up the database.
mysql_secure_installation
The install script preparation
Let’s grab the installer script from the ZoneMinder wiki and save it in a file called zm-install.
#!/bin/sh
clear
read -p "This script installs ZoneMinder 1.36.x on Debian 11 with LAMP (MySQL or Mariadb) installed...
This script must be run as root!
Press Enter to continue or Ctrl + c to quit" nothing
clear
apt install -y lsb-release gnupg2
echo "deb https://zmrepo.zoneminder.com/debian/release-1.36 "`lsb_release -c -s`"/" | sudo tee /etc/apt/sources.list.d/zoneminder.list
wget -O - https://zmrepo.zoneminder.com/debian/archive-keyring.gpg | sudo apt-key add -
read -p "Warning! Check above to insure the line says OK. If not the GPG signing key was not installed and you will need to figure out why before continuing.
Press enter to continue" nothing
apt update
clear
apt install -y zoneminder
systemctl enable zoneminder
service zoneminder start
adduser www-data video
a2enconf zoneminder
a2enmod rewrite
a2enmod headers
a2enmod expires
service apache2 reload
clear
read -p "Install complete. Open Zoneminder/Options and set the timezone. Press enter to continue" nothing
clear
The above script requires execute rights.
chmod +x zm-install
The ZoneMinder installation
Now we can install ZoneMinder with running the script as root.
./zm-install
The script will set up our APT repo and download the necessary packages. After the successful installation ZoneMinder will start automatically.
The web UI – set up password authentication
We can reach the web UI on the http://<ip address>/zm URL.
Time to read the user guide very carefully and understand the possibilities.
To set up authentication we have to navigate to the Options menu. Left side in the Systems tab we will enable the authentication with the OPT_USE_AUTH option. Let’s keep it on the built-in authentication now.

Saving the configuration will log us out. We can log in with the admin/admin default user and password.
Let’s open our password manager tool and generate a strong password for the admin user. Then in the Options menu’s Users tab we have to open the admin user and change its password to the new, strong password.
Now we have a very basic security.
Camera and camera software installation
If we don’t want to spend a lot of money on very expensive 4K cameras with night vision and other special features then we have a “free” alternate option.
Everyone has cell phones around, used and unused ones. Today’s cell phones have good cameras and we can use them as IP cameras with some additional tools.
DroidCam will turn an Android phone to an IP camera. We can use DroidCam’s stream URL as a camera source for ZoneMinder. Though the free DroidCam can stream only 640×480 resolution video, it is quite enough for testing building a CCTV system at home.
If we are already picky for the resolution, DroidCamX is a HD version for some additional bucks. Later we can buy IP cameras and exchange the Android phones.
We can simply add a new Monitor to the system, and use the DroidCam application on our Android phone to stream to ZoneMinder. Setting its video stream URL directly in ZoneMinder will work without issues.
http://<android ip>:4747/video
Note that the cell phone screen must NOT be locked when we register it as a Monitor!
Now we can play with motion detection, recording and setting up more basic security like HTTPS!
If you have anything to share then please visit my Tom’s IT Cafe Discord Server!