MotionEyeOS on Raspberry Pi 0 W on Raspbian


This guide is for installing MotionEyeOS on Raspberry Pi 0 W ontop of the Raspbian OS.

In a previous write up MotionEyeOS on Raspberry Pi 0 W detailed how to install MotionEyeOs using a image from MotionEye. The problem was it was ver unforgiving and not flexible.
This guide will walk you through installing it natively on Raspbian Buster.

Ensure System is up to Date

sudo apt update && sudo apt upgrade -y

Hit:1 http://archive.raspberrypi.org/debian buster InRelease
Hit:2 http://raspbian.raspberrypi.org/raspbian buster InRelease
Reading package lists… Done
Building dependency tree
Reading state information… Done
All packages are up to date.
Reading package lists… Done
Building dependency tree
Reading state information… Done
Calculating upgrade… Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Install Dependencies:

sudo apt-get install ffmpeg libmariadb3 libpq5 libmicrohttpd12 -y

Reading package lists… Done
Building dependency tree
Reading state information… Done
The following additional packages will be installed:
fontconfig fontconfig-config fonts-dejavu-core libaacs0 libaom0 libass9 libasyncns0 libavc1394-0
libavcodec58 libavdevice58 libavfilter7 libavformat58 libavresample4 libavutil56 libbdplus0
libbluray2 libbs2b0 libcaca0 libcairo2 libcdio-cdda2 libcdio-paranoia2 libcdio18 libchromaprint1
libcodec2-0.8.1 libcroco3 libdatrie1 libdc1394-22 libdrm-amdgpu1 libdrm-common libdrm-nouveau2
libdrm-radeon1 libdrm2 libfftw3-double3 libflac8 libflite1 libfontconfig1 libgdk-pixbuf2.0-0
libgdk-pixbuf2.0-bin libgdk-pixbuf2.0-common libgl1 libgl1-mesa-dri libglapi-mesa libglvnd0
libglx-mesa0 libglx0 libgme0 libgraphite2-3 libgsm1 libharfbuzz0b libice6 libiec61883-0
libjack-jackd2-0 libjbig0 liblilv-0-0 libllvm9 libmp3lame0 libmpg123-0 libmysofa0 libnorm1
libogg0 libopenal-data libopenal1 libopenjp2-7 libopenmpt0 libopus0 libpango-1.0-0
libpangocairo-1.0-0 libpangoft2-1.0-0 libpgm-5.2-0 libpixman-1-0 libpostproc55 libpulse0
libraw1394-11 librsvg2-2 librsvg2-common librubberband2 libsdl2-2.0-0 libsensors-config
libsensors5 libserd-0-0 libshine3 libsm6 libsnappy1v5 libsndfile1 libsndio7.0 libsodium23
libsord-0-0 libsoxr0 libspeex1 libsratom-0-0 libssh-gcrypt-4 libswresample3 libswscale5
libthai-data libthai0 libtheora0 libtiff5 libtwolame0 libva-drm2 libva-x11-2 libva2
libvdpau-va-gl1 libvdpau1 libvidstab1.1 libvorbis0a libvorbisenc2 libvorbisfile3 libvpx5
libwavpack1 libwayland-client0 libwayland-cursor0 libwayland-egl1 libwebp6 libwebpmux3
libx11-xcb1 libx264-155 libx265-165 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0 libxcb-present0
libxcb-render0 libxcb-shape0 libxcb-shm0 libxcb-sync1 libxcb-xfixes0 libxcursor1 libxdamage1
libxfixes3 libxi6 libxinerama1 libxkbcommon0 libxrandr2 libxrender1 libxshmfence1 libxss1
libxtst6 libxv1 libxvidcore4 libxxf86vm1 libzmq5 libzvbi-common libzvbi0 mariadb-common
mesa-va-drivers mesa-vdpau-drivers mysql-common va-driver-all vdpau-driver-all x11-common
Suggested packages:
ffmpeg-doc libbluray-bdj libfftw3-bin libfftw3-dev jackd2 libportaudio2 opus-tools pulseaudio
libraw1394-doc librsvg2-bin lm-sensors serdi sndiod sordi speex
The following NEW packages will be installed:
ffmpeg fontconfig fontconfig-config fonts-dejavu-core libaacs0 libaom0 libass9 libasyncns0
libavc1394-0 libavcodec58 libavdevice58 libavfilter7 libavformat58 libavresample4 libavutil56
libbdplus0 libbluray2 libbs2b0 libcaca0 libcairo2 libcdio-cdda2 libcdio-paranoia2 libcdio18
libchromaprint1 libcodec2-0.8.1 libcroco3 libdatrie1 libdc1394-22 libdrm-amdgpu1 libdrm-common
libdrm-nouveau2 libdrm-radeon1 libdrm2 libfftw3-double3 libflac8 libflite1 libfontconfig1
libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-bin libgdk-pixbuf2.0-common libgl1 libgl1-mesa-dri
libglapi-mesa libglvnd0 libglx-mesa0 libglx0 libgme0 libgraphite2-3 libgsm1 libharfbuzz0b libice6
libiec61883-0 libjack-jackd2-0 libjbig0 liblilv-0-0 libllvm9 libmariadb3 libmicrohttpd12
libmp3lame0 libmpg123-0 libmysofa0 libnorm1 libogg0 libopenal-data libopenal1 libopenjp2-7
libopenmpt0 libopus0 libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libpgm-5.2-0
libpixman-1-0 libpostproc55 libpq5 libpulse0 libraw1394-11 librsvg2-2 librsvg2-common
librubberband2 libsdl2-2.0-0 libsensors-config libsensors5 libserd-0-0 libshine3 libsm6
libsnappy1v5 libsndfile1 libsndio7.0 libsodium23 libsord-0-0 libsoxr0 libspeex1 libsratom-0-0
libssh-gcrypt-4 libswresample3 libswscale5 libthai-data libthai0 libtheora0 libtiff5 libtwolame0
libva-drm2 libva-x11-2 libva2 libvdpau-va-gl1 libvdpau1 libvidstab1.1 libvorbis0a libvorbisenc2
libvorbisfile3 libvpx5 libwavpack1 libwayland-client0 libwayland-cursor0 libwayland-egl1 libwebp6
libwebpmux3 libx11-xcb1 libx264-155 libx265-165 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0
libxcb-present0 libxcb-render0 libxcb-shape0 libxcb-shm0 libxcb-sync1 libxcb-xfixes0 libxcursor1
libxdamage1 libxfixes3 libxi6 libxinerama1 libxkbcommon0 libxrandr2 libxrender1 libxshmfence1
libxss1 libxtst6 libxv1 libxvidcore4 libxxf86vm1 libzmq5 libzvbi-common libzvbi0 mariadb-common
mesa-va-drivers mesa-vdpau-drivers mysql-common va-driver-all vdpau-driver-all x11-common
0 upgraded, 154 newly installed, 0 to remove and 0 not upgraded.
Need to get 69.6 MB of archives.
After this operation, 715 MB of additional disk space will be used.

Install Motion

wget https://github.com/Motion-Project/motion/releases/download/release-4.2.2/pi_buster_motion_4.2.2-1_armhf.deb

sudo dpkg -i pi_buster_motion_4.2.2-1_armhf.deb

Selecting previously unselected package motion.
(Reading database … 94579 files and directories currently installed.)
Preparing to unpack pi_buster_motion_4.2.2-1_armhf.deb …
Unpacking motion (4.2.2-1) …
Setting up motion (4.2.2-1) …
Adding group motion' (GID 116) ... Done. Warning: The home dir /var/lib/motion you specified already exists. Adding system usermotion’ (UID 110) …
Adding new user motion' (UID 110) with groupmotion’ …
The home directory /var/lib/motion' already exists. Not copying from/etc/skel’.
adduser: Warning: The home directory /var/lib/motion' does not belong to the user you are currently creating. Adding usermotion’ to group `video’ …
Adding user motion to group video
Done.
Processing triggers for systemd (241-7~deb10u3+rpi1) …
Processing triggers for man-db (2.8.5-2) …

note: Raspbian Buster comes with motion version 4.1; it is however recommended that you install version 4.2

Install the Dependencies from the Repositories:

sudo apt install python-pip python-dev libssl-dev libcurl4-openssl-dev libjpeg-dev libz-dev -y

