# Ubuntu Server/Desktop 22.04 / 24.04 / 26.04 Pre-Configuration Guide for High-Load VMS

This guide describes the recommended initial configuration of Ubuntu systems for stable operation of a high-load video surveillance platform based on **Cluebase VMS** running in Docker containers.

The recommendations apply to:

- Ubuntu Server/Desktop 22.04 LTS
- Ubuntu Server/Desktop 24.04 LTS
- Ubuntu Server/Desktop 26.04 LTS

The system is expected to operate under:

- High network throughput
- Intensive disk I/O
- Large numbers of simultaneous video streams
- NVIDIA GPU acceleration
- Continuous 24/7 workloads

---

# 1. Fully Update the System

Update package indexes and install all available updates.

```bash
sudo apt update && sudo apt dist-upgrade -y && sudo apt autoremove -y && sudo apt autoclean && sudo snap refresh
```

Reboot after updates:

```bash
sudo reboot
```

---

# 2. Disable Automatic System Updates

Automatic updates may restart services unexpectedly and affect VMS stability.

Disable unattended upgrades:

```bash
sudo systemctl stop unattended-upgrades && sudo systemctl disable unattended-upgrades
```

Disable periodic APT updates:

```bash
sudo nano /etc/apt/apt.conf.d/20auto-upgrades
```

Set:

```text
APT::Periodic::Update-Package-Lists "0";
APT::Periodic::Unattended-Upgrade "0";
```

Save the file.

---

# 3. Install Additional System Packages

Install useful administration and monitoring utilities:

```bash
sudo apt install -y \
mc \
htop \
curl \
unzip \
apt-transport-https \
ca-certificates \
gnupg \
lsb-release \
gnupg2 \
iotop \
net-tools \
iftop \
nvme-cli \
smartmontools \
jq
```

Package purpose:

<table id="bkmrk-package-purpose-mc-f"><thead><tr><th>Package</th><th>Purpose</th></tr></thead><tbody><tr><td>mc</td><td>File manager</td></tr><tr><td>htop</td><td>Process monitoring</td></tr><tr><td>iotop</td><td>Disk I/O monitoring</td></tr><tr><td>iftop</td><td>Network traffic monitoring</td></tr><tr><td>smartmontools</td><td>Disk health monitoring</td></tr><tr><td>nvme-cli</td><td>NVMe SSD management</td></tr></tbody></table>

---

# 4. Check Secure Boot Status

Secure Boot must be disabled in BIOS/UEFI before installing proprietary NVIDIA drivers.

Check status:

```bash
mokutil --sb-state
```

Possible output:

```text
SecureBoot enabled
```

or

```text
SecureBoot disabled
```

If Secure Boot is enabled:

1. Reboot the server
2. Enter BIOS/UEFI
3. Disable:
    
    
    - Secure Boot
    - Fast Boot (recommended)
4. Save settings and reboot

---

# 5. Install NVIDIA Driver and NVIDIA Container Toolkit

Install NVIDIA drivers only if the server has an NVIDIA GPU.

Recommended driver installation:

```bash
sudo ubuntu-drivers autoinstall
```

Reboot:

```bash
sudo reboot
```

Verify driver installation:

```bash
nvidia-smi
```

Expected result:

- GPU model displayed
- Driver version visible
- No errors

---

## Install NVIDIA Container Toolkit only after installing Cluebase VMS or Docker

Official documentation:

[NVIDIA Container Toolkit Install Guide](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html?utm_source=chatgpt.com)

Configure the production repository:

```bash
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
  && curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
    sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
    sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
```

Update the packages list from the repository:

```bash
sudo apt update
```

Install the NVIDIA Container Toolkit packages:

```bash
export NVIDIA_CONTAINER_TOOLKIT_VERSION=1.19.0-1
  sudo apt-get install -y \
      nvidia-container-toolkit=${NVIDIA_CONTAINER_TOOLKIT_VERSION} \
      nvidia-container-toolkit-base=${NVIDIA_CONTAINER_TOOLKIT_VERSION} \
      libnvidia-container-tools=${NVIDIA_CONTAINER_TOOLKIT_VERSION} \
      libnvidia-container1=${NVIDIA_CONTAINER_TOOLKIT_VERSION}
```

Configure runtime:

```bash
sudo nvidia-ctk runtime configure --runtime=docker
```

Restart Docker:

```bash
sudo systemctl restart docker
```

---

# 6. Enable TCP BBR Congestion Control

