ZoneMinder on Ubuntu
I’ve been using ZoneMinder for about 10 years at this point. Below I’ll outline my way (maybe easier than the official documentation) of installing ZoneMinder on Ubuntu 20.04 LTS. I’ll be installing this a Lenovo M900 tiny pc and using 4 cheap PoE cameras off of Amazon
LAMP Install and Setup
Before we can install ZoneMinder we have to install and configure the software it needs to run. This includes Apache2, PHP7, & MySQL. We can install these one by one or, the easy way, by using tasksel
sudo apt install tasksel && sudo tasksel install lamp-server
Note that you were not asked for password during the MySQL installation. Starting in 16.04 there is no need for a root password. Instead you can only connect via local socket, meaning you have to type sudo mysql at the command line to log in as root
Next, per ZoneMinder’s recommendation, we’ll replace the default MySQL config file
sudo rm /etc/mysql/my.cnf sudo cp /etc/mysql/mysql.conf.d/mysqld.cnf /etc/mysql/my.cnf
Edit my.cnf and add sql_mode = NO_ENGINE_SUBSTITUTION to the [mysqld] section
sudo nano /etc/mysql/my.cnf
Once done, press Ctrl+X, then Y and Enter to save the file and then restart MySQL
sudo systemctl restart mysql
Next, reconfigure your Time Zone. I found that sometimes it doesn’t stick after the initial install and when you attempt to fix it after the fact (or at least I did), you’ll see error messages and have potential video loss. Select US, if youre in the US, and then the correct region
sudo dpkg-reconfigure tzdata
Set the Time Zone in PHP as well
sudo nano /etc/php/7.4/apache2/php.ini
Search for date.timezone and uncomment the line by removing the ; at the beggining. Set your time zone according to the PHP website. Again, making sure they match
By default MySQL is set to system time. If you changed the Time Zone on the system, restart the service before checking MySQLs time. To check, run the below command. If the time is correct, then you’re good to go
sudo systemctl restart mysql sudo mysql -e “SELECT NOW();”
ZoneMinder Install
First we’ll need to install the official ZoneMinder PPA from Isaac Conner and then we can install ZoneMinder
sudo add-apt-repository ppa:iconnor/zoneminder-1.34 sudo apt install -y zoneminder
Once the installation finishes, we’ll need to configure Apache2 by copying and enabling the zm.conf file, enabling a few mods, and finially restarting ZoneMinder and Apache2
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/ sudo a2enmod cgi rewrite expires headers sudo a2enconf zoneminder sudo systemctl enable zoneminder sudo systemctl start zoneminder sudo systemctl restart apache2
Zoneminder should be installed and ready to add cameras
To test this, go to hxxp://ip_address/zm and the interface should be available. Its also a good idea to test the API by going to hxxp://ip_address/zm/api/host/getVersion.json. You should see the API version in your browser
That’s it! ZoneMinder is ready to go and you can start adding your cameras. I wont cover cameras here since there are a ton of different models and what works for me, might not work for you. But, I will say, get yourself an ONVIF compliant camera and you shouldn’t have any issues.