This article describes the process of creating custom Server distributions for Linux Operating Systems that are not officially supported.
This is done by making some modifications to the official Server update archives.
The following platforms can be modified:
- x64 (i.e. Kubuntu, Red Hat, CentOS etc)
- ARM 32- and 64-bit (i.e. Banana Pi, Orange Pi, Firefly RK3399 etc)
- Custom Edge devices (cameras running Server onboard).
Note that systems with servers with unsupported variants/flavors will not be able to use our official update servers to upgrade to newer versions using the 1-click upgrade feature. You will still be able to serve your own updates manually or via a Custom Update Server (see “Distributing Custom System Components through 1-Click Updates”).
For this purpose, it is necessary to:
- download the original update package
- unpack and modify the contents according to your needs
- pack it back
- sign the modified package
- put the modified content to the Update Server
Obtaining a Server Package for the Desired OS
The original server update packages are stored in zip archives and can be downloaded via the following links:
https://updates.networkoptix.com/<brand>/<version>/<brand>-server_update-<version>-<platform>.zip
- brand - the name of the server OEM (nxwitness for Nx Witness, metavms for Nx Meta or another OEM name)
- version - Server version and build number (X.Y.Z.ABCDE)
- platform: linux_x64, linux_arm64, or linux_arm32.
Further, as an example we will be using the file metavms-server_update-5.0.0.35744-linux_x64.zip which can be downloaded from the following URL:
If you need to modify server packages of other OEM partners, they can be found at the “For Developers” section on the corresponding Cloud Portal or by contacting the OEM partner directly.
Modifying Update Package
Server Update Package Naming and Structure
The naming structure of the server update package is the following:
<brand>-server_update-<version>-<platform>.zip
I.e. metavms-server_update-5.0.0.35744-linux_x64.zip
The server update contains the following:
- <brand>-server_update-<version>-<platform>-<beta>.deb - DEB package of the server for the corresponding platform (the <beta> part is optional)
- package.json - package descriptor (explained below)
- update.json - legacy package descriptor (explained below)
- install.sh - update script that is invoked in background once 1-click update is initiated. It stops the server, installs the DEB package and runs the updated version.
Unpacking Server Package
- Download the package
cd ~/Downloads
wget https://updates.networkoptix.com/metavms/5.0.0.35744%20R12/metavms-server_update-5.0.0.35744-linux_x64.zip
- Unzip the package to a subdirectory:
mkdir custom-zip
unzip metavms-server_update-5.0.0.35744-linux_x64.zip -d ./custom-zip
cd custom-zip
- unpack the DEB package:
dpkg -x metavms-server-5.0.0.35744-linux_x64.deb ./custom_deb
The contents will be written to the ~/Downloads/custom-zip/custom_deb subdirectory.
- Extract the Control File:
4.1. Create a subfolder named DEBIAN (case-sensitive):
mkdir -p ./custom_deb/DEBIAN
4.2. Extract the control file to this subfolder:
dpkg --control metavms-server-5.0.0.35744-linux_x64.deb ./custom_deb/DEBIAN
- Remove the original DEB package:
rm metavms-server-5.0.0.35744-linux_x64.deb
Customizing Server Package
After the server package is unpacked, it is possible to customize it. Customization may include different actions like:
- Changing the directory structure and installation paths depending on a target device
- Modifying startup scripts for another Linux-based OS.
To perform such actions it is necessary to have a deep knowledge of target OS and/or device so this section will describe only the basics.
To be able to distinguish the target device/OS from others, the special so-called OS Variant property is used.
When Server is running, it reads this property from a configuration file and reports to the Desktop Client and other Servers in the system.
Once the 1-click update is initiated in the Desktop Client, it looks for the update package with the same OS variant on the update server.
Thus, such property should be set in the following places:
- Server configuration can be modified by adding the currentOsVariantOverride property to the /opt/<company>-<brand>/mediaserver/etc/mediaserver.conf file.
Once the server is installed and run at the first time, this file is automatically created and filled with the default values.
To update the file in the distribution, it is necessary to add your custom OS Variant name to the mediaserver.conf file (we will use kubuntu as an example):
echo currentOsVariantOverride=kubuntu >> ./custom_deb/opt/networkoptix-metavms/mediaserver/etc/mediaserver.conf
- Server update descriptor can be modified by editing the package descriptor package.json. Change value in the following string:
"variants": [{ "name": "ubuntu", "minimumVersion": "16.04" }],
Change “ubuntu” to the corresponding value ("kubuntu" as an example).
Finally, it is possible to modify the install.sh script which will install the server and perform custom actions before and after installation.
Attention! If the property is set incorrectly and not applied, Server will report the default OS (Ubuntu) and will be overwritten by a standard Ubuntu Server after a next upgrade! Make sure Server reports the correct OS (see “Checking Server OS Variant”).
Repackaging Server Deb
After all the modifications are done, it is necessary to pack back the update package with the changes made. The following instructions describe how to produce a DEB package for Ubuntu Linux. Packages for other Linux variants (i.e. RPM) can be produced as well, but require deeper OS knowledge and is not covered here.
- Repack the DEB:
dpkg-deb --build ./custom_deb ./metavms-server-5.0.0.35744-kubuntu_x64.deb
- Pack the created DEB along with package.json and install.sh into a zip archive:
zip metavms-server-5.0.0.35744-kubuntu_x64.zip metavms-server_update-5.0.0.35744-kubuntu_x64.deb package.json install.sh
Checking Server OS Variant
After the DEB package is customized, it is recommended to ensure that Server reports the correct OS variant to the Desktop Client.
To do this, install the modified Server DEB package
dpkg -i ./metavms-server-5.0.0.35744-kubuntu_x64.deb
and run the following API request:
https://<server_ip>:<server_port>/ec2/getMediaServers
I.e. https://127.0.0.1:7001/ec2/getMediaServers
The following should be displayed:
[
{
"authKey": "",
...
"osInfo": "{\"platform\":\"linux_x64\",\"variant\":\"kubuntu\",\"variantVersion\":\"18.04\"}",
...
"version": "5.0.0.35744"
}
]
Note the string that contains "variant\":\"kubuntu\". This means the server reports the proper custom OS variant.
Signing Server Package
To ensure the integrity of the update package, it needs to be signed.
The detailed information will be provided soon.
Distributing Custom Server Packages
Once created, the following packages should be distributed:
- DEB (metavms-server-5.0.0.35744-kubuntu_x64.deb) - for the initial installations
- ZIP (metavms-server-5.0.0.35744-kubuntu_x64.zip) - to be published on a custom update server
See “Distributing Custom System Components through 1-Click Updates” for the detailed information.
Comments
0 comments
Please sign in to leave a comment.