Learn how to install NetBox on RHEL 8 with this detailed step-by-step guide. Set up and configure your network documentation and management tool efficiently on Red Hat Enterprise Linux 8. #centlinux #linux #netbox
Table of Contents
What is NetBox?
NetBox is an open-source web application designed to help organizations manage and document their network infrastructure. Developed by the Network to Code community, NetBox provides a centralized platform for tracking and visualizing various aspects of network resources, including devices, racks, IP addresses, circuits, and more. (NetBox Official Website)
Here are some key features and functionalities of NetBox:
- IP Address Management (IPAM): NetBox offers comprehensive IP address management capabilities, allowing users to efficiently organize and track IPv4 and IPv6 address space allocations.
- Device Inventory: Users can create detailed inventory records for network devices such as switches, routers, firewalls, servers, and virtual machines, including information such as make, model, serial number, and asset tags.
- Rack and Data Center Visualization: NetBox provides tools for visualizing rack layouts and data center floor plans, helping users manage physical infrastructure and plan capacity effectively.
- Cable Management: Users can document cable connections between devices and visualize cable paths, simplifying troubleshooting and maintenance tasks.
- Power Management: NetBox allows users to document power connections for devices and track power usage across racks and data centers.
- Integration with External Systems: NetBox offers RESTful APIs and webhooks for integration with external systems, facilitating automation and custom workflows.
- User Authentication and Permissions: NetBox supports user authentication via LDAP, Active Directory, OAuth, and local database, with granular access controls to restrict user permissions based on roles and groups.
- Customization and Extensions: Users can extend NetBox’s functionality through custom scripts, plugins, and data models, adapting the platform to their specific requirements.
- Auditing and Change Management: NetBox maintains an audit trail of changes made to network resources, enabling users to track modifications and maintain accountability.
- Documentation and Collaboration: NetBox serves as a centralized repository for network documentation, providing a platform for collaboration and knowledge sharing among team members.
NetBox is widely used by network engineers, system administrators, and IT teams across industries to streamline network management processes, improve visibility into network infrastructure, and maintain accurate documentation for compliance and operational purposes. Its open-source nature and active community contribute to its ongoing development and enhancement.

