Note that this was the result of an install of 22.04 upgraded to 24.04 so it may not be perfect.
NOTE: This did not set up the 2 drives the same way, so the data is redundant, but we can't boot off the second drive. Needs a rebuild, likely when I move to new hardware which can process more streams more efficiently.
-
Install Ubuntu server as normal from an Ubuntu server install CD. I selected the minimal option for a headless server.
Partition as follows, for both disks - which we're going to RAID.
-
/
boot
- 1GB (physical RAID) -
rest (physical RAID)
-
Make this RAID LVM, partitioned as follows:
/ - 100GB /tmp - 50GB /var - 100GB swap - 10GB /home - rest
-
When it asks for what to install, install "OpenSSH server" and leave everything else blank.
Networking is already set up with a reserved DHCP lease on the router. It is accessible as
cameras
. No need for a static IP. -
-
After machine is up, edit
/etc/apt/sources.list
and make sure the following are enabled:Suites: noble noble-updates noble-backports Components: main restricted universe multiverse Suites: noble-security Components: main restricted universe multiverse
(they were after install for me)
-
Make sure all is up to date.
sudo apt update sudo apt dist-upgrade
-
Install more useful things
sudo apt install net-tools tree atop nmap iotop emacs emacs-goodies-el elpa-go-mode elpa-rust-mode elpa-f elpa-let-alist elpa-markdown-mode elpa-yaml-mode elpa-flycheck lm-sensors ntp ssmtp gdisk git gitk iftop mailutils ppa-purge xsltproc smartmontools
-
Add any necessary user accounts
-
Set the timezone, if necessary:
sudo timedatectl set-timezone America/New_York
-
Make ssh work:
-
For an old machine, use the old keys - you did save /etc, didn't you?
-
For a new machine, use the new keys generated by the distro.
-
make sure to add to the firewall
sudo ufw allow ssh
-
edit
/etc/ssh/sshd_config
and set:PermitRootLogin no
-
once you've set up public key auth, turn off password access - edit
/etc/ssh/sshd_config
and setPasswordAuthentication no
-
restart ssh to apply changes
sudo service ssh restart
-
-
-
Enable firewall, bit first, disable firewally logging (it can be quite verbose on a busy network), then turn on the firewall.
sudo ufw logging off sudo ufw enable
-
Set up sensors for ASUS i7 board (I forget the model)
add the following to /etc/modules:
coretemp i5500_temp w83627ehf
-
Set up ssmtp
cd /etc/ssmtp mv ssmtp.conf ssmtp.conf.old cp ~/system_stuff/ssmtp/ssmtp.conf . chgrp mail ssmtp.conf
-
Add monitoring (sortof):
make sure landscape is installed (to get landscape-sysinfo):
sudo apt install landscape-common
Then add the following to my crontab:
@daily /usr/bin/ntpq -p; echo; df -lh; echo; cat /proc/mdstat; landscape-sysinfo
-
Refs:
-
Install deps:
sudo apt-get install tasksel sudo tasksel install web-server
-
Add the PPA and do the basic install (TODO - this will eventually officially be released and we should change the PPA accordingly to get off the bleeding edge):
sudo add-apt-repository ppa:iconnor/zoneminder-proposed sudo apt install zoneminder
-
Fix some perms and ownership:
sudo chmod 740 /etc/zm/zm.conf sudo chown root:www-data /etc/zm/zm.conf sudo chown -R www-data:www-data /usr/share/zoneminder/
-
Enable apache modules Zoneminder config:
sudo a2enmod cgi sudo a2enmod rewrite sudo a2enmod expires sudo a2enmod headers sudo a2enmod php8.3 sudo a2enconf zoneminder sudo systemctl reload apache2
-
Let it through the firewall
sudo ufw allow http
-
Enable and start zoneminder:
sudo systemctl enable zoneminder sudo systemctl start zoneminder
-
Reload apache:
sudo systemctl reload apache2
-
Going to http://cameras/zm should now work.
This is all under Options
All changes noted are from the defaults.
-
System:
- LANG_DEFAULT =
en_us
- DATE_FORMAT_PATTERN =
yyyyMMdd
- TODO - enable logins
- OPT_USE_LEGACY_API_AUTH = unchecked
- Because it's a new installation
- TIMEZONE =
(GMT-05:00) America, New York
- OPT_CONTROL = unchecked
- Because we don't have any PTZ cameras.
- TODO - OPT_TRIGGERS will be handy for SMTP uploads + triggers
- CHECK_FOR_UPDATES = unchecked
- Redundant with the package manager having updates.
- LANG_DEFAULT =
-
API
- TODO - Per-user API is going to be useful.
-
Email
- TODO - Various notifications here may be useful.
-
Users
- TODO - Add users, then enable authentication.
-
Because the server is set up with most of the space in
/home
:sudo mkdir /home/zm-storage
sudo chown www-data:www-data /home/zm-storage
- Then go in and add it in Options->Storage. I called mine
Bulk Storage
. - Do not delete the default storage It's still the default. We'll just set up cameras to not use it anymore.
So Reolink wireless cameras work.
I did this on my desktop, not the server. Since both run the same OS and it's a (mostly) statically compiled rust binary, I just plan to copy it over from dev box to server.
-
Clone it from its repo:
git clone https://github.com/thirtythreeforty/neolink.git
-
Make sure rust and cargo are updated:
rustup update
-
Make sure dependencies are installed (this is non-exhaustive, these are just the ones I had to add)
sudo apt install libgstreamer1.0-dev libgstreamer-plugins-bad1.0-dev libgstreamer-plugins-good1.0-dev libgstrtspserver-1.0-dev
-
Then one can build it successfully with:
cargo build
-
Install dependencies:
sudo apt install libgstrtspserver-1.0-0 libgstreamer1.0-0 libgstreamer-plugins-bad1.0-0 gstreamer1.0-plugins-good gstreamer1.0-plugins-bad
-
Copy the binary over to the server.
-
Copy over the
sample_config.toml
(I called itneolink_config.toml
) and adjust as follows:-
Set
bind
to 127.0.0.1, because we don't need anyone other than this server to be able to get those streams. -
Because it's localhost access only, we're not going to bother with credentials or encryption, as there's little point when it's two daemons talking to each other across the same system bus.
-
The cameras have limited user functionality, so their username is always
admin
. The password is saved in Keepass.
-
-
Create a config section for each camera (see below).
-
Set it up to start on boot
-
Connect it to power and network, let it boot up, then go to the router to see what MAC is has. Give it a static IP assignment on the router and reboot it. It should be at the new IP.
-
Go to https:// and login. Default username is admin with no password.
-
Configure the camera however. You like. Of note:
- https://support.reolink.com/hc/en-us/articles/360005238413-The-Difference-Between-Clear-Fluent-and-Balanced explains the difference between the different streams.
-
Other settings to change on the camera from defaults:
- Camera:
- Display:
- Camera Name: Hide
- Date & Time: Hide
- Watermark: Off
- Anti-flicker: 60Hz
- Stream
- Set the Clear resolution to
2304*1296
- Anything HD and better is good enough, and the more pixels, the more disk usage and CPU needed for processing.
- Turning down the FPS is also a good way to save CPU time - 15 and over are good enough.
- Set the Clear resolution to
- Audio and Light
- Record Audio: On
- Info
- Set the name
- Display:
- Surveillance:
- Record:
- Record: Off
- Email:
- Enable Email Alerts: Off
- FTP:
- Enable FTP: Off
- Push:
- Disable Push
- Record:
- Network Settings -> Advanced drop down:
- Enable UID: Off
- We use this for the battery cameras, but not this type.
- Port Settings click "Set Up"
- RTSP: On
- ONVIF: Off
- ONVIF autodiscovery didn't work, and I'm not going to mess with it right now. Might turn it on later.
- Enable UID: Off
- System:
- Maintenance:
- Auto Reboot: Off
- User Management:
- Set the admin password.
- Add another normal user for zoneminder.
- Note that the password for the zoneminder user is passed in a URL, so can't contain special characters.
- I saved both of these in Keepass.
- Maintenance:
- Camera:
- Add the camera in Zoneminder as follows (only non-default values are noted):
- General:
- Function: Modect
- Reference Image Blend: 12.5% (Outdoor)
- Alarm Reference Image Blend: 12.5%
- Source:
- Source Path: rtsp://user:pass@hostname/h264Preview_01_main and replace hostname, user and pass appropriately.
- Method: UDP
- Capture Resolution 2560 x 1920 (Custom)
- Storage:
- Storage Area: Bulk Storage
- Video Writer: Camera Passthrough
- Tick the box to store audio too
- Timestamp
- Timestamp Label Format =
%N - %Y%m%d %I:%M:%S %p
- Font Size =
Extra Large
- Timestamp Label Format =
- General:
-
This is a battery powered camera.
-
The only way I could figure out to do initial setup is with the app - this gets it connected to the network.
-
It only works via the Neolink RTSP bridge software (see above).
-
References: https://github.com/thirtythreeforty/neolink
-
Set up the camera using the app - follow the voice prompts, scan the barcode, etc.
-
Once it's connected to the router, you can set the static DHCP reservation and DNS - though we won't actually use it.
-
In the app, configure it as follows (these are changes from default)
- Under Display:
- Camera Name: Hide
- Date: Hide
- Watermark: Off
- Camera Recording: Off
- There is no SD card.
- Email Alerts: Off
- Under Display:
-
In the neolink config, add a section like this:
[[cameras]] name = "batterycamera1" username = "admin" password = "something super secret" uid = "ABCD01234567890EFG" stream = "mainStream"
Name should match what is set in the camera (but is probably not strictly
necessary), username is always admin, password is what we set it to, and uid
can be gotten from Device Info (which shows up if you tap on the gear icon
and then the camera's name). stream can be either mainStream
(which is
the HD stream) or subStream
(which is the low res stream).
- Add the camera in Zoneminder as follows (only non-default values are noted):
- General:
- Function: Modect
- Reference Image Blend: 12.5% (Outdoor)
- Alarm Reference Image Blend: 12.5%
- Source:
- Source Path: rtsp://localhost:8554/camera-name replace camera-name with the camera name
- Method: UDP
- Capture Resolution 1080p
- Storage:
- Storage Area: Bulk Storage
- Video Writer: Camera Passthrough
- Tick the box to store audio too
- Timestamp
- Timestamp Label Format =
%N - %Y%m%d %I:%M:%S %p
- Font Size =
Extra Large
- Timestamp Label Format =
- General: