There are a couple of ways you can install Netbox. The first one is a little time-consuming bare-bones method while the second one leverages docker and is just plug and play method. Let’s take a look at Netbox Docker installation method but If you aren’t familiar with Docker, here is a 5 part series that you can refer to for a better understanding of docker.
https://networkautomationlane.in/what-is-docker-for-network-engineers-part-i/
https://networkautomationlane.in/what-is-docker-for-network-engineers-part-ii/
https://networkautomationlane.in/what-is-docker-for-network-engineers-partiii/
https://networkautomationlane.in/what-is-docker-for-network-engineers-partiv/
https://networkautomationlane.in/docker-for-network-engineers-part-v-docker-compose/
- You can find more information about Netbox installation here
- For docker install method, please read below
Here is the public instance of Netbox that you can access to get the look and feel of the tool.
Netbox Docker installation
- Download and install docker based upon your platform.
- Clone netbox docker git to a location on your system
git clone -b release https://github.com/netbox-community/netbox-docker.git
cd netbox-docker
3. Should you wish to hardcode the port at which netbox run’s on, we need to create a new file to do so otherwise nextbox will listen on a random port.
nano docker-compose.override.yml
version: '3.4'
services:
netbox:
ports:
- 8000:8080
# 8000:8080 means port 8000 on your local machine is mapped to port 8080 of the docker container.
# You could change 8000 to any port that you want to access this docker container on.
4. This is how the directory structure will look like
╰─ tree -L 1 ─╯
.
├── Dockerfile
├── LICENSE
├── README.md
├── VERSION
├── build-functions
├── build-latest.sh
├── build.sh
├── configuration
├── docker
├── docker-compose.override.yml
├── docker-compose.override.yml.example
├── docker-compose.test.yml
├── docker-compose.yml
├── env
├── initializers
├── pyproject.toml
├── release.sh
├── renovate.json
├── reports
├── requirements-container.txt
├── scripts
├── startup_scripts
└── test.sh
5. Make sure the docker engine is up and running before executing the below commands.
docker-compose pull
# This step might take a few minutes depending upon your internet bandwidth.
# It is in this step that docker will download all the dependencies required for Netbox to run as a container on your machine.
This is how the output of this command looks.
6. Once it’s completed, execute the “docker-compose up” command to bring up the container and you should be able to access it once it’s up and running. Wait until the command stops producing any more output or you can see “Finished” on the screen at the bottom before the application is available to access via browser. You can also verify if the container is up and running using CLI “docker ps”.
or using GUI on the docker client.
7. Access the application on “http://0.0.0.0:8000/” on your web browser or whichever port that you specified in the YAML file above while creating the docker container. The default credentials to log in are “admin” “admin” and the default API key is “0123456789abcdef0123456789abcdef01234567” which you can otherwise get from by clicking on “Admin on top right corner > Profile and settings > API Token”
UPDATE:-
If admin/admin doesn’t work, you are required to create the first admin superuser by this command
To create the first admin user run this command:
docker compose exec netbox /opt/netbox/netbox/manage.py createsuperuser https://github.com/netbox-community/netbox-docker/wiki/Getting-Started
Reference
https://github.com/netbox-community/netbox-docker/wiki/Getting-Started
How to update a netbox docker
https://github.com/netbox-community/netbox-docker/wiki/Updating
Hello very nice article thanks, However I am not able to login in with admin – admin? Am I doing something wrong? Is it in the format of admin and passwd admin+api-token-here in the password field? Sorry for the stupid question.
Thanks,
It seems, you are required to create the first admin user using this instruction. The instructions over the time probably changed. This github link has the updated instructions.
https://github.com/netbox-community/netbox-docker/wiki/Getting-Started
To create the first admin user run this command:
docker compose exec netbox /opt/netbox/netbox/manage.py createsuperuser
Where is your docker-compse up command?
docker-compose pull should have been followed by docker-compose up. Thank you for catching that… I have made the correction and updated the content….