How to Install NetBox on Ubuntu 22.04?

NetBox is an open-source, web-based tool used for IP Address Management (IPAM) and Data Center Infrastructure Management (DCIM). Designed for network engineers and system administrators, it helps document and manage computer networks with efficiency. Built with Python and the Django framework, it offers a user-friendly interface for managing complex network topologies.

In this tutorial, we’ll walk through the steps to install and configure NetBox on Ubuntu 22.04.

 

Step 1: Update Your System

Before beginning the installation, update your system packages:

sudo apt update && sudo apt upgrade -y

 

Step 2: Install Required Dependencies

Install all necessary packages for running NetBox:

sudo apt install -y git python3 python3-pip python3-venv libpq-dev libjpeg-dev libxml2-dev libxslt1-dev zlib1g-dev libffi-dev libssl-dev

 

Step 3: Create a Dedicated NetBox User

To keep NetBox isolated, create a new system user:

sudo adduser --system --group netbox

 

Step 4: Clone the NetBox Source Code

Download the latest NetBox code from GitHub and set the proper permissions:

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

 

Step 5: Configure NetBox

Copy the example configuration and edit it:

cd /opt/netbox/netbox
sudo cp configuration.example.py configuration.py
sudo nano configuration.py

Set a unique SECRET_KEY and configure your database settings accordingly.

 

Step 6: Set Up Python Virtual Environment

To manage dependencies cleanly, set up a Python virtual environment:

cd /opt/netbox
python3 -m venv venv
source venv/bin/activate

Install the required Python packages:

pip3 install -r requirements.txt

 

Step 7: Initialize the Database

Run the initial database migrations and set up an admin account:

./manage.py migrate
./manage.py createsuperuser
./manage.py collectstatic

 

Step 8: Run the NetBox Development Server

Start the development server to verify the installation:

./manage.py runserver 0.0.0.0:8000

Now you can access the NetBox interface by visiting:

http://your-server-ip:8000

 

Conclusion

You’ve now successfully installed NetBox on Ubuntu 22.04. This powerful IPAM and DCIM solution helps you manage and document your network infrastructure efficiently. For production environments, consider deploying NetBox behind a reverse proxy and configuring it with a proper database and caching service.

Facebook
Twitter
LinkedIn
Reddit
WhatsApp
Telegram
Email
Print