To upgrade Nagios Core without losing configuration, check your installed version, back up the existing installation, download the latest stable source release, and run configure, make all, and make install. Validate the configuration using nagios -v before restarting the monitoring service. This procedure applies to existing source-based Nagios Core installations.
Compatibility: Ubuntu 22.04/24.04, Debian 12, Rocky Linux 9 and AlmaLinux 9; source-installed Nagios Core 4.x. Commands use standard Nagios Core and Linux utilities.
Requirements
You need SSH or console access with sudo privileges, a source-installed Nagios Core under /usr/local/nagios, available disk space, build tools, and a maintenance window. Back up custom plugins and system integration files as well.
Ubuntu 22.04/24.04 and Debian 12:
sudo apt update sudo apt install -y build-essential wget tar libgd-dev libssl-dev
Rocky Linux 9 and AlmaLinux 9:
sudo dnf install -y gcc make wget tar gd-devel openssl-devel
This procedure is for source-based installations. For Nagios Core installed through a package manager, use the distribution packages instead. Nagios XI has a separate upgrade procedure.
Steps
Step 1. Check your installed version
Check the current Nagios Core version and validate its configuration before changing any files.
/usr/local/nagios/bin/nagios --version sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Check the latest stable release on the official Nagios Core versions page. Set the version variable for the release you intend to install: Official Nagios Core releases
NAGIOS_VERSION="4.5.14"
Step 2. Back up Nagios
Back up configuration, runtime data, and a full copy of the installation. Keep a copy outside the server. The full archive is needed if you must restore the previous binaries.
sudo tar -czf /root/nagios-backup.tar.gz -C / usr/local/nagios/etc usr/local/nagios/var sudo tar -czf /root/nagios-full-backup.tar.gz -C / usr/local/nagios
Step 3. Download the source release
Download the selected official source archive using the version variable. The commands run from a temporary working directory.
cd /tmp
wget -O nagioscore.tar.gz "https://github.com/NagiosEnterprises/nagioscore/archive/refs/tags/nagios-${NAGIOS_VERSION}.tar.gz"
tar -xzf nagioscore.tar.gz
cd "nagioscore-nagios-${NAGIOS_VERSION}"
Step 4. Compile and install
Use the same configure options as your existing installation, including any custom command group. Stop Nagios just before installing the new binaries. Do not run make install-config during a routine upgrade, because existing settings must be retained.
./configure make all sudo systemctl stop nagios sudo make install
Step 5. Validate and start Nagios
Verify the configuration before starting the updated daemon. If verification fails, correct the errors or restore your backup instead of starting the service.
sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg sudo systemctl start nagios
Verify
Check the installed release, service status, and the web interface. Confirm hosts, service checks, and notifications still work.
/usr/local/nagios/bin/nagios --version systemctl is-active nagios
Troubleshooting
Nagios fails to start
Validate nagios.cfg and inspect the systemd log for configuration, permission, or module errors.
sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg sudo journalctl -u nagios -n 50 --no-pager
Compilation fails
Review the configure or make error and confirm required development libraries are installed. Reuse any non-default configure flags from the old installation.
Rollback after an unsuccessful upgrade
Stop Nagios, restore the complete installation from the saved archive, validate the old configuration, and start the service again. A server snapshot is preferable when external plugins or system service files were changed.
sudo systemctl stop nagios sudo tar -xzf /root/nagios-full-backup.tar.gz -C / sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg sudo systemctl start nagios
Nagios Core vs Nagios XI
Nagios Core is an open-source monitoring engine, usually configured through files. Nagios XI is a commercial product with additional management and reporting tools. Never use these Core source-upgrade steps on Nagios XI; follow the official Nagios XI update procedure.
FAQ
Will the upgrade overwrite my configuration?
A normal source upgrade with make install preserves existing configuration. Do not run make install-config, and always take a backup first.
How do I check my Nagios version?
Run /usr/local/nagios/bin/nagios –version on the server.
How do I roll back a failed upgrade?
Stop Nagios, restore the full installation or server snapshot, validate nagios.cfg, and start Nagios.
What is the difference between Nagios Core and Nagios XI?
Nagios Core is an open-source monitoring engine. Nagios XI is a commercial management and reporting product and uses a separate upgrade procedure.
Related Articles
- Installing Zabbix with Portainer
- Installing NetData with Portainer
- Installing Gatus with Portainer
- Official upgrade guide
Monitor servers with Unihost
Run monitoring services on Unihost infrastructure and get assistance managing your servers.