We will assume that you work in the folder ~/code/netbox_plugin/
, change this if you use another folder for your projects/code.
NOTE: these requirements are needed if you want install Postgresql & Redis native. Check the steps for docker & docker-compose if you don't want this.
Make sure that you have already installed Postgresql and Redis. Also make sure that the database has already been created and privileges has been granted as described in the NetBox installation instructions at https://docs.netbox.dev/en/stable/installation/.
In short:
sudo apt update
sudo apt install -y postgresql
sudo systemctl start postgresql
sudo systemctl enable postgresql
sudo -u postgres psql
CREATE DATABASE netbox;
CREATE USER netbox WITH PASSWORD 'J5brHrAXFLQSif0K';
GRANT ALL PRIVILEGES ON DATABASE netbox TO netbox;
sudo apt install -y redis-server
NOTE: if you used the 'native' prerequisites you can skip these steps below
This depends on your OS or how you want to install docker.
See https://docs.docker.com/engine/install/ to find the install steps.
This also depends on your OS, see the link below:
https://docs.docker.com/compose/install/linux/
mkdir ~/code/netbox_plugin/
cd ~/code/netbox_plugin/
You will need the following packages installed:
- python3-venv
- python3
Install them with your OS package manager (apt, yum, ...)
Follow the steps on the repo below to install npm:
https://github.com/nvm-sh/nvm#installing-and-updating
python3 -m venv ~/code/netbox_plugin/.venvs/netbox
source ~/code/netbox_plugin/.venvs/netbox/bin/activate
cd ~/code/netbox_plugin/
git clone git@github.com:netbox-community/netbox.git netbox
cd netbox
python3 -m pip install -r requirements.txt
cd ~/code/netbox_plugin/
git clone git@github.com:mattieserver/netbox-topology-views.git plugin
python3 -m pip install --upgrade build setuptools wheel
cd ~/code/netbox_plugin/
cp plugin/dev_setup/configuration.py netbox/netbox/netbox/configuration.py
NOTE: if you used the 'native' prerequisites you can skip to 'Start netbox'
cd ~/code/netbox_plugin/
cd plugin/dev_setup
docker-compose up -d
cd ~/code/netbox_plugin/
source ~/code/netbox_plugin/.venvs/netbox/bin/activate
cd netbox/netbox/
python3 manage.py migrate
python3 manage.py runserver
You might need to create a superuser if you want to start with an empty database: python3 manage.py createsuperuser
cd ~/code/netbox_plugin/
source ~/code/netbox_plugin/.venvs/netbox/bin/activate
cd plugin/
python3 setup.py develop
cd plugin/netbox_topology_views/static_dev
npm install
npm run bundle
You can now browse to http://localhost:8000.
The plugin should be available in the menu.
If you want to add demo data instead of your own data, there's an official Repository you can use. The following example shows how to add demo data for NetBox v3.4. You have to use the json file according to the version you are working on.
~/code/netbox_plugin/
git clone git@github.com:netbox-community/netbox-demo-data.git demodata
source ~/code/netbox_plugin/.venvs/netbox/bin/activate
cd netbox/netbox/
python3 manage.py loaddata -v 3 ~/src/netbox-demo-data/netbox-demo-v3.4.json
Please note that the demo data adds a superuser with credentials admin/admin.