|
|
@ -0,0 +1,331 @@ |
|
|
|
Objective: To install ZM on an rpi3 with mmal support and verify it's using mmal. Evaluate. |
|
|
|
|
|
|
|
|
|
|
|
Preface: |
|
|
|
|
|
|
|
I tried before to install Devuan directly from IMG provided, and then build ffmpeg with mmal included. |
|
|
|
I don't think was necessary as we are not compiling ffmpeg, but instead using libavcodec (I know this now, but |
|
|
|
didn't at the time). |
|
|
|
|
|
|
|
In any case, if you want ZM to have mmal working you must have the libavcodec development headers that include mmal |
|
|
|
and you can confirm it by switching debug logging on zmc_m1 (if 1 is your test camera) |
|
|
|
But let's cover install steps. |
|
|
|
|
|
|
|
The goal is to: |
|
|
|
install raspbian stretch lite |
|
|
|
update |
|
|
|
install ffmpeg, verify mmal is included |
|
|
|
|
|
|
|
if it does, then install git of zm |
|
|
|
|
|
|
|
compile zm, from a more recent branch that includes the Hardware peripheral calls (HWACCEL) |
|
|
|
|
|
|
|
migrate to devuan (this ended up being required for my setup, as the docker entrypoint.sh doesn't run with zmsystemctl) |
|
|
|
|
|
|
|
|
|
|
|
it's important to migrate to devuan after installing ffmpeg, as i think the raspbian mirrors are supposed |
|
|
|
to have support for mmal in ffmpeg but the devuan mirrors may not. Devuan pulls from debian, not Raspbian. |
|
|
|
|
|
|
|
Don't bother trying to custom compile ffmpeg, as I mentioned before, you need libavcodec, not ffmpeg. |
|
|
|
|
|
|
|
|
|
|
|
OK, now to install ZM from git... |
|
|
|
|
|
|
|
git clone https://github.com/zoneminder/zoneminder.git |
|
|
|
|
|
|
|
also this dockerfile has instructions for building a |
|
|
|
ubuntu |
|
|
|
img. That might work... |
|
|
|
https://github.com/ZoneMinder/zmdockerfiles/blob/master/development/ubuntu/xenial/Dockerfile |
|
|
|
|
|
|
|
the only changes we will make is: |
|
|
|
remove libjpeg-turbo8 |
|
|
|
remove libjpeg-turbo8-dev |
|
|
|
remove libmysqlclient-dev |
|
|
|
remove libmime-perl |
|
|
|
from list |
|
|
|
|
|
|
|
as they are named differently. We'll add them back in later. |
|
|
|
|
|
|
|
also removing the no depends... |
|
|
|
so |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
apt-get update |
|
|
|
apt-get dist-upgrade |
|
|
|
then |
|
|
|
|
|
|
|
the command I'll run (similar to docker file) |
|
|
|
is |
|
|
|
|
|
|
|
apt-get install -y \ |
|
|
|
apache2 \ |
|
|
|
build-essential \ |
|
|
|
cmake \ |
|
|
|
dh-autoreconf \ |
|
|
|
dpatch \ |
|
|
|
git \ |
|
|
|
libapache2-mod-php \ |
|
|
|
libarchive-zip-perl \ |
|
|
|
libavcodec-dev \ |
|
|
|
libavdevice-dev \ |
|
|
|
libavfilter-dev \ |
|
|
|
libavformat-dev \ |
|
|
|
libavresample-dev \ |
|
|
|
libav-tools \ |
|
|
|
libavutil-dev \ |
|
|
|
libbz2-dev \ |
|
|
|
libcurl4-gnutls-dev \ |
|
|
|
libdate-manip-perl \ |
|
|
|
libdbd-mysql-perl \ |
|
|
|
libdbi-perl \ |
|
|
|
libdevice-serialport-perl \ |
|
|
|
libgcrypt-dev \ |
|
|
|
libgnutls-openssl-dev \ |
|
|
|
libmime-lite-perl \ |
|
|
|
libmp4v2-dev \ |
|
|
|
libnet-sftp-foreign-perl \ |
|
|
|
libnetpbm10-dev \ |
|
|
|
libpcre3 \ |
|
|
|
libpcre3-dev \ |
|
|
|
libpolkit-gobject-1-dev \ |
|
|
|
libpostproc-dev \ |
|
|
|
libssl-dev \ |
|
|
|
libswscale-dev \ |
|
|
|
libsys-cpu-perl \ |
|
|
|
libsys-meminfo-perl \ |
|
|
|
libsys-mmap-perl \ |
|
|
|
libtheora-dev \ |
|
|
|
libtool \ |
|
|
|
libv4l-dev \ |
|
|
|
libvlc5 \ |
|
|
|
libvlccore8 \ |
|
|
|
libvlccore-dev \ |
|
|
|
libvlc-dev \ |
|
|
|
libvorbis-dev \ |
|
|
|
libvpx-dev \ |
|
|
|
libwww-perl \ |
|
|
|
libx264-dev \ |
|
|
|
mysql-client \ |
|
|
|
mysql-server \ |
|
|
|
php \ |
|
|
|
php-cli \ |
|
|
|
php-gd \ |
|
|
|
php-mysql \ |
|
|
|
ssmtp \ |
|
|
|
software-properties-common \ |
|
|
|
vlc-data \ |
|
|
|
yasm \ |
|
|
|
zip |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
hopefully that finishes without any errors. |
|
|
|
I had dpkg stall halfway through, but that was because I forgot to resize the fs when originally using the Devuan img. |
|
|
|
With the raspbian img, I think it might auto resize the FS. |
|
|
|
I reinstalled at that point. easy enough. |
|
|
|
and it went through without error. |
|
|
|
|
|
|
|
The four libraries we had to remove |
|
|
|
we will now add back in |
|
|
|
|
|
|
|
libturbojpeg0 - TurboJPEG runtime library - SIMD optimized |
|
|
|
libturbojpeg0-dev - Development files for the TurboJPEG library |
|
|
|
default-libmysqlclient-dev - MySQL database development files (metapackage) |
|
|
|
libmariadbclient-dev-compat - MariaDB database development files (libmysqlclient compatibility) |
|
|
|
|
|
|
|
libmime-base32-perl - Base32 encoder/decoder |
|
|
|
libmime-base64-urlsafe-perl - Perl version of Python's URL-safe base64 codec |
|
|
|
libmime-charset-perl - module for MIME character set information |
|
|
|
libmime-encwords-perl - Perl interface to deal with RFC 2047 encoded words |
|
|
|
libmime-explode-perl - Perl extension to explode MIME messages |
|
|
|
libmime-lite-html-perl - Transform HTML page into MIME email |
|
|
|
libmime-lite-perl - module for convenient MIME message creation |
|
|
|
libmime-lite-tt-html-perl - module to create HTML mail with MIME::Lite and T |
|
|
|
T |
|
|
|
libmime-lite-tt-perl - module to generate MIME messages from Template Toolki |
|
|
|
t templates |
|
|
|
libmime-tools-perl - Perl5 modules for MIME-compliant messages |
|
|
|
libmime-types-perl - Perl extension for determining MIME types and Transfer |
|
|
|
Encoding |
|
|
|
libemail-mime-perl |
|
|
|
|
|
|
|
|
|
|
|
probably a few extra here we don't need, but regardless... |
|
|
|
|
|
|
|
so |
|
|
|
|
|
|
|
apt-get install libturbojpeg0 libturbojpeg0-dev default-libmysqlclient-dev \ |
|
|
|
libmariadbclient-dev-compat libmime-base32-perl libmime-base64-urlsafe-perl \ |
|
|
|
libmime-charset-perl libmime-encwords-perl libmime-explode-perl libmime-lite-html-perl \ |
|
|
|
libmime-lite-perl libmime-lite-tt-html-perl libmime-lite-tt-perl libmime-tools-perl \ |
|
|
|
libmime-types-perl libemail-mime-perl |
|
|
|
|
|
|
|
|
|
|
|
then follow the docker guide: |
|
|
|
git clone --recursive https://github.com/ZoneMinder/ZoneMinder |
|
|
|
cd ZoneMinder |
|
|
|
|
|
|
|
If you want a certain tagged or commit of ZM now's the time to git checkout |
|
|
|
e.g. I am doing |
|
|
|
git checkout f07b1105d33c088cce4130970ee2f776867f67d0 |
|
|
|
just so I'm always using the same commit. |
|
|
|
|
|
|
|
then |
|
|
|
|
|
|
|
cmake . |
|
|
|
|
|
|
|
this comes up with a jpeg error... |
|
|
|
|
|
|
|
that is explained here: |
|
|
|
in CMakeLists.txt |
|
|
|
// |
|
|
|
# jpeg |
|
|
|
find_package(JPEG) |
|
|
|
if(JPEG_FOUND) |
|
|
|
set(HAVE_LIBJPEG 1) |
|
|
|
list(APPEND ZM_BIN_LIBS "${JPEG_LIBRARIES}") |
|
|
|
#link_directories(${JPEG_LIBRARY}) |
|
|
|
include_directories("${JPEG_INCLUDE_DIR}") |
|
|
|
set(CMAKE_REQUIRED_INCLUDES "${JPEG_INCLUDE_DIR}") |
|
|
|
check_include_files("stdio.h;jpeglib.h" HAVE_JPEGLIB_H) |
|
|
|
if(NOT HAVE_JPEGLIB_H) |
|
|
|
message(FATAL_ERROR |
|
|
|
"ZoneMinder requires libjpeg headers - check that libjpeg development |
|
|
|
packages are installed") |
|
|
|
endif(NOT HAVE_JPEGLIB_H) |
|
|
|
else(JPEG_FOUND) |
|
|
|
message(FATAL_ERROR |
|
|
|
"ZoneMinder requires jpeg but it was not found on your system") |
|
|
|
endif(JPEG_FOUND) |
|
|
|
|
|
|
|
// |
|
|
|
/usr/lib/aarch64-linux-gnu/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
so do this. |
|
|
|
|
|
|
|
apt-get install libjpeg-dev libjpeg62-turbo-dev libjpeg62-turbo libjpeg-turbo-progs |
|
|
|
|
|
|
|
|
|
|
|
one of those will handle jpeg |
|
|
|
|
|
|
|
NOTE: we might be losing turbo jpeg support, with libjpeg, so beware this is not |
|
|
|
optimized for MJPEG... I only plan to use this for RTSP H264 streams, (whole point of this) |
|
|
|
so your needs may vary. |
|
|
|
|
|
|
|
# Configure ZoneMinder |
|
|
|
RUN cmake . |
|
|
|
|
|
|
|
# Build & install ZoneMinder |
|
|
|
RUN make && make install |
|
|
|
|
|
|
|
# ensure writable folders |
|
|
|
RUN ./zmlinkcontent.sh |
|
|
|
|
|
|
|
this all worked, no problem. Devuan ascii. |
|
|
|
|
|
|
|
I skipped the volumes part, as we are not using docker. |
|
|
|
|
|
|
|
service mysql stop && service apache2 stop |
|
|
|
|
|
|
|
|
|
|
|
# Configure Apache |
|
|
|
cp misc/apache.conf /etc/apache2/sites-available/000-default.conf |
|
|
|
echo "ServerName localhost" > /etc/apache2/conf-available/servername.conf && a2enconf -q |
|
|
|
servername |
|
|
|
a2enmod -q cgi && a2enmod -q rewrite |
|
|
|
|
|
|
|
|
|
|
|
This came up with an error for rewite.. |
|
|
|
// |
|
|
|
AH00526: Syntax error on line 62 of /etc/apache2/sites-enabled/000-default.conf: |
|
|
|
Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in |
|
|
|
the server configuration |
|
|
|
// |
|
|
|
|
|
|
|
It can be ignored, as we hadn't enabled module rewrite when that loaded. |
|
|
|
|
|
|
|
echo "sql_mode=NO_ENGINE_SUBSTITUTION" >> /etc/mysql/mysql.conf.d/mysqld.cnf |
|
|
|
|
|
|
|
|
|
|
|
this fails, but you can change /etc/mysql/mysql.conf.d/mysqld.cnf |
|
|
|
to |
|
|
|
/etc/mysql/my.cnf |
|
|
|
|
|
|
|
|
|
|
|
We have ZM, but not init scripts. |
|
|
|
Since we are testing, here. Let's just use the dockerfile's entrypoint.sh |
|
|
|
That works just as well, as an init script. |
|
|
|
wget https://raw.githubusercontent.com/ZoneMinder/zmdockerfiles/master/utils/entrypoint.sh |
|
|
|
|
|
|
|
root@devuan:~# mv entrypoint.sh /usr/local/bin/. |
|
|
|
root@devuan:~# chmod 755 /usr/local/bin/entrypoint.sh |
|
|
|
root@devuan:~# |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
now run |
|
|
|
/usr/local/bin/entrypoint.sh |
|
|
|
I sometimes run it in a screen session |
|
|
|
apt-get install screen |
|
|
|
# screen |
|
|
|
type |
|
|
|
ctrl-a :sessionname entrypoint |
|
|
|
ctrl-d to disconnect |
|
|
|
|
|
|
|
|
|
|
|
root@devuan:~# /usr/local/bin/entrypoint.sh |
|
|
|
|
|
|
|
mysql: unknown variable 'sql_mode=NO_ENGINE_SUBSTITUTION' |
|
|
|
* Removing stale lock file |
|
|
|
* Starting MySQL database server service ...done. |
|
|
|
* Warning: Mysql startup timer expired! |
|
|
|
mysql: unknown variable 'sql_mode=NO_ENGINE_SUBSTITUTION' |
|
|
|
* First run of mysql in the container, creating ZoneMinder dB. |
|
|
|
mysql: unknown variable 'sql_mode=NO_ENGINE_SUBSTITUTION' |
|
|
|
* Starting Apache http web server service ...done. |
|
|
|
* Starting ZoneMinder video surveillance recorder ...failed! |
|
|
|
|
|
|
|
|
|
|
|
// |
|
|
|
|
|
|
|
this fails, but we are close. |
|
|
|
|
|
|
|
The error I had made before was accidentally following the docker exactly. |
|
|
|
It added the 'sql_mode=NO_ENGINE_SUBSTITUTION' to my.cnf |
|
|
|
and my.cnf didn't understand it. |
|
|
|
|
|
|
|
So simply comment that out, if you added that by accident. |
|
|
|
|
|
|
|
when you run entrypoint you should see |
|
|
|
|
|
|
|
root@devuan:~# /usr/local/bin/entrypoint.sh |
|
|
|
|
|
|
|
* Removing stale lock file |
|
|
|
* MySQL database server already running. |
|
|
|
* First run of mysql in the container, creating ZoneMinder dB. |
|
|
|
* Starting Apache http web server service ...done. |
|
|
|
* Starting ZoneMinder video surveillance recorder ...done. |
|
|
|
|
|
|
|
And that tells us everything is working. |
|
|
|
If you go to ZM at the IP address, you should see it "Running". If you see it stopped, and you still have |
|
|
|
raspbian... read below. |
|
|
|
|
|
|
|
|
|
|
|
NOW, one problem I had is that when I was testing this is raspbian, it tried to call zmsystemctl |
|
|
|
which failed to actually run ZM. |
|
|
|
|
|
|
|
At this point I migrated to Devuan, following the dev1fanboy ascii migration guide (this is what I did) |
|
|
|
* add devuan repos to apt/sources |
|
|
|
* apt-get install sysvinit-core |
|
|
|
* make sure /etc/inittab is there and has init data |
|
|
|
* reboot |
|
|
|
|
|
|
|
And then running the entrypoint.sh didn't try to call zmsystemctl, and it worked. |
|
|
|
|
|
|
|
Now follow the next guide for details about my testing with mmal and a camera. |