NetBox Alternatives
Several alternatives to NetBox exist, offering similar functionalities for network infrastructure management and documentation. Here are some popular alternatives:
- phpIPAM: An open-source IP address management (IPAM) solution with features for tracking IP addresses, subnets, VLANs, and devices. It offers RESTful APIs, LDAP integration, and role-based access control.
- DCImanager: A commercial data center infrastructure management (DCIM) solution that provides tools for managing racks, servers, networks, and IP addresses. It offers features for capacity planning, remote management, and asset tracking.
- RackTables: An open-source web-based application for data center and server room asset management. It allows users to document racks, servers, switches, and other devices, as well as manage IP addresses and cables.
- Device42: A commercial IT infrastructure management solution that provides features for discovering, visualizing, and documenting network assets. It offers capabilities for IPAM, CMDB (configuration management database), and IT asset management.
- NetDisco: An open-source network management tool that provides features for discovering and documenting network devices, including switches, routers, and access points. It offers SNMP-based device discovery and a web interface for visualization.
- OpenNMS: An open-source network monitoring and management platform that offers features for discovering, monitoring, and managing network devices and services. It provides capabilities for fault management, performance monitoring, and event correlation.
- Grafana Loki: While primarily a log aggregation and monitoring tool, Grafana Loki can be used for collecting and querying metadata about network devices and services. It integrates well with other Grafana components for visualization and alerting.
These alternatives vary in terms of features, scalability, deployment options, and licensing models. Organizations should evaluate their specific requirements and priorities to choose the most suitable solution for their network management needs.
Server Specification for NetBox Installation
We are using a minimal RHEL 8 installation with following specifications.
- CPU – 3.4 Ghz (2 cores)
- Memory – 2 GB
- Storage – 40 GB
- Operating System – Red Hat Enterprise Linux 8.5
- Hostname – netbox-01.centlinux.com
- IP Address – 192.168.116.243 /24
For setting up NetBox on RHEL 8, having a reliable and flexible environment is essential. Many Linux enthusiasts and professionals prefer using a Mini PC or a VPS to create an efficient home lab for hands-on experimentation and server management. A Mini PC offers the advantage of a dedicated physical machine with great portability and energy efficiency, perfect for running Linux servers continuously at home.
[Grab a Mini PC for your Home Lab – Shop with Us!]
Alternatively, a Rose Hosting VPS provides scalable cloud resources with excellent uptime and network performance, ideal for remote access and testing in various network scenarios.
[Launch Your Own VPS with Rose Hosting – Click to Get Started!]
Both options work well depending on your budget and needs, empowering you to explore and learn Linux server administration with practical experience. Consider trying these for your NetBox installation — using the affiliate links above supports this blog at no extra cost to you.
Disclaimer: This post contains affiliate links, and if you purchase through them, I may earn a small commission at no additional cost to you. Your support helps keep this Linux tech content free and up to date.
Upgrade your Linux Operating System
It is a best practice to update your existing software packages, before installing a new software on your Linux operating system.
Connect with netbox-01.centlinux.com as root user by using a ssh client.
Build cache for your enabled yum repositories.
dnf makecacheOutput:
Updating Subscription Management repositories.
Red Hat Enterprise Linux 8 for x86_64 - BaseOS 2.6 kB/s | 4.1 kB 00:01
Red Hat CodeReady Linux Builder for RHEL 8 x86_ 3.7 kB/s | 4.5 kB 00:01
Red Hat Enterprise Linux 8 for x86_64 - AppStre 2.7 kB/s | 4.5 kB 00:01
Last metadata expiration check: 0:00:09 ago on Sat 13 Nov 2021 10:17:01 AM EST.
Metadata cache created.
Execute dnf command at Linux bash prompt to update existing software packages in your Linux operating system.
dnf update -yIf the above command updates your Linux Kernel, then reboot your operating system before moving forward.
rebootVerify the Linux Kernel and operating system versions.
uname -r
cat /etc/os-releaseOutput:
4.18.0-348.el8.x86_64
NAME="Red Hat Enterprise Linux"
VERSION="8.5 (Ootpa)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="8.5"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Red Hat Enterprise Linux 8.5 (Ootpa)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:8::baseos"
HOME_URL="https://www.redhat.com/"
DOCUMENTATION_URL="https://access.redhat.com/documentation/red_hat_enterprise_linux/8/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 8"
REDHAT_BUGZILLA_PRODUCT_VERSION=8.5
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="8.5"
Installing NetBox Prerequisites
Install PostgreSQL on Linux Server
NetBox supports PostgreSQL 9.6 or higher. It currently does not support MySQL and other relational databases.
PostgreSQL 10 is available in standard yum repositories. Therefore, you can easily install it by using dnf command.
dnf install -y postgresql-serverInitialized the PostgreSQL database server by executing following command at Linux bash prompt.
postgresql-setup --initdbOutput:
* Initializing database in '/var/lib/pgsql/data'
* Initialized, logs are in /var/lib/pgsql/initdb_postgresql.log
PostgreSQL by default uses host-based authentication. But you need to enable credential-based authentication for NetBox software.
Edit pg_hba.conf file by using vim text editor.
vi /var/lib/pgsql/data/pg_hba.confLocate following lines in this file.
host all all 127.0.0.1/32 ident
host all all ::1/128 identand change the ident with md5 to enable credential-based authentication.
host all all 127.0.0.1/32 md5
host all all ::1/128 md5Enable and start PostgreSQL database service.
systemctl enable --now postgresql.serviceConnect to psql prompt.
sudo -u postgres psqlCreate a database and an user for NetBox application.
CREATE DATABASE netbox;
CREATE USER netbox WITH PASSWORD '123';
GRANT ALL PRIVILEGES ON DATABASE netbox TO netbox;
qTest the database connectivity by executing following command.
sudo -u postgres psql --username netbox --password --host 127.0.0.1 netboxPostgreSQL database server has been installed and configured successfully.
Read Also: IP Subnet Calculator for IPv4
Install Redis on Linux Server
Redis is an in-memory key-value store, and NetBox uses it for caching and queuing.
Redis software is available in standard yum repositories. Therefore, install it by executing following Linux command.
dnf install -y redisEnable and start Redis service as follows.
systemctl enable --now redis.serviceExecute following command at Linux bash prompt to verify the status of Redis service.
redis-cli pingOutput:
PONG
Install Python on Linux Server
NetBox required Python 3.7 or later.
The default yum repositories of CentOS / RHEL 8 do not provide Python 3.7. However, you can install it by downloading the zip archive from Python official website.
But, you should install the prerequisite software packages on your Linux server before installing Python 3.7.
dnf install -y gcc make openssl-devel bzip2-devel libffi-devel wget git libxml2-devel libxslt-devel libpq-devel redhat-rpm-configBy using wget command download Python 3.7 to your Linux server.
wget https://www.python.org/ftp/python/3.7.9/Python-3.7.9.tgzExtract downloaded Tarball by using following Linux command.
tar xzf Python-3.7.9.tgzConfigure and install Python 3.7 into your Linux server.
cd Python-3.7.9
./configure --enable-optimizations
make altinstallCreate a soft link for python3.7 executable as follows.
ln -s /usr/local/bin/python3.7 /usr/local/bin/python3Verify the installation by checking the version of Python.
python3 -VOutput:
Python 3.7.9
Before moving forward, update pip (Python Package Management Tool) to the latest release.
pip3.7 install --upgrade pipOutput:
Collecting pip
Downloading pip-21.3.1-py3-none-any.whl (1.7 MB)
|████████████████████████████████| 1.7 MB 99 kB/s
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 20.1.1
Uninstalling pip-20.1.1:
Successfully uninstalled pip-20.1.1
Successfully installed pip-21.3.1
Install Netbox on RHEL 8
Create the base directory for NetBox installation.
mkdir -p /opt/netbox/By using git command, clone the master branch of NetBox GitHub repository. This branch always holds the current stable release.
cd /opt/netbox/
git clone -b master --depth 1 https://github.com/netbox-community/netbox.git .Output:
Cloning into '.'...
remote: Enumerating objects: 1044, done.
remote: Counting objects: 100% (1044/1044), done.
remote: Compressing objects: 100% (962/962), done.
remote: Total 1044 (delta 180), reused 386 (delta 58), pack-reused 0
Receiving objects: 100% (1044/1044), 4.28 MiB | 263.00 KiB/s, done.
Resolving deltas: 100% (180/180), done.
Create a system user to own NetBox software and processes. Later in this tutorial, you will configure the WSGI and HTTP services to run under this account.
You should also assign the ownership of media directory to this user. This ensures that NetBox will be able to save uploaded files therein.
groupadd --system netbox
adduser --system -g netbox netbox
chown --recursive netbox /opt/netbox/netbox/media/Create NetBox configuration file from template.
cd /opt/netbox/netbox/netbox/
cp configuration.example.py configuration.pyEdit Netbox configuration file by using vim text editor.
vi configuration.pyLocate and set following four directives in this file.
ALLOWED_HOSTS = ['*']
DATABASE = {
'NAME': 'netbox', # Database name
'USER': 'netbox', # PostgreSQL username
'PASSWORD': '123', # PostgreSQL password
'HOST': 'localhost', # Database server
'PORT': '', # Database port (leave blank for default)
'CONN_MAX_AGE': 300, # Max database connection age
}
REDIS = {
'tasks': {
'HOST': 'localhost', # Redis server
'PORT': 6379, # Redis port
'PASSWORD': '', # Redis password (optional)
'DATABASE': 0, # Database ID
'SSL': False, # Use SSL (optional)
},
'caching': {
'HOST': 'localhost',
'PORT': 6379,
'PASSWORD': '',
'DATABASE': 1, # Unique ID for second database
'SSL': False,
}
}
SECRET_KEY = '^Juy^bAT2bmFRYVnJHVg0&YkkFyM=-PODj*4zZM@th2@C)_$Jv'You can execute following command at Linux Bash prompt to generate a SECRET_KEY for your NetBox server.
python3.7 ../generate_secret_key.pyOutput:
^Juy^bAT2bmFRYVnJHVg0&YkkFyM=-PODj*4zZM@th2@C)_$Jv
Once NetBox has been configured, you are ready to proceed with the actual installation.
Execute upgrade.sh script to install NetBox on Linux server.
/opt/netbox/upgrade.shOutput:
...
WARNING: No existing virtual environment was detected. A new one has
been created. Update your systemd service files to reflect the new
Python and gunicorn executables. (If this is a new installation,
this warning can be ignored.)
netbox.service ExecStart:
/opt/netbox/venv/bin/gunicorn
netbox-rq.service ExecStart:
/opt/netbox/venv/bin/python
After modifying these files, reload the systemctl daemon:
> systemctl daemon-reload
--------------------------------------------------------------------
Upgrade complete! Don't forget to restart the NetBox services:
> sudo systemctl restart netbox netbox-rq
Netbox does not have a predefined user account. Therefore, you have to create a superuser (administrative account) to be able to login to NetBox.
Create a Python virtual environment.
source /opt/netbox/venv/bin/activateExecute the following commands within Python virtual environment to create a superuser for NetBox software.
cd /opt/netbox/netbox
python3 manage.py createsuperuserOutput:
Username (leave blank to use 'root'):
Email address: root@netbox-01.centlinux.com
Password:
Password (again):
Superuser created successfully.
NetBox provides a housekeeping script that clears out old sessions and expired change records. You can run this command manually, but it is recommended to configure it as a cron job.
ln -s /opt/netbox/contrib/netbox-housekeeping.sh /etc/cron.daily/netbox-housekeepingAllow the required service port in Linux firewall. We are not making it permanent, because NetBox will be configured to access via HTTP web server.
firewall-cmd --add-port=8000/tcpStart the NetBox service by executing following command at Linux bash prompt.
python3 manage.py runserver 0.0.0.0:8000 --insecureOutput:
Performing system checks...
System check identified no issues (0 silenced).
November 14, 2021 - 18:40:39
Django version 3.2.9, using settings 'netbox.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.
Open URL http://netbox-01.centlinux.com:8000 in a web browser.

