Netbox is a popular open-source IP address management (IPAM) and data center infrastructure management (DCIM) tool. Netbox is available for installation on a variety of platforms, including NixOS.
In this tutorial, we will guide you through the installation process of Netbox on NixOS Latest.
To install Netbox on NixOS Latest, you will need:
Before starting with the Netbox installation on NixOS, we need to install some required packages. First, open a terminal and run the following command as an administrator:
sudo su
Next, install the following packages:
nix-env -i python3 python3-pip gcc libxslt libxml2 libffi openssl postgresql_12
The python3-pip
package is required for installing additional Python packages. The gcc
, libxslt
, libxml2
, libffi
, and openssl
packages are required for building Python packages like psycopg2
and pyopenssl
. And finally, we need the postgresql_12
package for setting up the PostgreSQL database for Netbox.
Next, we need to set up the PostgreSQL database for Netbox. To do this, login as the postgres
user and create a new database and user:
sudo su - postgres
createdb netbox
psql -c "CREATE USER netbox WITH PASSWORD '<password>';"
psql -c "GRANT ALL PRIVILEGES ON DATABASE netbox TO netbox;"
exit
Replace <password>
with a strong password for the netbox
user.
Now, we can proceed with the Netbox installation. Start by cloning the Netbox repository from GitHub:
git clone -b v3.1.7 --depth 1 https://github.com/netbox-community/netbox.git
cd netbox/
The v3.1.7
branch is the current stable release of Netbox at the time of writing this tutorial. You can check for the latest release on the Netbox GitHub page.
Next, create a Python virtual environment and activate it:
python3 -m venv venv
source venv/bin/activate
Now, let’s install the required Python packages:
pip3 install --upgrade pip
pip3 install -r requirements.txt
Next, we need to create a configuration file for Netbox:
cd netbox/
cp netbox/netbox/configuration.example.py netbox/netbox/configuration.py
Open the configuration.py
file in your preferred text editor and modify the following settings:
ALLOWED_HOSTS = ['*']
DATABASE = {
'NAME': 'netbox',
'USER': 'netbox',
'PASSWORD': '<password>',
'HOST': 'localhost',
'PORT': '',
'CONN_MAX_AGE': 300,
'ENGINE': 'django.db.backends.postgresql',
}
Replace <password>
with the password you set earlier for the netbox
database user.
We are now ready to start Netbox on NixOS. First, let’s create the static files:
cd netbox/
sudo python3 manage.py collectstatic --no-input
Next, we can start the Netbox development server:
sudo python3 manage.py runserver 0.0.0.0:8000
You should now be able to access Netbox by going to http://
Congratulations! You have successfully installed Netbox on NixOS Latest. Netbox is a powerful tool for managing IP addresses and infrastructure, and can be customized to fit your specific needs.
If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!
Alternatively, for the best virtual desktop, try Shells!