Installing Netbox on Fedora Server Latest
In this tutorial, we will guide you through the process of installing Netbox on a Fedora Server Latest.
Prerequisites
Before proceeding with the installation, make sure that you have the following prerequisites:
- A Fedora Server Latest with root access.
- Python3 and pip3 installed
- Git installed
Step 1: Update the System
It's a good practice to update the system before installing any new package. Run the following command to update the system:
sudo dnf update
Step 2: Install Required packages
Use the following command to install the packages required for Netbox.
sudo dnf install -y git vim-enhanced nginx postgresql-server postgresql-devel postgresql-contrib python3-pip supervisor
Step 3: Install Netbox
Clone the Netbox repository from Github using Git:
git clone -b master https://github.com/digitalocean/netbox.git
Once the repository is cloned, cd into the netbox directory and install the required packages using pip:
cd netbox
sudo pip3 install -r requirements.txt
Step 4: Configure PostgreSQL Server
Start the PostgreSQL service and create a new database and user for Netbox:
sudo systemctl start postgresql.service
sudo -u postgres psql
CREATE DATABASE netbox;
CREATE USER netboxuser WITH PASSWORD 'password123';
GRANT ALL PRIVILEGES ON DATABASE netbox TO netboxuser;
The username and password can be changed based on your preference.
Step 5: Configure Netbox
Copy the sample configuration file to the actual configuration file:
cd netbox/netbox
cp configuration.example.py configuration.py
Edit the configuration file and change the following values:
ALLOWED_HOSTS = ['your_domain_or_ip_address']
DATABASE = {
'NAME': 'netbox',
'USER': 'netboxuser',
'PASSWORD': 'password123',
'HOST': 'localhost',
'PORT': '',
'CONN_MAX_AGE': 300,
}
Step 6: Initiate the Database
Run the following command to initialize the database:
python3 manage.py migrate
Step 7: Create a Superuser
Run the following command to create a superuser:
python3 manage.py createsuperuser
Step 8: Start the Services
Create a Systemd service file for Netbox and Nginx:
sudo nano /etc/systemd/system/netbox.service
Add the following configuration:
[Unit]
Description=Netbox
After=network.target
[Service]
User=root
WorkingDirectory=/opt/netbox/netbox
Environment="DJANGO_SETTINGS_MODULE=netbox.settings"
ExecStart=/bin/bash -c '/usr/bin/python3 /opt/netbox/netbox/manage.py runserver 0.0.0.0:8000'
Restart=always
[Install]
WantedBy=multi-user.target
Save and close the file.
Create another service file for Nginx:
sudo nano /etc/systemd/system/nginx.service
Add the following configuration:
[Unit]
Description=nginx
After=network.target
[Service]
User=root
ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf
ExecReload=/usr/sbin/nginx -s reload
ExecStop=/usr/sbin/nginx -s stop
[Install]
WantedBy=multi-user.target
Save and close the file.
Finally, start the services:
sudo systemctl daemon-reload
sudo systemctl enable netbox.service nginx.service supervisord.service
sudo systemctl start netbox.service nginx.service supervisord.service
Step 9: Access Netbox
Open your web browser and go to http://your_domain_or_ip_address:8000. You should see the Netbox login page. Use the superuser credentials that you created earlier to log in.
Conclusion
Congratulations! You have successfully installed Netbox on a Fedora Server Latest. You can now start using Netbox to manage your network infrastructure.