This section of the documentation discusses installing and configuring the NetBox application.


Python 3 is strongly encouraged for new installations. Support for Python 2 will be discontinued in the near future. This documentation includes a guide on migrating from Python 2 to Python 3.


Python 3:

# apt-get install -y python3 python3-dev python3-setuptools build-essential libxml2-dev libxslt1-dev libffi-dev graphviz libpq-dev libssl-dev zlib1g-dev
# easy_install3 pip

Python 2:

# apt-get install -y python2.7 python-dev python-setuptools build-essential libxml2-dev libxslt1-dev libffi-dev graphviz libpq-dev libssl-dev zlib1g-dev
# easy_install pip


Python 3:

# yum install -y epel-release
# yum install -y gcc python34 python34-devel python34-setuptools libxml2-devel libxslt-devel libffi-devel graphviz openssl-devel redhat-rpm-config
# easy_install-3.4 pip

Python 2:

# yum install -y epel-release
# yum install -y gcc python2 python-devel python-setuptools libxml2-devel libxslt-devel libffi-devel graphviz openssl-devel redhat-rpm-config
# easy_install pip

You may opt to install NetBox either from a numbered release or by cloning the master branch of its repository on GitHub.

Option A: Download a Release

Download the latest stable release from GitHub as a tarball or ZIP archive and extract it to your desired path. In this example, we'll use /opt/netbox.

# wget
# tar -xzf vX.Y.Z.tar.gz -C /opt
# cd /opt/
# ln -s netbox-X.Y.Z/ netbox
# cd /opt/netbox/

Option B: Clone the Git Repository

Create the base directory for the NetBox installation. For this guide, we'll use /opt/netbox.

# mkdir -p /opt/netbox/ && cd /opt/netbox/

If git is not already installed, install it:


# apt-get install -y git


# yum install -y git

Next, clone the master branch of the NetBox GitHub repository into the current directory:

# git clone -b master .
Cloning into '.'...
remote: Counting objects: 1994, done.
remote: Compressing objects: 100% (150/150), done.
remote: Total 1994 (delta 80), reused 0 (delta 0), pack-reused 1842
Receiving objects: 100% (1994/1994), 472.36 KiB | 0 bytes/s, done.
Resolving deltas: 100% (1495/1495), done.
Checking connectivity... done.


Ensure that the media directory (/opt/netbox/netbox/media/ in this example) and all its subdirectories are writable by the user account as which NetBox runs. If the NetBox process does not have permission to write to this directory, attempts to upload files (e.g. image attachments) will fail. (The appropriate user account will vary by platform.)

# chown -R netbox:netbox /opt/netbox/netbox/media/

Install Python Packages

Install the required Python packages using pip. (If you encounter any compilation errors during this step, ensure that you've installed all of the system dependencies listed above.)

Python 3:

# pip3 install -r requirements.txt

Python 2:

# pip install -r requirements.txt


If you encounter errors while installing the required packages, check that you're running a recent version of pip (v9.0.1 or higher) with the command pip -V or pip3 -V.

NAPALM Automation

As of v2.1.0, NetBox supports integration with the NAPALM automation library. NAPALM allows NetBox to fetch live data from devices and return it to a requester via its REST API. Installation of NAPALM is optional. To enable it, install the napalm package using pip or pip3:

# pip3 install napalm


Move into the NetBox configuration directory and make a copy of named

# cd netbox/netbox/
# cp

Open with your preferred editor and set the following variables:



This is a list of the valid hostnames by which this server can be reached. You must specify at least one name or IP address.


ALLOWED_HOSTS = ['', '']


This parameter holds the database configuration details. You must define the username and password used when you configured PostgreSQL. If the service is running on a remote host, replace localhost with its address.


    'NAME': 'netbox',               # Database name
    'USER': 'netbox',               # PostgreSQL username
    'PASSWORD': 'J5brHrAXFLQSif0K', # PostgreSQL password
    'HOST': 'localhost',            # Database server
    'PORT': '',                     # Database port (leave blank for default)


Generate a random secret key of at least 50 alphanumeric characters. This key must be unique to this installation and must not be shared outside the local system.

You may use the script located at netbox/ to generate a suitable key.


In the case of a highly available installation with multiple web servers, SECRET_KEY must be identical among all servers in order to maintain a persistent user session state.

Run Database Migrations


The examples on the rest of this page call the python3 executable. Replace this with python2 or python if you're using Python 2.

Before NetBox can run, we need to install the database schema. This is done by running python3 migrate from the netbox directory (/opt/netbox/netbox/ in our example):

# cd /opt/netbox/netbox/
# python3 migrate
Operations to perform:
  Apply all migrations: dcim, sessions, admin, ipam, utilities, auth, circuits, contenttypes, extras, secrets, users
Running migrations:
  Rendering model states... DONE
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK

If this step results in a PostgreSQL authentication error, ensure that the username and password created in the database match what has been specified in

Create a Super User

NetBox does not come with any predefined user accounts. You'll need to create a super user to be able to log into NetBox:

# python3 createsuperuser
Username: admin
Email address:
Password (again):
Superuser created successfully.

Collect Static Files

# python3 collectstatic --no-input

You have requested to collect static files at the destination
location as specified in your settings:


This will overwrite existing files!
Are you sure you want to do this?

Type 'yes' to continue, or 'no' to cancel: yes

Load Initial Data (Optional)

NetBox ships with some initial data to help you get started: RIR definitions, common devices roles, etc. You can delete any seed data that you don't want to keep.


This step is optional. It's perfectly fine to start using NetBox without using this initial data if you'd rather create everything from scratch.

# python3 loaddata initial_data
Installed 43 object(s) from 4 fixture(s)

Test the Application

At this point, NetBox should be able to run. We can verify this by starting a development instance:

# python3 runserver --insecure
Performing system checks...

System check identified no issues (0 silenced).
June 17, 2016 - 16:17:36
Django version 1.9.7, using settings 'netbox.settings'
Starting development server at
Quit the server with CONTROL-C.

Now if we navigate to the name or IP of the server (as defined in ALLOWED_HOSTS) we should be greeted with the NetBox home page. Note that this built-in web service is for development and testing purposes only. It is not suited for production use.


If the test service does not run, or you cannot reach the NetBox home page, something has gone wrong. Do not proceed with the rest of this guide until the installation has been corrected.