NetBox IPAM Tool Howto for RHEL10

Below is a detailed, native (non-Docker) NetBox installation guide for RHEL 10.
The steps are very similar to RHEL 9, and NetBox runs fine on RHEL 10, though Red Hat–based installs require careful dependency setup.

Target setup

  • OS: RHEL 10
  • Install path: /opt/netbox
  • Database: PostgreSQL
  • Cache: Redis
  • Web: Gunicorn + Nginx
  • Python: system Python 3.12 (venv)

1. System Preparation

Update system

sudo dnf update -y
sudo reboot

Enable required repositories

sudo dnf install -y epel-release
sudo dnf config-manager --set-enabled crb

2. Install System Dependencies

sudo dnf install -y \
  git gcc python3 python3-devel python3-virtualenv \
  libpq-devel \
  nginx \
  redis \
  postgresql-server postgresql-devel \
  openssl-devel

3. PostgreSQL Setup

Initialize PostgreSQL

sudo postgresql-setup --initdb
sudo systemctl enable --now postgresql

Secure PostgreSQL

sudo passwd postgres

Create NetBox database and user

sudo -u postgres psql

Inside psql:

CREATE DATABASE netbox;
CREATE USER netbox WITH PASSWORD 'STRONG_DB_PASSWORD';
ALTER DATABASE netbox OWNER TO netbox;
\q

4. Redis Setup

sudo systemctl enable --now redis

Verify:

redis-cli ping
# Should return: PONG

5. Create NetBox System User

sudo useradd -r -d /opt/netbox -s /bin/bash netbox

6. Download NetBox

cd /opt
sudo git clone -b master https://github.com/netbox-community/netbox.git
sudo chown -R netbox:netbox /opt/netbox

7. Python Virtual Environment

sudo -u netbox python3 -m venv /opt/netbox/venv
sudo -u netbox /opt/netbox/venv/bin/pip install --upgrade pip wheel

Install Python dependencies

sudo -u netbox /opt/netbox/venv/bin/pip install -r /opt/netbox/requirements.txt

8. NetBox Configuration

cd /opt/netbox/netbox
sudo -u netbox cp configuration_example.py configuration.py
sudo -u netbox nano configuration.py

Required edits

ALLOWED_HOSTS = ['*']

DATABASE = {
    'NAME': 'netbox',
    'USER': 'netbox',
    'PASSWORD': 'STRONG_DB_PASSWORD',
    'HOST': 'localhost',
    'PORT': '',
}

REDIS = {
    'tasks': {
        'HOST': 'localhost',
        'PORT': 6379,
        'DATABASE': 0,
        'PASSWORD': '',
    },
    'caching': {
        'HOST': 'localhost',
        'PORT': 6379,
        'DATABASE': 1,
        'PASSWORD': '',
    }
}

SECRET_KEY = 'GENERATE_A_LONG_RANDOM_STRING'

Generate secret key:

sudo -u netbox python3 ../generate_secret_key.py

9. Database Migration & Admin User

cd /opt/netbox
sudo -u netbox ./manage.py migrate
sudo -u netbox ./manage.py createsuperuser
sudo -u netbox ./manage.py collectstatic --no-input

10. Gunicorn Setup

sudo cp /opt/netbox/contrib/gunicorn.py /opt/netbox/gunicorn.py
sudo cp /opt/netbox/contrib/*.service /etc/systemd/system/

Enable services:

sudo systemctl daemon-reexec
sudo systemctl enable --now netbox netbox-rq

Check:

sudo systemctl status netbox

11. Nginx Configuration

sudo cp /opt/netbox/contrib/nginx.conf /etc/nginx/conf.d/netbox.conf
sudo nano /etc/nginx/conf.d/netbox.conf

Ensure:

server {
    listen 80;
    server_name _;
}

Start Nginx:

sudo systemctl enable --now nginx

12. SELinux Adjustments (Important on RHEL)

sudo setsebool -P httpd_can_network_connect on
sudo setsebool -P httpd_can_network_connect_db on

13. Firewall

sudo firewall-cmd --add-service=http --permanent
sudo firewall-cmd --reload

14. Access NetBox

Open browser:

http://<server-ip>

Login using the superuser you created.


Service Management Cheatsheet

sudo systemctl restart netbox netbox-rq nginx
sudo systemctl status netbox
journalctl -u netbox

Leave a Reply

Your email address will not be published. Required fields are marked *