Минимальный образ (JeOS с systemd) взят отсюда: https://mirror.yandex.ru/altlinux-starterkits/x86_64/release/
После установки необходимо включить ssh-сервер:
systemctl enable --now sshd
В минималке других пользователей кроме root нет. Поэтому необходимо его создать и добавить в группу wheel:
useradd admin
passwd admin
usermod -aG wheel admin
После чего можно подключить к серверу и выполнить настройку. Все команды выполняем от root.
su -
apt-get update
apt-get dist-upgrade -y
Установка основных компонентов ОС:
apt-get install atop nmon htop nload nmap lshw passwdqc-control testdisk bash-completion-util-linux bash-completion lm_sensors3 ddrescue iperf3 tmux lsscsi inxi mc update-kernel eepm apt-repo alien telnet bind-utils curl wget git rsync gzip-utils su fdisk cfdisk glibc-locales console-scripts startup iconv -y
update-kernel -y
Тюнинг параметров ядра:
mcedit /etc/sysctl.d/99-sysctl.conf
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
net.core.rmem_max = 1073741824
net.core.wmem_max = 1073741824
net.ipv4.tcp_rmem = 1048576 16777216 1073741824
net.ipv4.tcp_wmem = 1048576 16777216 1073741824
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_intvl = 30
net.ipv4.tcp_reordering = 20
net.ipv4.tcp_mem = 1048576 16770216 1073741824
vm.swappiness = 15
Настройка NTP:
mcedit /etc/chrony.conf
Закомментировать pool pool.ntp.org iburst и конец файла добавить:
server ntp1.vniiftri.ru
server ntp2.vniiftri.ru
server ntp3.vniiftri.ru
server ntp4.vniiftri.ru
Включение автозапуска chrony:
systemctl enable chronyd --now
Отключаем спящий режим и гибернацию:
systemctl mask hibernate.target suspend.target sleep.target suspend-then-hibernate.target
Редактор по умолчанию и локаль:
echo 'export EDITOR=mcedit' >> /etc/profile.d/my_prfile.sh
echo 'export LANG="ru_RU.UTF-8"' >> /etc/profile.d/my_prfile.sh
echo 'export LC_ALL="ru_RU.UTF-8"' >> /etc/profile.d/my_prfile.sh
echo 'export LC_CTYPE="ru_RU.UTF-8"' >> /etc/profile.d/my_prfile.sh
chmod +x /etc/profile.d/my_prfile.sh
echo "LANG=ru_RU.UTF-8" > /etc/sysconfig/i18n
echo "SUPPORTED=ru_RU.UTF-8" >> /etc/sysconfig/i18n
echo "LANG=ru_RU.UTF-8" > /etc/locale.conf
echo "FONT=UniCyr_8x16" > /etc/vconsole.conf
Чтоб mc переключал текущую директорию:
echo "alias mc='. /usr/lib/mc/mc-wrapper.sh -r'" >> /etc/profile.d/my_prfile.sh
Устанавливаем временную зону:
ln -s /usr/share/zoneinfo/Europe/Moscow /etc/localtime
Установка компонентов сервера видеонаблюдения:
apt-get install zoneminder zoneminder-api MySQL-server apache2-mod_php8.3 apache2-cgi-bin php8.3-cgi php8.3-sockets -y
Установим временную зону для MySQL:
mcedit /etc/my.cnf.d/server.cnf
[mysqld]
default_time_zone = '+03:00'
Запустим MySQL:
systemctl enable mysqld.service --now
Выполним создание БД и пользователя в консоли mysql (Pass - это пароль пользователя zmuser):
mysql
CREATE DATABASE zm;
source /usr/share/zoneminder/db/zm_create.sql;
CREATE USER 'zmuser'@'localhost' IDENTIFIED WITH mysql_native_password BY 'Pass';
GRANT ALL PRIVILEGES ON zm.* TO 'zmuser'@'localhost';
FLUSH PRIVILEGES;
exit
Создадим конфиг zoneminder для apache:
mcedit /etc/httpd2/conf/sites-available/zoneminder.conf
<VirtualHost *:80>
ServerName localhost
# Веб интерфейс ZoneMinder
Alias /zm /usr/share/zoneminder/www
<Directory /usr/share/zoneminder/www>
Options FollowSymLinks
AllowOverride All
Require all granted
php_value short_open_tag 1
DirectoryIndex index.php
</Directory>
# CGI скрипты - все возможные варианты (на случай если не будет отображаться изображение в консоли)
ScriptAlias /cgi-bin /usr/lib/zoneminder/cgi-bin
ScriptAlias /cgi-bin-zm /usr/lib/zoneminder/cgi-bin
ScriptAlias /zm/cgi-bin-zm /usr/lib/zoneminder/cgi-bin
ScriptAlias /zm/cgi-bin /usr/lib/zoneminder/cgi-bin
<Directory "/usr/lib/zoneminder/cgi-bin">
Options +ExecCGI
Require all granted
SetHandler cgi-script
php_value short_open_tag 1
</Directory>
ErrorLog /var/log/httpd2/zm_error.log
CustomLog /var/log/httpd2/zm_access.log combined
</VirtualHost>
Подключим конфиг и модули в apache:
a2ensite zoneminder
a2enmod mod_php8.3
a2enmod cgi
a2enmod rewrite
a2enmod headers
Установим временную зону для php:
mcedit /etc/php/8.3/apache2-mod_php/php.ini
date.timezone = "Europe/Moscow"
Подключим модуль расширения socket:
mcedit /etc/php/8.3/cli/php.ini
extension=sockets.so
Установим права на директории:
chown -R apache2:_webserver /usr/share/zoneminder/
chown -R apache2:_webserver /var/cache/zoneminder/
chmod -R 755 /var/cache/zoneminder/
Добавим пользователя apache2 в группу video:
usermod -a -G video apache2
В конфиге zoneminder укажем параметры подключения к БД:
mcedit /etc/zm/zm.conf
ZM_DB_TYPE=mysql
ZM_DB_HOST=localhost
ZM_DB_NAME=zm
ZM_DB_USER=zmuser
ZM_DB_PASS=Pass
Доработаем сервис zoneminder на случай его краша (при старте ОС он может запуститься быстрее чем БД будет доступна):
md /etc/systemd/system/zoneminder.service.d/
mcedit /etc/systemd/system/zoneminder.service.d/restart.conf
[Service]
Restart=always
RestartSec=10
StartLimitIntervalSec=0
Добавим сервисы в автозапуск и перезагрузим сервер:
systemctl enable --now httpd2 zoneminder
reboot
Подключимся к серверу и добавим камеру (в моём случае это RVi-1NCD2379):
http://АйПиАдресСервера/zm/
Скрины моих настроек камеры: