Board version: | Pi 5 B Rev 1.0 |
Memory: | 8 GB |
RPi OS version: | Lite 32-bit |
Site: | https://zoneminder.com/ |
Recommended: |
Raspberry Pi Active Cooler for RPi 5
M.2 NVMe SSD (2230/2242/2260/2280) - Samsung 960 EVO 250 GB |
M.2 NVMe HAT: | https://wiki.geekworm.com/X1001 |
$ sudo apt install mariadb-server
Reboot
After installing the database server, you should run the MySQL secure installation script.
This script helps remove weak security settings from the database server:
$ sudo mysql_secure_installation
unix_socketauthentication. Type in
nthen press the ENTER key.
unix_socketis being used, type
nthen press ENTER.
Y, then press the ENTER key. The rest of the options will improve the security of your database server.
Create the database with related user, and assign the proper permissions with the following terminal commands
(copy-paste line by line). Please change the user name and user password with your preferred ones.
$ sudo su
$ mariadb
CREATE DATABASE zm;
CREATE USER '[zoneminder_usr]'@'localhost' IDENTIFIED BY '[password]';
GRANT ALL ON zm.* TO [zoneminder_usr]@localhost;
FLUSH PRIVILEGES;
exit;
$ exit
Please note that the database name (“zm”) is linked in the following DB preparation script from ZoneMinder.
If you want to change the name, you will have to edit the default database configuration script by using the new name.
Reboot
curl -L https://zmrepo.zoneminder.com/debian/archive-keyring.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/zoneminder-archive-keyring.gpg >/dev/null
echo "deb [signed-by=/usr/share/keyrings/zoneminder-archive-keyring.gpg] https://zmrepo.zoneminder.com/debian/master $(lsb_release -cs)/" | sudo tee /etc/apt/sources.list.d/zoneminder.list
$ sudo apt update
$ sudo apt install zoneminder
Reboot
Now we must prepare the database configuration for ZoneMinder.
The software brings a ready-to-use SQL script that makes all the job for us.
So, we can perform all the database configurations with this single line command, where [zoneminder_usr] and [password]
must be changed with the ones set a few lines before. Please note that the password is attached with the -p
option:
$ mariadb -u [zoneminder_usr] -p[password] < /usr/share/zoneminder/db/zm_create.sql
This script will create all the required database structures, setting up the required tables with the needed columns and charsets.
$ sudo apt install php libapache2-mod-php php-mysql
$ sudo chmod 740 /etc/zm/zm.conf
$ sudo chown root:www-data /etc/zm/zm.conf
$ sudo chown -R www-data:www-data /var/cache/zoneminder/
$ sudo adduser www-data video
$ sudo a2enmod cgi
$ sudo a2enmod rewrite
$ sudo a2enconf zoneminder
$ sudo systemctl reload apache2.service
$ sudo systemctl enable zoneminder.service
$ sudo systemctl start zoneminder.service
Reboot
At this point, you should have your zoneminder.service correctly running,
check it with the systemctl status
command:
$ sudo systemctl status zoneminder.service
$ PHP_VERSION=$(php -v | head -n 1 | tail -n 1 | cut -d " " -f 2 | cut -c 1-3)
Now that we have the PHP version stored in an environment variable,
we can easily edit the correct configuration file.
Begin modifying PHP’s configuration file by using the following command:
$ sudo nano /etc/php/$PHP_VERSION/apache2/php.ini
Within this file, you will want to find the following line.
Since we are using the nano text editor, you can search using CTRL + W:
;date.timezone =
For example, we would use the following line to set the time zone to Amsterdam, Europe.date.timezone = Europe/Amsterdam
Once done, you can save and quit by pressing CTRL + X, followed by Y, then the ENTER key.
http://[YOUR-IP-ADDRESS]/zm