This tutorial covers the installation of Netbox onto Ubuntu Server version 19.1.

As always start with updating your apt repository. Once updated install the required preqs for installation including git which we will use to clone the latest version of netbox. Run the commands individually.

sudo apt-get update
sudo apt-get install -y postgresql libpq-dev
sudo apt-get install -y python3 python3-pip python3-dev build-essential libxml2-dev libxslt1-dev libffi-dev libpq-dev libssl-dev redis-server zlib1g-dev

Once installed you need to create a new database and user.

sudo -u postgres psql


CREATE USER netbox WITH PASSWORD 'password';



Now create the following directory and navigate to /opt

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

Now clone the netbox installation files from github and install the python preqs.

sudo git clone -b master

cd netbox

sudo pip3 install -r requirements.txt

sudo pip3 install napalm
sudo  pip3 install django-storages

cd netbox/netbox/

Now copy the example configuration file and edit with your preferred IP username and password.

sudo cp

sudo vim

The required fields are ALLOWED_HOSTS, NAME, USER, PASSWORD and SECRET_KEY in the DATABASE section of the configuration file. The allowed hosts field is not the IP addresses allowed to access the system, but the IPs or hostnames that netbox will be reachable from. For example, my VM has an IP of So my allowed hosts configuration would look like this the below.

SECRET_KEY must be at least 50 characters long.


For those unfamiliar with editing using vim, press i to enter edit mode and press Esc to exit edit mode. Then type :wq! to save write to file(save) and quit.

Now move back into the top level netbox folder and run the database migration script.

cd ..

sudo python3 migrate

Now create an admin user for Netbox.

sudo python3 createsuperuser

Now run the last two admin tasks and start the netbox server.

sudo python3 collectstatic --no-input

sudo python3 runserver --insecure

If you require more information on operating netbox see


Leave a Reply