Deploy & Upgrade NetBox
- NetBox Quick Start Installation Guide
- Install NetBox
- Upgrade NetBox
- Remove NetBox
- NetBox CSRF Settings
NetBox Quick Start Installation Guide
Deploy a NetBox Dev/Test Environment in 20 Minutes
To get NetBox up and running in the fastest possible way, follow this guide. This framework will allow you to install, backup, remove, upgrade, customize, and deploy NetBox plugins, all in minutes.
The blue info boxes flag What You've Missed, which are stages you should consider in a production, or in "more than just a NetBox lab" environment.
5 Minute Demo
Installation Guide
1. Install Ubuntu Server
You're going to need to get a server with Ubuntu 24.04 LTS up and running. Download an image like ubuntu-24.04-live-server-amd64.iso
or spin up an instance on your favorite cloud provider, like AWS.
2. Install Semaphore and the Netos NetOps Project
You can follow the full Install Semaphore Guide, however, in summary, once you install Ubuntu, paste this command to pull the repo and run the install script, and you shouldn't need to do anything else:
sudo wget https://raw.githubusercontent.com/netos-networks/netos-netops/refs/heads/main/easy-deploy.sh && sudo chmod +x easy-deploy.sh && sudo ./easy-deploy.sh
The Key Semaphore Principles guide explains more about Semaphore.
Check the Users, Accounts, and Tokens guide for more information about credentials and variables.
3. Configure Semaphore
These steps are optional, so you can skip this for now.
Change the DOMAIN
and SEMAPHORE_HOSTNAME
variables in the NetBox Global Settings Semaphore environment. Follow the Deploying NGINX & Certificates guide.
Deploy self-signed certificates, so you don't get "your connection isn't private" browser warnings. Follow the Deploying NGINX & Certificates guide.
Enable Semaphore Backups.
4. Deploy NGINX and Self-Signed Cert for NetBox
You need to deploy NGINX to connect to NetBox. To fast track, you can just create a self-signed certificate. The default hostname will be netbox.netos.dev
.
Change the DOMAIN
and NETBOX_HOSTNAME
variables in the NetBox Global Settings Semaphore environment. Follow the Deploying NGINX & Certificates guide.
Deploy self-signed certificates, so you don't get "Your connection isn't private" browser warnings. Follow the Deploying NGINX & Certificates guide.
5. Install NetBox
Browse to the NETBOX DEPLOY view in Semaphore to start the installation. The full NetBox Installation Guide is here.
If you want to install a specific version, set it here, matching the numeric version from Releases · netbox-community/netbox (github.com). Don't add the v
, i.e. v4.1.2
would be 4.1.2
.
Configure scheduled daily NetBox Backups or set your own custom frequency.
Upgrade NetBox. For example, maybe you've used the Restore process to restore to an older version and want to upgrade to a newer version.
Enable the NetBox Maintenance Playbook on a daily schedule as per the developer's guidance.
6. Connect to NetBox
Once the playbook is complete, you should be able to connect using HTTPS and the IP address to NetBox. Check the Users, Accounts, and Tokens guide for full details on account and passwords. The default credentials are as follows:
- Username:
admin
- Password:
ohp8toef7Jee
If you experience any problems, you can run the Health Check Playbook to quickly diagnose common issues. For example, check the logs to catch the reason why NetBox failed to start.
7. Install NetBox Plugins
You can Install and Upgrade popular NetBox plugins from within Semaphore, and also Disable NetBox Plugins. This feature is a work-in-progress, and probably will be for a while...!
If things go wrong in your test environment, you can quickly Wipe NetBox and start again.
Install NetBox
Introduction
This guide details how to deploy a new instance of NetBox. For guidance on upgrading NetBox, please refer to this Upgrade NetBox.
NetBox is installed from the public GitHub repository according to the version set in Semaphore (or proposed during an upgrade). Netos has not forked NetBox. Any customizations made by Netos are optional and controlled from within the NETOS view in the NetBox project in Semaphore.
Configuration Guide
1. Configure the Semaphore Environment
You can set the SUPER_USER
username, email, and password in the NetBox Global Settings environment settings, or just use the defaults for testing:
Please don't change the install directory from /opt/netbox
as it is hard coded in configuration files and variables.
There is a bug in Ansible Semaphore that requires you to delete and recreate the secret value. Save doesn't work.
2. Deploy NGINX and the Cert
Refer to the following guide Deploying NGINX & Certificates for a detailed guide on deploying NGINX and certs. Once you've deployed, you'll see a screen like this and should be able to connect to a URL like https://uk-lab-nb05-netbox.core.netos.io.
You need to deploy NGINX because it configures the webserver to mount alias /opt/netbox/netbox/static/;
correctly to avoid the Static Media Failure error.
3. Install NetBox
We have included pre-defined NetBox templates (which will be updated from time-to-time), for example, you can just click play on the Semaphore template to deploy NetBox v3.7.8
or v4.0.11
.
If you want to install a custom version of NetBox, you can do so by editing the tags in the Semaphore Template. For example, change --tags=X.X.X
to --tags=3.6.5
. This feature is useful for a migration, for example, if you wanted to migrate from a legacy NetBox instance, you could take a backup and Restore, then Upgrade.
Note that the netbox-deploy.yml
Ansible playbook has logic that matches the tags referenced in Semaphore. The tags must be set for this playbook to execute. The tags are used to set variables which are passed to the netbox-deploy
Ansible role.
- hosts: 127.0.0.1
connection: local
become: yes
vars_files:
- ./vars/env-netbox-settings.yml
tasks:
- name: Set NetBox release version to v4.1.1
set_fact:
NETBOX_RELEASE: 4.1.1
tags: 4.1.0
- name: Set NetBox release version to v4.1.0
set_fact:
NETBOX_RELEASE: 4.1.0
tags: 4.1.0
4. Connect to NetBox
Once you've deployed NetBox you can connect to the application based on the NETBOX_HOSTNAME
and DOMAIN
variables configured in the NetBox Global Setting environment.
Check the Users, Accounts, and Tokens guide for full details on account and passwords. The default credentials are as follows:
- Username:
admin
- Password:
ohp8toef7Jee
a. NetBox 3.7.8
b. NetBox 4.0.11
Thoughts About Docker
We (Netos) used and tested the NetBox Docker image for over 6 months. When we started to load test to simulate a large production enterprise environment, we experienced stability issues, especially when hitting the API hard, and also had to make a number of changes to the Docker NGINX configuration.
Others may have had success; however, we were unable to achieve stability (outside of development environments) with NetBox in Docker. The playbooks here install NetBox natively on the Linux operating system, and we've had no issues whatsoever.
Upgrade NetBox
Introduction
This guide will walk you through the process of upgrading NetBox, including a suggested pre-staging strategy. The approach we take to upgrading NetBox is as follows:
- Upgrade to the final patch of the current release, e.g. from
3.7.4
to3.7.8
- Upgrade to the final patch version of the next major release, e.g. from
3.7.8
to4.0.11
The official NetBox upgrade strategy can be found here: netbox/docs/installation/upgrading.md at develop · netbox-community/netbox (github.com)
This feature is a work-in-progress. There are many other considerations to take into account, such as plugin configurations and customizations, as well as sequencing.
Upgrade Playbooks and Templates
Within the NetBox Deploy view in Semaphore, you'll see these playbooks.
- NetBox Upgrade Check Path - checks the current running version with the mapping table to suggest the next version.
- NetBox Upgrade to Next Suitable Version - this will take the result from the "Check Path" playbook and perform an upgrade.
Checking the Upgrade Path
The following screenshot shows that NetBox 3.7.8
has been detected, and based on the upgrade path mapping table, the next suggested version is 4.0.11
.
When the playbook runs it checks a mapping table that is structured like this. The logic is:
- If
current_version
andpatch
are the different, then upgrade to the nextpatch
in the same release - If
current_version
andpatch
are the same, then upgrade tonext_major
netbox_upgrade_paths:
3.7.0:
patch: 3.7.8
next_major: 4.0.11
3.7.1:
patch: 3.7.8
next_major: 4.0.11
3.7.2:
patch: 3.7.8
next_major: 4.0.11
3.7.3:
patch: 3.7.8
next_major: 4.0.11
3.7.4:
patch: 3.7.8
next_major: 4.0.11
3.7.5:
patch: 3.7.8
next_major: 4.0.11
3.7.6:
patch: 3.7.8
next_major: 4.0.11
3.7.7:
patch: 3.7.8
next_major: 4.0.11
3.7.8:
patch: 3.7.8
next_major: 4.0.11
4.0.0:
patch: 4.0.11
next_major: 4.1.0
In a production environment you should not upgrade past the final release in the last release. For example, once 4.0.0
was released, 3.7.8
was considered the final stable release. Once 4.1.0
was released, we would consider 4.0.11
stable, and so on.
Running the Upgrade
Here you can see that the suggested upgrade version from the mapping table has been passed to the netbox-deploy
playbook to facilitate the upgrade.
You must take a full backup before starting the upgrade. If possible, we would suggest stopping all services on the server and taking a snapshot (disk image) before proceeding.
Ensure you check compatibility with any plugins that you have installed and have a clear upgrade path for them.
Ensure you check breaking changes in the NetBox Release notes that could impact you, for example, if you have integrated your systems using the NetBox Rest API, endpoints do change from time-to-time, which could break your integrations.
Have a clear test plan.
Pre-Stage Your Upgrades
It's fast and simple to spin up a staging NetBox instance for testing. A "belt and braces" approach to an upgrade is as follows:
- Install Semaphore
- Install NetBox, ensuring that you match the NetBox version
- Backup your current production NetBox instance
- Restore to the new staging NetBox instance
- Test the upgrade process in safety!
Remove NetBox
Introduction
In a test or lab environment it is useful to be able to quickly wipe NetBox so you can re-install and restore.
This process will drop the NetBox database from PostgreSQL and delete the /opt/netbox
folder. It's probably not a good idea to run this on production system. In fact, delete the template on production systems!
NetBox CSRF Settings
Introduction
This playbook netbox-csrf
will add your domains in the following format to the NetBox settings.py
file based on the DOMAIN
variable in Semaphore.
http://*.yourdomain.com
https://*.yourdomain.com
http://yourdomain.com
https://yourdomain.com
When you run the playbook, it will look like this:
Use Case
If your server name is uk-lab-nb01.core.netos.io
, and you configured a DNS CNAME to give it a more friendly name like demo2.netos.io
via a reverse proxy, then you would see this error and won't be able to login:
To fix this, change the domain to in the NetBox Global Settings:
Which will create a settings.py
file entry like this and fix the error:
CSRF_TRUSTED_ORIGINS = getattr(configuration, 'CSRF_TRUSTED_ORIGINS', ['http://netos.io', 'https://netos.io', 'http://*.netos.io', 'https://*.netos.io'])