Create Systemd Service for NetBox
NetBox runs as a WSGI application behind an HTTP server. For this purpose, you can use gunicorn (which is installed with NetBox).
NetBox shipped with a default configuration file for gunicorn. Copy it into NetBox base directory.
cp /opt/netbox/contrib/gunicorn.py /opt/netbox/gunicorn.pyNetBox also provides Systemd service units. Copy them into Systemd configuration directory.
cp -v /opt/netbox/contrib/*.service /etc/systemd/system/Enable and start NetBox services.
systemctl enable --now netbox netbox-rqWe will configure NetBox on HTTPS protocol. Therefore, you may need a SSL certificate for NetBox application.
Create a self-signed SSL certificate or generate a CSR (Certificate Signing Request) and get it signed by the CA (You have to configure a Certificate Authority (CA) for your Network).
You can generate a self-signed SSL certificate by executing following Linux commands.
mkdir /etc/ssl/private
openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
-keyout /etc/ssl/private/netbox.key \
-out /etc/ssl/certs/netbox.crtOutput:
Generating a RSA private key
...........+++++
.......................................................................+++++
writing new private key to '/etc/ssl/private/netbox.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:PK
State or Province Name (full name) []:Sindh
Locality Name (eg, city) [Default City]:Karachi
Organization Name (eg, company) [Default Company Ltd]:CentLinux
Organizational Unit Name (eg, section) []:IT Lab
Common Name (eg, your name or your server's hostname) []:netbox-01.centlinux.com
Email Address []:root@netbox-01.centlinux.com
Install Nginx on RHEL 8
We are configuring NetBox as a WSGI service, therefore you need a web server to provide HTTP access to NetBox application.
You can either use Apache or Nginx for this purpose. But we are using Nginx in this tutorial.
Install Nginx web server by using dnf command.
dnf install -y nginxEdit Nginx configuration file by using vim text editor.
vi /etc/nginx/nginx.confDisable default server block and add following lines therein.
server {
listen [::]:443 ssl ipv6only=off;
# CHANGE THIS TO YOUR SERVER'S NAME
server_name netbox.example.com;
ssl_certificate /etc/ssl/certs/netbox.crt;
ssl_certificate_key /etc/ssl/private/netbox.key;
client_max_body_size 25m;
location /static/ {
alias /opt/netbox/netbox/static/;
}
location / {
proxy_pass http://127.0.0.1:8001;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
server {
# Redirect HTTP traffic to HTTPS
listen [::]:80 ipv6only=off;
server_name _;
return 301 https://$host$request_uri;
}Enable and start Nginx service.
systemctl enable --now nginx.serviceAllow HTTP & HTTPS services in Linux firewall.
firewall-cmd --permanent --add-service=http,https
firewall-cmd --reloadAdjust SELinux boolean, so your web server can communicate to NetBox service.
setsebool -P httpd_can_network_connect 1Open URL https://netbox-01.centlinux.com in a web browser.

Your NetBox server has been configured successfully.
Final Thoughts
Installing NetBox on RHEL 8 can be straightforward if you follow the right steps. This guide is designed to provide you with clear and detailed instructions to ensure a smooth installation and setup process. However, if you encounter any issues or prefer professional assistance, I’m here to help.
Struggling with AWS or Linux server issues? I specialize in configuration, troubleshooting, and security to keep your systems performing at their best. Check out my Freelancer profile for details.
FAQs
Q1: Can I install NetBox on a RHEL 8 minimal installation without a GUI?
Yes, NetBox can be installed and managed entirely via the command line on a minimal RHEL 8 server without a graphical interface.
Q2: Is it necessary to use a Python virtual environment for NetBox on RHEL 8?
While not strictly required, using a Python virtual environment is best practice to isolate NetBox dependencies and avoid conflicts with system-wide packages.
Q3: How do I secure NetBox’s PostgreSQL database on RHEL 8?
You should configure PostgreSQL to accept connections only from localhost, enforce strong passwords, and regularly apply PostgreSQL updates.
Q4: What permissions should the NetBox service user have on RHEL 8?
The NetBox service user should have read/write access only to NetBox files and directories and limited system privileges to enhance security.
Q5: Can I run multiple NetBox instances on the same RHEL 8 server?
Yes, by using separate Python virtual environments, different configuration files, and distinct database schemas or PostgreSQL instances, multiple NetBox deployments can coexist.
Recommended Courses
If you’re new to IT and want to build a solid foundation, “Introduction to Computer Networks for Non-Techies” by Alton Hardin is the perfect place to start. This beginner-friendly course explains networking concepts in simple, non-technical language, helping you understand how the internet, Wi-Fi, IP addresses, and servers actually work. Whether you’re exploring a career in tech or just want to improve your digital skills, this course gives you practical knowledge without overwhelming jargon. You can enroll through my affiliate link below and start learning today.
Disclaimer: This post contains affiliate links. If you make a purchase through these links, I may earn a small commission at no additional cost to you.

Leave a Reply
Please log in to post a comment.