Сегодня настроим ПО для видеонаблюдения ZoneMinder

Качаем дистрибутив Ubuntu 18.04 server с новым установщиком (у меня это 18.04.3)

Я использую виртуальную машину, создаем её, монтируем скаченный образ как установочный. Запускаем.

Следуем указаниям уставщика.

Выбираем язык, раскладку клавиатуры, настройки сетевого интерфейса, прокси сервер если есть, зеркало обновлений, размечаем диск, настраиваем пароль, ssh, и выбираем нужные пресеты (в моём случае никакие не выбираем). Дожидаемся окончания установки, перезагружаемся.

Логинимся в систему, обновляем пакеты:

sudo su  
apt update  
apt upgrade

Устанавливаем  LAMP (набор ПО для нашего веб сервера плюс БД)

apt-get install tasksel
tasksel install lamp-server

Настраиваем mysql:

mysql_secure_installation

Задаем пароль и параметры безопасности mysql:

Для примера так :

Securing the MySQL server deployment.
Connecting to MySQL using a blank password.
VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?
Press y|Y for Yes, any other key for No:
Please set the password for root here.
New password:
Re-enter new password:
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.
Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.
Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.
Disallow root login remotely? (Press y|Y for Yes, any other key for No) :
... skipping.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
- Dropping test database...
Success.
- Removing privileges on test database...
Success.
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.
All done!

Устанавливаем репозитарий и обновляемся:

add-apt-repository ppa:iconnor/zoneminder-1.32
apt-get update
apt-get upgrade

 Ставим mc для комфорта

apt-get install mc

Удаляем символическую ссылку конфига /etc/mysql/my.cnf

Копируем конфиг по умолчанию вместо него /etc/mysql/mysql.conf.d/mysqld.cnf

Коммандами можно так :

rm /etc/mysql/my.cnf 
cp /etc/mysql/mysql.conf.d/mysqld.cnf /etc/mysql/my.cnf
Редактируем конфиг /etc/mysql/my.cnf
Добавляем в секцию [mysqld]
 
sql_mode = NO_ENGINE_SUBSTITUTION

Через редактор mc можно вставлять из буфера через shift+правя кнопка мыши. 
 
Перезапускаем БД:
systemctl restart mysql

 Устанавливаем ZoneMinder и выставляем необходимае права:

apt-get install zoneminder
chmod 740 /etc/zm/zm.conf
chown root:www-data /etc/zm/zm.conf
chown -R www-data:www-data /usr/share/zoneminder/

Настраиваем apache:

a2enmod cgi
a2enmod rewrite
a2enconf zoneminder
a2enmod expires
a2enmod headers

Перезапускаем:

systemctl restart apache2

Запусакем:

systemctl enable zoneminder
systemctl start zoneminder

 Выставляем таймзону в /etc/php/7.2/apache2/php.ini

date.timezone = Europe/Moscow

 Перезапускаем конфиг:

systemctl reload apache2

 Проверяем работоспособность:

http://hostname_or_ip/zm

http://hostname_or_ip/zm/api/host/getVersion.json

Настраиваем время:

timedatectl set-timezone 'Europe/Moscow'
apt-get install ntp

Редактируем /etc/ntp.conf если нужно добавить определённые сервера времени.

Перезагружаем сервис:

service ntp restart

Проверяем что все в порядке: 

date

Запускаем http://hostname_or_ip_/zm и настраиваем камеры