Reading package lists… Done
Building dependency tree
Reading state information… Done
Note, selecting ‘zlib1g-dev’ instead of ‘libz-dev’
python-dev is already the newest version (2.7.16-1).
python-dev set to manually installed.
zlib1g-dev is already the newest version (1:1.2.11.dfsg-1).
zlib1g-dev set to manually installed.
python-pip is already the newest version (18.1-5+rpt1).
The following additional packages will be installed:
Libjpeg62-turbo-dev
Suggested packages:
libcurl4-doc libidn11-dev libkrb5-dev libldap2-dev librtmp-dev libssh2-1-dev libssl-doc
The following NEW packages will be installed:
libcurl4-openssl-dev libjpeg-dev libjpeg62-turbo-dev libssl-dev
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 2,186 kB of archives.
After this operation, 7,585 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y

Install MotionEye:

sudo apt install python-pillow -y

Reading package lists… Done
Building dependency tree
Reading state information… Done
Note, selecting ‘python-pil’ instead of ‘python-pillow’
The following additional packages will be installed:
libimagequant0 liblcms2-2 libwebpdemux2 python-olefile
Suggested packages:
liblcms2-utils python-pil-doc python-pil-dbg
The following NEW packages will be installed:
libimagequant0 liblcms2-2 libwebpdemux2 python-olefile python-pil
0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 630 kB of archives.
After this operation, 1,999 kB of additional disk space will be used.
Do you want to continue? [Y/n]

sudo pip install motioneye

Clone MotionEye Git Repo:


git clone https://github.com/ccrisan/motioneye.git

Cloning into ‘motioneye’…
remote: Enumerating objects: 6787, done.
remote: Total 6787 (delta 0), reused 0 (delta 0), pack-reused 6787
Receiving objects: 100% (6787/6787), 5.87 MiB | 476.00 KiB/s, done.
Resolving deltas: 100% (5059/5059), done.

Prepare the configuration directory:

sudo mkdir -p /etc/motioneye
sudo cp ./motioneye/extra/motioneye.conf.sample /etc/motioneye/motioneye.conf

Prepare the Media Directory:

sudo mkdir -p /var/lib/motioneye

Configure auto startup and start the motionEye server:

sudo cp /home/pi/motioneye/extra/motioneye.systemd-unit-local /etc/systemd/system/motioneye.service

sudo systemctl daemon-reload
sudo systemctl enable motioneye

Created symlink /etc/systemd/system/multi-user.target.wants/motioneye.service → /etc/systemd/system/motioneye.service.

sudo systemctl start motioneye

Adding The Camera:

browse to http://ip.ip.ip.ip:8765

You have not configured any camera yet. Click here to add one…

Settings>add camera…>
Camera Type: Local MMAL Camera
Camera: VideoCore Camera

Optional Firewall Exceptions:

Very Permissive:

sudo ufw allow 22/tcp comment ‘SSH-TCP-22’
sudo ufw allow 8765/tcp comment ‘MotionEye-TCP-8765’

More Restrictive:

Commands Only:

sudo apt update && sudo apt upgrade -y
sudo apt-get install ffmpeg libmariadb3 libpq5 libmicrohttpd12 -y
wget https://github.com/Motion-Project/motion/releases/download/release-4.2.2/pi_buster_motion_4.2.2-1_armhf.deb

sudo dpkg -i pi_buster_motion_4.2.2-1_armhf.deb
sudo apt install python-pip python-dev libssl-dev libcurl4-openssl-dev
libjpeg-dev libz-dev dev libjpeg-dev libz-dev