Install latest checkmk release automatically

Add inst_checkmk to functions.sh, which resolves the release from
https://download.checkmk.com/stable_downloads.json, downloads the package
for the container's Debian release and verifies its SHA256 checksum.

CMK_VERSION now accepts:
- empty: latest stable release
- 2.4 / 2.4.0: latest patch release of a branch
- 2.4.0p18: exactly this release (no checksum available)

Package file names are taken from the JSON, so the rename from
check-mk-raw to check-mk-community in 2.5 is handled transparently.
Legacy edition names (raw, enterprise, cloud, managed) are still accepted.
CMK_BUILD is no longer needed.

checkmk now installs the latest stable release, bashclub-cmk stays on
the latest 2.4 patch release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Thorsten Spille
2026-10-05 12:10:17 +02:00
co-authored by Claude Opus 5.5
parent c46d8fe68d
commit 545bb08f9b
7 changed files with 75 additions and 23 deletions
+6 -4
View File
@@ -249,11 +249,13 @@ CMK_ADMIN_PW='Start!123'
```
### CMK_EDITION
checkmk edition (raw or free)
- raw = completely free
- free = limited version of the enterprise edition (25 hosts, 1 instance)
checkmk edition (community, pro, ultimate or ultimatemt), the latest release will be installed
- community = completely free (formerly raw, which is still accepted)
- pro, ultimate, ultimatemt = commercial editions (formerly enterprise, cloud, managed)
The version can be pinned with `CMK_VERSION` in `src/checkmk/constants-service.conf` (empty = latest stable release, `2.4` = latest patch release of a branch, `2.4.0p18` = exactly this release).
```bash
CMK_EDITION=raw
CMK_EDITION=community
```
### Kopano-Section
+4 -4
View File
@@ -160,10 +160,10 @@ CMK_INSTANCE=zmbrocks
# Define the password of user 'cmkadmin'
CMK_ADMIN_PW='Start!123'
# checkmk edition (raw or free)
# raw = completely free
# free = limited version of the enterprise edition (25 hosts, 1 instance)
CMK_EDITION=raw
# checkmk edition (community, pro, ultimate or ultimatemt), the latest release will be installed
# community = completely free (formerly raw, which is still accepted)
# pro, ultimate, ultimatemt = commercial editions (formerly enterprise, cloud, managed)
CMK_EDITION=community
############### vaultwarden Section ###############
+2 -4
View File
@@ -27,10 +27,8 @@ LXC_NESTING="1"
# enable keyctl feature
LXC_KEYCTL="0"
# checkmk version
CMK_VERSION=2.4.0p19
# build number of the debian package (needs to start with underscore)
CMK_BUILD=_0
# checkmk version (empty = latest stable release, 2.4 = latest patch release of a branch, 2.4.0p18 = exactly this release)
CMK_VERSION="2.4"
# Sets the minimum amount of RAM the service needs for operation
LXC_MEM_MIN=2048
+1 -3
View File
@@ -15,9 +15,7 @@ wget -O - https://apt.bashclub.org/gpg/bashclub.pub | gpg --dearmor > /usr/share
echo "deb [signed-by=/usr/share/keyrings/bashclub-keyring.gpg] https://apt.bashclub.org/testing $(lsb_release -cs) main" > /etc/apt/sources.list.d/bashclub.list
apt update
cd /tmp
wget https://download.checkmk.com/checkmk/$CMK_VERSION/check-mk-$CMK_EDITION-$CMK_VERSION$CMK_BUILD.$(lsb_release -cs)_amd64.deb
DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt -y -qq install ./check-mk-$CMK_EDITION-$CMK_VERSION$CMK_BUILD.$(lsb_release -cs)_amd64.deb
inst_checkmk "$CMK_EDITION" "$CMK_VERSION"
omd create --admin-password $CMK_ADMIN_PW $CMK_INSTANCE
cat << EOF > /etc/apache2/sites-available/000-default.conf
+2 -4
View File
@@ -27,10 +27,8 @@ LXC_NESTING="1"
# enable keyctl feature
LXC_KEYCTL="0"
# checkmk version
CMK_VERSION=2.4.0p18
# build number of the debian package (needs to start with underscore)
CMK_BUILD=_0
# checkmk version (empty = latest stable release, 2.4 = latest patch release of a branch, 2.4.0p18 = exactly this release)
CMK_VERSION=""
# Sets the minimum amount of RAM the service needs for operation
LXC_MEM_MIN=2048
+1 -3
View File
@@ -11,9 +11,7 @@ source /root/functions.sh
source /root/zamba.conf
source /root/constants-service.conf
cd /tmp
wget https://download.checkmk.com/checkmk/$CMK_VERSION/check-mk-$CMK_EDITION-$CMK_VERSION$CMK_BUILD.$(lsb_release -cs)_amd64.deb
DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt -y -qq install ./check-mk-$CMK_EDITION-$CMK_VERSION$CMK_BUILD.$(lsb_release -cs)_amd64.deb
inst_checkmk "$CMK_EDITION" "$CMK_VERSION"
omd create --admin-password $CMK_ADMIN_PW $CMK_INSTANCE
+58
View File
@@ -133,3 +133,61 @@ inst_bashclub() {
apt_repo "bashclub-$BASHCLUB_COMPONENT" "https://apt.bashclub.org/gpg/bashclub.pub" "https://apt.bashclub.org/$BASHCLUB_COMPONENT" "$(lsb_release -cs)" "main"
apt update
}
#### Download and install Checkmk ####
# First parameter is the edition (community, pro, ultimate, ultimatemt - legacy names like raw are accepted)
# Second parameter is the version (optional):
# empty = latest stable release
# 2.4 / 2.4.0 = latest patch release of branch 2.4.0
# 2.4.0p18 = exactly this release (checksum is only available for the latest patch release of a branch)
inst_checkmk() {
local cmk_edition cmk_version cmk_branch cmk_os cmk_release cmk_latest cmk_file cmk_sha256
case "${1}" in
raw|cre|community) cmk_edition=community ;;
enterprise|cee|pro) cmk_edition=pro ;;
cloud|cce|ultimate) cmk_edition=ultimate ;;
managed|cme|ultimatemt) cmk_edition=ultimatemt ;;
*) echo "❌ Unknown checkmk edition '${1}'."; exit 1 ;;
esac
cmk_version=${2:-}
# short branch notation: 2.4 -> 2.4.0
if [[ "${cmk_version}" =~ ^[0-9]+\.[0-9]+$ ]]; then
cmk_version="${cmk_version}.0"
fi
cmk_branch=$(grep -oE '^[0-9]+\.[0-9]+\.[0-9]+' <<< "${cmk_version}" || true)
cmk_os=$(lsb_release -cs)
cmk_release=$(curl -fsSL https://download.checkmk.com/stable_downloads.json | jq -r \
--arg ed "${cmk_edition}" --arg os "${cmk_os}" --arg branch "${cmk_branch}" '
.checkmk | to_entries
| map(select(.value.editions[$ed][$os] != null))
| map(select(if $branch == "" then .value.class == "stable" else .key == $branch end))
| sort_by(.key | split(".") | map(tonumber)) | last // empty
| [.value.version, .value.editions[$ed][$os][]] | @tsv') || true
if [ -z "${cmk_release}" ]; then
echo "❌ No checkmk release found for edition '${cmk_edition}', version '${cmk_version:-latest}' on ${cmk_os}."
exit 1
fi
read -r cmk_latest cmk_file cmk_sha256 <<< "${cmk_release}"
if [ -z "${cmk_version}" ] || [ "${cmk_version}" == "${cmk_branch}" ]; then
cmk_version=${cmk_latest}
elif [ "${cmk_version}" != "${cmk_latest}" ]; then
# older patch release: same file name scheme as the latest one of this branch, but no checksum
cmk_file=${cmk_file/${cmk_latest}/${cmk_version}}
cmk_sha256=""
fi
echo "Downloading checkmk ${cmk_version} (${cmk_file})..."
if ! curl -fsSL -o "/tmp/${cmk_file}" "https://download.checkmk.com/checkmk/${cmk_version}/${cmk_file}"; then
echo "❌ Download of checkmk ${cmk_version} failed."
exit 1
fi
if [ -n "${cmk_sha256}" ]; then
echo "${cmk_sha256} /tmp/${cmk_file}" | sha256sum -c -
else
echo "⚠️ No checksum available for checkmk ${cmk_version}, skipping verification."
fi
DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt -y -qq install "/tmp/${cmk_file}"
rm -f "/tmp/${cmk_file}"
}