Skip to content
www.mytechnote.ru
Menu
  • Administration
    • Scripts
  • Equipment
    • Reviews
    • Instructions
  • Other
  • English
    • English
    • Русский
Menu

Transform Android into a Surveillance Camera with ZoneMinder on Ubuntu Server 16.04

Looking for a smart way to repurpose your old Android device? Turn it into a state-of-the-art surveillance camera using ZoneMinder on Ubuntu Server 16.04. This step-by-step guide will unveil the secrets of this setup.

For those who just looking for commands:

sudo apt-get update
sudo apt-get upgrade
sudo tasksel install lamp-server
cat /etc/timezone
sudo dpkg-reconfigure tzdata
nano /etc/php/7.0/apache2/php.ini
date.timezone = Europe/Moscow
sudo apt-get install zoneminder
sudo mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql
mysql -uroot -p -e "grant select,insert,update,delete,create,\
alter,index,lock tables on zm.* to 'zmuser'@localhost identified by 'zmpass';"
sudo a2enconf zoneminder
sudo a2enmod rewrite
sudo a2enmod cgi
sudo chown www-data:www-data /etc/zm/zm.conf
sudo su
echo "kernel.shmall = 134217728" >> /etc/sysctl.conf
echo "kernel.shmmax = 134217728" >> /etc/sysctl.conf
echo 134217728 >/proc/sys/kernel/shmall
echo 134217728 >/proc/sys/kernel/shmmax
systemctl enable zoneminder
echo "sql_mode = NO_ENGINE_SUBSTITUTION" >> /etc/mysql/mysql.conf.d/mysqld.cnf
reboot

Also there is a video:

1. Preparing Your Ubuntu System for ZoneMinder

1. Start with the basics:

sudo apt-get update
sudo apt-get upgrade
sudo tasksel install lamp-server

2. Synchronize Timezone on Your Ubuntu Server

Ensure a unified timezone between server and PHP:

cat /etc/timezone

If it’s differs from yours:

sudo dpkg-reconfigure tzdata

Set correct timezone for php:

nano /etc/php/7.0/apache2/php.ini

Change line containing date.timezone

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = Europe/Moscow

2. Seamless ZoneMinder Installation & Configuration

a. Kick-off the Installation:

sudo apt-get install zoneminder

b. Database Harmony:

Merge ZoneMinder with MySQL database:

sudo mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql
mysql -uroot -p -e "grant select,insert,update,delete,create,\
alter,index,lock tables on zm.* to 'zmuser'@localhost identified by 'zmpass';"

For custom passwords, modify the /etc/zm/zm.conf.

c. Apache Configuration:

sudo a2enconf zoneminder
sudo a2enmod rewrite
sudo a2enmod cgi
sudo chown www-data:www-data /etc/zm/zm.conf

d. Maximizing Memory for ZoneMinder:

sudo echo "kernel.shmall = 134217728" >> /etc/sysctl.conf
sudo echo "kernel.shmmax = 134217728" >> /etc/sysctl.conf
sudo echo 134217728 >/proc/sys/kernel/shmall
sudo echo 134217728 >/proc/sys/kernel/shmmax

e. Activate ZoneMinder Automatically:

systemctl enable zoneminder

f. Avoid MySql Errors:

Add sql_mode = NO_ENGINE_SUBSTITUTION to /etc/mysql/mysql.conf.d/mysqld.cnf, or you may see an error during adding a camera to your Zoneminder like this:

SQL-ERR ‘SQLSTATE[HY000]: General error: 1366 Incorrect integer value: ” for column ‘ServerId’ at row 1′, statement was ‘insert into Monitors set LinkedMonitors = ”, Name = ‘fly’, ServerId = ”, Type = ‘Remote’, Function = ‘Modect’, Enabled = ‘1’, RefBlendPerc = ‘6’, AlarmRefBlendPerc = ‘6’, AnalysisFPS = ”, MaxFPS = ”, AlarmMaxFPS = ”, Device = ‘/dev/video0’, Channel = ‘0’, Format = ‘255’, Palette = ‘0’, V4LMultiBuffer = ”, V4LCapturesPerFrame = ‘1’, Protocol = ‘http’, Host = ‘192.168.1.132’, Port = ‘8080’, Method = ‘simple’, Options = ”, Path = ‘/video’, User = ”, Pass = ”, Colours = ‘3’, Width = ‘1280’, Height = ‘720’, Orientation = ‘0’, Deinterlacing = ‘0’, RTSPDescribe = ”, LabelFormat = ‘%N – %Y-%m-%d %H:%M:%S %z’, LabelX = ‘0’, LabelY = ‘0’, LabelSize = ‘1’, ImageBufferCount = ’50’, WarmupCount = ’25’, PreEventCount = ’25’, PostEventCount = ’25’, StreamReplayBuffer = ‘1000’, AlarmFrameCount = ‘1’, SignalCheckColour = ‘#0000c0’, EventPrefix = ‘Home-‘, SectionLength = ‘600’, FrameSkip = ‘0’, MotionFrameSkip = ‘0’, AnalysisUpdateDelay = ‘0’, FPSReportInterval = ‘1000’, DefaultView = ‘Events’, DefaultRate = ‘100’, DefaultScale = ‘100’, WebColour = ‘red’, Sequence = 1′

You can make changes with:

echo "sql_mode = NO_ENGINE_SUBSTITUTION" >> /etc/mysql/mysql.conf.d/mysqld.cnf

g. Reboot:

reboot

3. Make initial configuration of ZoneMinder:

  • Navigate to http://your-ip/zm. Go to options.

Transform Android into a Surveillance Camera with ZoneMinder on Ubuntu Server 16.04 - web interface

  • Go to users tab, and select admin

Transform Android into a Surveillance Camera with ZoneMinder on Ubuntu Server 16.04 - web interface - users tab

  • Secure your surveillance with an admin password.
  • Activate Authenticate user logins to ZoneMinder at system tab to keep intruders out.

Transform Android into a Surveillance Camera with ZoneMinder on Ubuntu Server 16.04 - web interface - settings

  • For dedicated recording storage, tailor the paths as required.

Transform Android into a Surveillance Camera with ZoneMinder on Ubuntu Server 16.04 - web interface - paths
 

Don’t forget to refresh ZoneMinder:

(Console — Running):

Transform Android into a Surveillance Camera with ZoneMinder on Ubuntu Server 16.04 - web interface - control

Transform Android into a Surveillance Camera with ZoneMinder on Ubuntu Server 16.04 - web interface - restart

Or:

sudo /etc/init.d/zoneminder restart

4. Integrating Your Android Device (or other camera):

  • Prepare your phone.
  • Select Add New Monitor.

Transform Android into a Surveillance Camera with ZoneMinder on Ubuntu Server 16.04 - web interface - add monitor

  • Fine-tune with Source Type — Remote and Function — Modect. (Monitor – just view, without record; modect – motion detected record; mocord – permanent record, with showcasing of motion detection; nodect – turn off built in motion detection)

Transform Android into a Surveillance Camera with ZoneMinder on Ubuntu Server 16.04 - web interface - camera settings

  • Sync your Android by setting Remote Protocol — HTTP, IP, port to 8080, and path to /video.

Transform Android into a Surveillance Camera with ZoneMinder on Ubuntu Server 16.04 - web interface - camera settings

Post-setup, a green source indicates successful configuration. Modify zones for precision in motion detection.

Transform Android into a Surveillance Camera with ZoneMinder on Ubuntu Server 16.04 - web interface - camera added

Transform Android into a Surveillance Camera with ZoneMinder on Ubuntu Server 16.04 - web interface - camera added

Transform Android into a Surveillance Camera with ZoneMinder on Ubuntu Server 16.04 - web interface - configuration of motion detection zones

With these tweaks, motion will trigger video captures. Access live feeds or past events effortlessly.

Transform Android into a Surveillance Camera with ZoneMinder on Ubuntu Server 16.04 - web interface - camera statistics

Posted on 05.09.202330.05.2024 by sanglyb

Post navigation

← How to Fix a Faulty Back Button on Fly IQ434: A Simple Guide
Ultimate Guide to Automating Video Intro Insertion: Save Time With Our Simple Script →

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Подписывайтесь

Youtube
vk
telegram
github
twitter
rss
  • Форум
  • Об авторе
  • Поддержать автора

Популярные записи

Новые записи

  • How to Extend an LVM Partition in Linux
  • SCCM Reporting Errors After Migrating from SQL Server 2016 to 2019
  • Problem Using PassFiltEx on Older CPUs
  • How to remove attachments from old calendar events in Exchange using a script
  • How to download and install Office 2024 LTSC

Архивы

  • 2026 (3)
  • 2025 (5)
  • 2024 (7)
  • 2023 (30)
  • 2022 (4)
  • 2020 (17)
  • 2017 (82)
  • 2016 (5)
© 2015-2026 www.mytechnote.ru
Использование материалов сайта возможно только с разрешения владельца или обязательна индексируемая, прямая, передающая вес ссылка на материал.