Install the server
Downloads the newest RasterizedDB server release for your operating system and CPU, checks it against the release's SHA256SUMS, and installs the rasterizeddb binary (rasterizeddb.exe on Windows). Every other recipe here expects the binary this installs.
Before you start
- Linux on x86-64 or ARM64, or Windows on x86-64 or ARM64. There is no macOS release.
- An x86-64 machine needs a CPU with AVX2 (Intel Haswell, AMD Excavator or newer). The script checks on Linux. ARM64 builds run on any ARMv8-A CPU.
- Linux:
curlorwget,tarandsha256sum. The glibc build needs glibc 2.39 or newer (Ubuntu 24.04, Debian 13, RHEL 10). On anything older, and on Alpine, the script picks the static musl build instead. - Windows: Windows PowerShell 5.1 or PowerShell 7.
- Internet access to
github.comandapi.github.com. Without it, download the archive yourself and pass its path (see the settings below).
Settings
| bash variable | PowerShell parameter | Default | What it does |
|---|---|---|---|
RDB_INSTALL_DIR | -InstallDir | ~/.local/bin; on Windows %LOCALAPPDATA%\Programs\RasterizedDB | Where the binary is installed. |
RDB_VERSION | -Version | latest | The version to install, for example 1.1.0. latest is the newest release tagged v<major>.<minor>.<patch>. |
RDB_FLAVOR | auto | Linux only. glibc, musl, or auto to choose from this machine's glibc. | |
RDB_ARCHIVE | -Archive | The path of a release archive already on disk. Nothing is downloaded and no checksum is checked. | |
-AddToPath | off | Adds the install directory to your user PATH. |
The release assets are named rasterizeddb-server-<version>-<platform>.tar.gz (Linux) or .zip (Windows). The platforms are linux-x86_64, linux-arm64, linux-x86_64-musl, linux-arm64-musl, windows-x86_64 and windows-arm64.
Run it
chmod +x setup.sh
./setup.sh
# a system-wide install:
sudo RDB_INSTALL_DIR=/usr/local/bin ./setup.sh.\setup.ps1 -AddToPath
# from an archive you downloaded yourself:
.\setup.ps1 -Archive .\rasterizeddb-server-1.1.0-windows-x86_64.zipIf PowerShell refuses to run a downloaded script, run Unblock-File .\setup.ps1 first, or start it with powershell -ExecutionPolicy Bypass -File .\setup.ps1.
Check that it works
The script prints the installed version. Run it again yourself at any time:
rasterizeddb --versionrasterizeddb_core 1.1.0The program reports its own name as rasterizeddb_core. The file is still rasterizeddb.
Stop or undo
Delete the binary: rm ~/.local/bin/rasterizeddb, or on Windows Remove-Item "$env:LOCALAPPDATA\Programs\RasterizedDB" -Recurse. If you used -AddToPath, remove the directory from your user PATH in System Properties. Running the script again replaces the binary with the version it downloads.
Limits
- No macOS build is published.
- The x86-64 binaries do not start on CPUs without AVX2.
The files
#!/usr/bin/env bash
# RasterizedDB: download the latest server release for this Linux machine,
# check it against the release's SHA256SUMS, and install the binary.
#
# Every setting below can be overridden from the environment, for example:
# RDB_INSTALL_DIR=/usr/local/bin ./setup.sh
set -euo pipefail
RDB_INSTALL_DIR="${RDB_INSTALL_DIR:-$HOME/.local/bin}" # where the binary goes
RDB_VERSION="${RDB_VERSION:-latest}" # e.g. 1.1.0, or latest
RDB_FLAVOR="${RDB_FLAVOR:-auto}" # auto, glibc or musl
RDB_ARCHIVE="${RDB_ARCHIVE:-}" # a release archive already on disk: skips the download
RDB_REPO="${RDB_REPO:-milen-denev/rasterizeddb}"
die() { echo "error: $*" >&2; exit 1; }
[ "$(uname -s)" = "Linux" ] || die "release binaries exist for Linux and Windows only; on $(uname -s), build the server from source"
case "$(uname -m)" in
x86_64 | amd64) arch=x86_64 ;;
aarch64 | arm64) arch=arm64 ;;
*) die "no release binary for $(uname -m): there are x86_64 and arm64 builds" ;;
esac
if [ "$arch" = x86_64 ] && ! grep -qw avx2 /proc/cpuinfo; then
die "this CPU has no AVX2; the x86_64 release binaries need it (x86-64-v3)"
fi
# The glibc build needs glibc 2.39 or newer; the musl build is static and runs anywhere.
if [ "$RDB_FLAVOR" = auto ]; then
glibc="$(getconf GNU_LIBC_VERSION 2>/dev/null | awk '{print $2}')" || glibc=""
if [ -n "$glibc" ] && [ "$(printf '%s\n2.39\n' "$glibc" | sort -V | head -n1)" = "2.39" ]; then
RDB_FLAVOR=glibc
else
RDB_FLAVOR=musl
fi
fi
case "$RDB_FLAVOR" in
glibc) platform="linux-$arch" ;;
musl) platform="linux-$arch-musl" ;;
*) die "RDB_FLAVOR must be auto, glibc or musl" ;;
esac
fetch() { # fetch <url> <file>
if command -v curl >/dev/null 2>&1; then
curl -fsSL --retry 3 -o "$2" "$1"
elif command -v wget >/dev/null 2>&1; then
wget -q -O "$2" "$1"
else
die "curl or wget is needed to download"
fi
}
work="$(mktemp -d)"
trap 'rm -rf "$work"' EXIT
if [ -n "$RDB_ARCHIVE" ]; then
[ -f "$RDB_ARCHIVE" ] || die "RDB_ARCHIVE=$RDB_ARCHIVE is not a file"
archive="$RDB_ARCHIVE"
echo "Using $archive (no download, no checksum check)"
else
if [ "$RDB_VERSION" = latest ]; then
# The newest release whose tag is v<major>.<minor>.<patch>; other tags
# (client-v…, server-v…) and pre-releases are skipped.
fetch "https://api.github.com/repos/$RDB_REPO/releases?per_page=30" "$work/releases.json"
RDB_VERSION="$(grep -o '"tag_name": *"v[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*"' "$work/releases.json" \
| head -n1 | sed 's/.*"v\([^"]*\)"/\1/')"
[ -n "$RDB_VERSION" ] || die "could not find a release; set RDB_VERSION, or RDB_ARCHIVE to a downloaded archive"
fi
RDB_VERSION="${RDB_VERSION#v}"
name="rasterizeddb-server-$RDB_VERSION-$platform.tar.gz"
base="https://github.com/$RDB_REPO/releases/download/v$RDB_VERSION"
echo "Downloading $name"
fetch "$base/$name" "$work/$name"
fetch "$base/SHA256SUMS" "$work/SHA256SUMS"
(cd "$work" && grep " $name\$" SHA256SUMS | sha256sum -c -) || die "checksum mismatch for $name"
archive="$work/$name"
fi
tar -xzf "$archive" -C "$work"
bin="$(find "$work" -type f -name rasterizeddb -perm -u+x | head -n1)"
[ -n "$bin" ] || die "no rasterizeddb binary in $archive"
mkdir -p "$RDB_INSTALL_DIR"
install -m 0755 "$bin" "$RDB_INSTALL_DIR/rasterizeddb"
echo
"$RDB_INSTALL_DIR/rasterizeddb" --version
echo "Installed $RDB_INSTALL_DIR/rasterizeddb"
case ":$PATH:" in
*":$RDB_INSTALL_DIR:"*) ;;
*) echo "Add it to PATH: export PATH=\"$RDB_INSTALL_DIR:\$PATH\"" ;;
esac
echo "Next: rasterizeddb --help lists every option; the local-dev script starts a server to try."#Requires -Version 5.1
<#
.SYNOPSIS
RasterizedDB: download the latest server release for this Windows machine,
check it against the release's SHA256SUMS, and install rasterizeddb.exe.
.EXAMPLE
.\setup.ps1
.\setup.ps1 -InstallDir 'C:\Program Files\RasterizedDB' -AddToPath
#>
[CmdletBinding()]
param(
# Where rasterizeddb.exe goes.
[string]$InstallDir = $(if ($env:RDB_INSTALL_DIR) { $env:RDB_INSTALL_DIR } else { Join-Path $env:LOCALAPPDATA 'Programs\RasterizedDB' }),
# A version such as 1.1.0, or latest.
[string]$Version = $(if ($env:RDB_VERSION) { $env:RDB_VERSION } else { 'latest' }),
# A release archive already on disk: skips the download.
[string]$Archive = $env:RDB_ARCHIVE,
[string]$Repo = $(if ($env:RDB_REPO) { $env:RDB_REPO } else { 'milen-denev/rasterizeddb' }),
# Also put InstallDir on this user's PATH.
[switch]$AddToPath
)
$ErrorActionPreference = 'Stop'
$ProgressPreference = 'SilentlyContinue' # Invoke-WebRequest is far faster without the progress bar
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
$osArch = $env:PROCESSOR_ARCHITECTURE
try { $osArch = [string][System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture } catch { }
switch -Regex ($osArch) {
'^(X64|AMD64)$' { $platform = 'windows-x86_64' }
'^(Arm64|ARM64)$' { $platform = 'windows-arm64' }
default { throw "No release binary for architecture '$osArch': there are x86_64 and arm64 builds." }
}
$work = Join-Path ([System.IO.Path]::GetTempPath()) ("rdb-install-" + [guid]::NewGuid().ToString('N'))
New-Item -ItemType Directory -Force -Path $work | Out-Null
try {
if ($Archive) {
if (-not (Test-Path -LiteralPath $Archive -PathType Leaf)) { throw "Archive '$Archive' is not a file." }
$zip = (Resolve-Path -LiteralPath $Archive).Path
Write-Host "Using $zip (no download, no checksum check)"
}
else {
$headers = @{ 'User-Agent' = 'rasterizeddb-install-script' }
if ($Version -eq 'latest') {
# The newest release tagged v<major>.<minor>.<patch>; client-v…,
# server-v… and pre-release tags are skipped.
$releases = Invoke-RestMethod -Headers $headers -Uri "https://api.github.com/repos/$Repo/releases?per_page=30"
$tag = $releases | Where-Object { $_.tag_name -match '^v\d+\.\d+\.\d+$' } | Select-Object -First 1 -ExpandProperty tag_name
if (-not $tag) { throw 'Could not find a release; pass -Version, or -Archive with a downloaded archive.' }
$Version = $tag
}
$Version = $Version.TrimStart('v')
$name = "rasterizeddb-server-$Version-$platform.zip"
$base = "https://github.com/$Repo/releases/download/v$Version"
$zip = Join-Path $work $name
Write-Host "Downloading $name"
Invoke-WebRequest -UseBasicParsing -Headers $headers -Uri "$base/$name" -OutFile $zip
$sums = Join-Path $work 'SHA256SUMS'
Invoke-WebRequest -UseBasicParsing -Headers $headers -Uri "$base/SHA256SUMS" -OutFile $sums
$line = Get-Content $sums | Where-Object { $_ -match ('\s' + [regex]::Escape($name) + '$') } | Select-Object -First 1
if (-not $line) { throw "$name is not listed in SHA256SUMS." }
$expected = ($line -split '\s+')[0].ToLowerInvariant()
$actual = (Get-FileHash -Algorithm SHA256 -LiteralPath $zip).Hash.ToLowerInvariant()
if ($expected -ne $actual) { throw "Checksum mismatch for ${name}: expected $expected, got $actual." }
}
$unpacked = Join-Path $work 'unpacked'
Expand-Archive -LiteralPath $zip -DestinationPath $unpacked -Force
$exe = Get-ChildItem -Path $unpacked -Recurse -Filter 'rasterizeddb.exe' | Select-Object -First 1
if (-not $exe) { throw "No rasterizeddb.exe in $zip." }
New-Item -ItemType Directory -Force -Path $InstallDir | Out-Null
$target = Join-Path $InstallDir 'rasterizeddb.exe'
Copy-Item -LiteralPath $exe.FullName -Destination $target -Force
}
finally {
Remove-Item -LiteralPath $work -Recurse -Force -ErrorAction SilentlyContinue
}
& $target --version
if ($LASTEXITCODE -ne 0) { throw "$target did not run (exit $LASTEXITCODE)." }
Write-Host "Installed $target"
if ($AddToPath) {
$userPath = [Environment]::GetEnvironmentVariable('Path', 'User')
if (-not (($userPath -split ';') -contains $InstallDir)) {
[Environment]::SetEnvironmentVariable('Path', ($(if ($userPath) { "$userPath;" } else { '' }) + $InstallDir), 'User')
Write-Host "Added $InstallDir to your PATH (open a new terminal to use it)."
}
}
Write-Host 'Next: rasterizeddb.exe --help lists every option; the local-dev script starts a server to try.'