BBR improves network throughput and reduces latency under heavy traffic.

Open sysctl configuration:

```bash
sudo nano /etc/sysctl.conf
```

Add:

```text
net.core.default_qdisc=fq
net.ipv4.tcp_congestion_control=bbr
```

Apply settings:

```bash
sudo sysctl -p
```

Verify:

```bash
sysctl net.ipv4.tcp_congestion_control
```

Expected output:

```text
net.ipv4.tcp_congestion_control = bbr
```

---

# 7. Configure Static IP Address

Ubuntu 22.04/24.04/24.06 uses Netplan.

Find interface name:

```bash
ip a
```

Example interface:

```text
ens18
```

Edit Netplan configuration:

```bash
sudo nano /etc/netplan/01-netcfg.yaml
```

Example configuration:

```yaml
network:
  version: 2
  renderer: networkd
  ethernets:
    ens18:
      dhcp4: false
      addresses:
        - 192.168.1.100/24
      routes:
        - to: default
          via: 192.168.1.1
      nameservers:
        addresses:
          - 1.1.1.1
          - 8.8.8.8
```

Apply configuration:

```bash
sudo netplan apply
```

Verify:

```bash
ip a
ip route
```

---

# 8. Configure Additional fs.aio-max-nr Parameter

Increase asynchronous I/O limits for high-load applications.

Edit sysctl configuration:

```bash
sudo nano /etc/sysctl.d/99-aio.conf
```

Add:

```text
fs.aio-max-nr = 1048576
```

Apply:

```bash
sudo sysctl --system
```

Verify:

```bash
sysctl fs.aio-max-nr
```

---

# Additional Recommended Optimizations for High-Load Cluebase VMS Systems

## Increase File Descriptor Limits

Large video systems require high open-file limits.

Edit:

```bash
sudo nano /etc/security/limits.conf
```

Add:

```text
* soft nofile 1048576
* hard nofile 1048576
root soft nofile 1048576
root hard nofile 1048576
```

Also configure systemd:

```bash
sudo nano /etc/systemd/system.conf
```

Add or modify:

```text
DefaultLimitNOFILE=1048576
```

Edit:

```bash
sudo nano /etc/systemd/user.conf
```

Add:

```text
DefaultLimitNOFILE=1048576
```

Reload:

```bash
sudo systemctl daemon-reexec
```

---

# Increase Network Buffers

Edit:

```bash
sudo nano /etc/sysctl.conf
```

Add:

```text
net.core.rmem_max = 67108864
net.core.wmem_max = 67108864
net.core.rmem_default = 262144
net.core.wmem_default = 262144
net.ipv4.tcp_rmem = 4096 87380 67108864
net.ipv4.tcp_wmem = 4096 65536 67108864
net.core.netdev_max_backlog = 250000
```

Apply:

```bash
sudo sysctl -p
```

---

# Set Performance CPU Governor

Recommended for dedicated VMS servers.

Install tools:

```bash
sudo apt install -y linux-tools-common linux-tools-generic
```

Set performance mode:

```bash
sudo cpupower frequency-set -g performance
```

Verify:

```bash
cpupower frequency-info
```

---

# Enable TRIM for SSD/NVMe

```bash
sudo systemctl enable fstrim.timer
sudo systemctl start fstrim.timer
```

Verify:

```bash
systemctl status fstrim.timer
```

---

# Recommended BIOS Settings

For stable 24/7 operation:

Disable:

- Secure Boot
- Fast Boot
- CPU C-States (optional for latency-sensitive systems)
- ASPM power saving (optional)

Enable:

- Above 4G Decoding (for large GPUs)
- Resizable BAR (if supported)
- Performance power profile

---

# Monitoring Recommendations

Useful commands:

CPU:

```bash
htop
```

Disk I/O:

```bash
iotop
```

GPU:

```bash
watch -n 1 nvidia-smi
```

Network:

```bash
iftop
```

Disk health:

```bash
sudo smartctl -a /dev/sda
```

---

# Final Recommendations

For production Cluebase VMS servers:

- Use Ubuntu Server instead of Desktop whenever possible
- Use enterprise-grade SSD/NVMe drives
- Use RAID with battery-backed cache for archive storage
- Use dedicated NICs for camera traffic
- Prefer 10G networking for large installations
- Keep OS and archive storage separated
- Avoid installing unnecessary GUI applications and services
- Reboot only during maintenance windows
- Use UPS power protection
- Monitor disk temperatures and SMART status regularly