Installing NetBox on Fedora CoreOS Latest
NetBox is an open-source web-based IPAM (IP Address Management) and DCIM (Data Center Infrastructure Management) tool used to manage network address space and other critical infrastructure components. In this tutorial, we will go through the steps to install NetBox on Fedora CoreOS Latest.
Prerequisites
Before proceeding, make sure you have the following:
- A running instance of Fedora CoreOS Latest
- A sudo user
Steps
Update the system:
sudo dnf update -yInstall the required system packages:
sudo dnf install -y python3 python3-pip python3-devel nginx redis redis-devel gcc git openssl-develClone NetBox from Github:
git clone -b master https://github.com/digitalocean/netbox.gitCreate a virtual environment and activate it:
python3 -m venv netboxenvsource netboxenv/bin/activateInstall the required Python packages:
cd netbox pip install -r requirements.txtCreate a configuration file:
cp netbox/netbox/configuration.example.py netbox/netbox/configuration.pyEdit the configuration file with your preferences:
nano netbox/netbox/configuration.pyFor example, update the following settings with your preferences:
ALLOWED_HOSTS = ['your.host.name'] SECRET_KEY = 'your-secret-key' # Database DATABASES = { 'default': { 'NAME': 'netbox', 'USER': 'netbox', 'PASSWORD': 'yourpassword', 'HOST': 'localhost', 'PORT': '', 'ENGINE': 'django.db.backends.postgresql', }, } # Redis REDIS = { 'tasks': { 'HOST': 'localhost', 'PORT': 6379, 'PASSWORD': '', 'DATABASE': 0, 'DEFAULT_TIMEOUT': 300, }, }Create the PostgreSQL database:
sudo -u postgres psql -c "CREATE DATABASE netbox;" sudo -u postgres psql -c "CREATE USER netbox WITH PASSWORD 'yourpassword';" sudo -u postgres psql -c "ALTER USER netbox CREATEDB;" sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE netbox TO netbox;"Migrate the database:
python3 manage.py migrateCreate a superuser:
python3 manage.py createsuperuserStart the development server:
python3 manage.py runserver 0.0.0.0:8000Open your web browser and navigate to
http://your.host.name:8000/to access the NetBox web interface.Shutdown the development server by pressing
CTRL + C.Setup the Gunicorn launcher:
sudo cp contrib/gunicorn.py /etc/netbox/ sudo nano /etc/netbox/gunicorn.pyEdit the following lines:
bind = '127.0.0.1:8001' worker_class = 'gevent' workers = 4Start Gunicorn service:
sudo cp contrib/gunicorn.service /etc/systemd/system/ sudo systemctl enable gunicorn sudo systemctl start gunicorn sudo systemctl status gunicornSetup the Nginx web server:
sudo cp contrib/nginx.conf.sample /etc/nginx/conf.d/netbox.conf sudo nano /etc/nginx/conf.d/netbox.confEdit the following lines:
server { listen 80; server_name your.host.name; location /static/ { alias /opt/netbox/netbox/static/; } location / { proxy_pass http://localhost:8001; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } }Start the Nginx service:
sudo systemctl enable nginx sudo systemctl start nginx sudo systemctl status nginxOpen your web browser and navigate to
http://your.host.name/to access the NetBox web interface.
Conclusion
In this tutorial, we learned how to install NetBox on Fedora CoreOS Latest. Now you can start managing your network infrastructure using NetBox.