설치 가이드 · 5 min read · Nov 19, 2025

Ubuntu 20.04 LTS에 NetBox 네트워크 문서화 및 관리 도구 설치하는 방법

Netbox는 무료이자 강력한 IP 주소(IPAM) 및 데이터 센터 인프라 관리(DCIM) 도구입니다. 이 도구는 네트워크, VM, 인벤토리 등과 관련된 정보를 저장하는 데 사용됩니다. 원래 DigitalOcean의 네트워크 엔지니어링 팀에 의해 개발되었습니다. 이 도구는 Django Python 프레임워크로 작성되었으며 PostgreSQL 데이터베이스에 의존합니다. 그 목적은 네트워크 운영을 위한 도메인 특정 진실의 출처로 기능하는 것입니다.

이 튜토리얼에서는 Ubuntu 20.04에서 Nginx를 리버스 프록시로 사용하여 Netbox를 설치하는 방법을 설명합니다.

전제 조건

  • Ubuntu 20.04를 실행하는 서버.
  • 서버에 루트 비밀번호가 설정되어 있어야 합니다.

시작하기

시작하기 전에 Netbox에 필요한 몇 가지 종속성을 설치해야 합니다. 다음 명령어를 실행하여 모두 설치할 수 있습니다:

apt-get install nginx git gcc supervisor python3 python3-dev python3-pip python3-setuptools build-essential libxml2-dev libxslt1-dev libffi-dev graphviz libpq-dev libssl-dev zlib1g-dev -y

모든 패키지가 설치되면 다음 단계로 진행할 수 있습니다.

PostgreSQL 데이터베이스 설치 및 구성

Netbox는 데이터 저장을 위해 PostgreSQL 데이터베이스에 의존합니다. 다음 명령어로 설치할 수 있습니다:

apt-get install postgresql postgresql-contrib -y

PostgreSQL이 설치되면 다음 명령어로 PostgreSQL에 로그인합니다:

su - postgres  
postgres@ubuntu2004:~$ psql

다음과 같은 출력이 표시되어야 합니다:

psql (12.2 (Ubuntu 12.2-4))
Type "help" for help.

다음으로, 다음 명령어로 Netbox를 위한 데이터베이스와 사용자를 생성합니다:

postgres=# CREATE DATABASE netbox;  
postgres=# CREATE USER netbox WITH PASSWORD 'password';

다음으로, 다음 명령어로 Netbox 데이터베이스에 모든 권한을 부여합니다:

postgres=# GRANT ALL PRIVILEGES ON DATABASE netbox TO netbox;

다음으로, 다음 명령어로 PostgreSQL 셸에서 나옵니다:

postgres=# exit  
postgres@ubuntu2004:~$ exit

NetBox 설치 및 구성

먼저, /opt 디렉토리로 변경하고 다음 명령어를 사용하여 Git Hub 리포지토리에서 Netbox의 최신 버전을 다운로드합니다:

cd /opt/  
git clone -b master https://github.com/digitalocean/netbox.git

다음으로, 다음 명령어로 Python 바이너리의 심볼릭 링크를 생성합니다:

ln -s /usr/bin/python3 /usr/bin/python

다음으로, /opt/netbox/netbox/ 디렉토리로 변경하고 다음 명령어를 실행하여 Django SECRET Key를 생성합니다:

cd /opt/netbox/netbox/  
./generate_secret_key.py

다음과 같은 출력이 표시되어야 합니다:

wcq@L2)eTDpo(k^f4Sm9bariUnK0syCPMGEIjW6XV_8l5xhB7z

다음으로, netbox 디렉토리로 변경하고 예제 구성 파일의 이름을 변경합니다:

cd netbox  
mv configuration.example.py configuration.py

다음으로, Netbox 구성 파일을 편집하고 데이터베이스, 비밀 키 및 허용된 호스트를 정의합니다:

nano configuration.py

다음과 같은 변경을 합니다:

ALLOWED_HOSTS = ['your-server-ip']

# PostgreSQL 데이터베이스 구성. 사용 가능한 매개변수의 전체 목록은 Django 문서를 참조하십시오:
#   https://docs.djangoproject.com/en/stable/ref/settings/#databases
DATABASE = {
    'NAME': 'netbox',         # 데이터베이스 이름
    'USER': 'netbox',               # PostgreSQL 사용자 이름
    'PASSWORD': 'password',           # PostgreSQL 비밀번호
    'HOST': 'localhost',      # 데이터베이스 서버
    'PORT': '',               # 데이터베이스 포트 (기본값을 위해 비워두기)
    'CONN_MAX_AGE': 300,      # 최대 데이터베이스 연결 연령
}

SECRET_KEY = 'wcq@L2)eTDpo(k^f4Sm9bariUnK0syCPMGEIjW6XV_8l5xhB7z'

파일을 저장하고 닫은 후, 다음 명령어로 모든 Python 종속성을 설치합니다:

pip3 install -r /opt/netbox/requirements.txt

다음으로, 다음 명령어로 데이터베이스를 마이그레이션합니다:

cd /opt/netbox/netbox/  
python3 manage.py migrate

다음으로, 다음 명령어로 Netbox 관리 사용자를 생성합니다:

python3 manage.py createsuperuser

다음과 같은 사용자 이름과 비밀번호를 제공하라는 메시지가 표시됩니다:

Username (leave blank to use 'root'): netboxadmin
Email address: [email protected]
Password: 
Password (again): 
Superuser created successfully.

다음으로, 다음 명령어로 정적 파일을 수집합니다:

python3 manage.py collectstatic

다음과 같은 출력이 표시되어야 합니다:

976 static files copied to '/opt/netbox/netbox/static'.

Gunicorn 설치 및 구성

Netbox는 Django 기반 애플리케이션입니다. 따라서 시스템에 Gunicorn을 설치해야 합니다. 다음 명령어를 실행하여 설치할 수 있습니다:

pip3 install gunicorn

Gunicorn을 설치한 후, 다음 명령어로 Netbox를 위한 새로운 Gunicorn 구성 파일을 생성합니다:

nano /opt/netbox/gunicorn_config.py

다음과 같은 줄을 추가합니다:

command = '/usr/local/bin/gunicorn'
pythonpath = '/opt/netbox/netbox'
bind = 'your-server-ip:8001'
workers = 3
user = 'www-data'

작업이 끝나면 파일을 저장하고 닫습니다.

Supervisor 설치 및 구성

Supervisor는 NetBox 서비스를 모니터링하고 제어할 수 있는 클라이언트/서버 시스템입니다. 다음 명령어로 Netbox를 위한 새로운 Supervisor 구성 파일을 생성할 수 있습니다:

nano /etc/supervisor/conf.d/netbox.conf

다음과 같은 줄을 추가합니다:

[program:netbox]
command = gunicorn -c /opt/netbox/gunicorn_config.py netbox.wsgi
directory = /opt/netbox/netbox/
user = www-data

작업이 끝나면 파일을 저장하고 닫습니다. 그런 다음, 다음 명령어로 Supervisor 서비스를 재시작합니다:

systemctl restart supervisor

다음 명령어를 사용하여 Supervisor 서비스의 상태를 확인할 수도 있습니다:

systemctl status supervisor

다음과 같은 출력이 표시되어야 합니다:

? supervisor.service - UNIX용 Supervisor 프로세스 제어 시스템
     Loaded: loaded (/lib/systemd/system/supervisor.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2020-05-30 05:49:08 UTC; 14s ago
       Docs: http://supervisord.org
   Main PID: 550606 (supervisord)
      Tasks: 5 (limit: 4691)
     Memory: 184.3M
     CGroup: /system.slice/supervisor.service
             ??550606 /usr/bin/python3 /usr/bin/supervisord -n -c /etc/supervisor/supervisord.conf
             ??550626 /usr/bin/python3 /usr/local/bin/gunicorn -c /opt/netbox/gunicorn_config.py netbox.wsgi
             ??550628 /usr/bin/python3 /usr/local/bin/gunicorn -c /opt/netbox/gunicorn_config.py netbox.wsgi
             ??550629 /usr/bin/python3 /usr/local/bin/gunicorn -c /opt/netbox/gunicorn_config.py netbox.wsgi
             ??550630 /usr/bin/python3 /usr/local/bin/gunicorn -c /opt/netbox/gunicorn_config.py netbox.wsgi

May 30 05:49:08 ubuntu2004 systemd[1]: Started Supervisor process control system for UNIX.
May 30 05:49:08 ubuntu2004 supervisord[550606]: 2020-05-30 05:49:08,664 CRIT Supervisor is running as root.  Privileges were not dropped becau>
May 30 05:49:08 ubuntu2004 supervisord[550606]: 2020-05-30 05:49:08,664 INFO Included extra file "/etc/supervisor/conf.d/netbox.conf" during p>
May 30 05:49:08 ubuntu2004 supervisord[550606]: 2020-05-30 05:49:08,671 INFO RPC interface 'supervisor' initialized
May 30 05:49:08 ubuntu2004 supervisord[550606]: 2020-05-30 05:49:08,671 CRIT Server 'unix_http_server' running without any HTTP authentication>
May 30 05:49:08 ubuntu2004 supervisord[550606]: 2020-05-30 05:49:08,672 INFO supervisord started with pid 550606
May 30 05:49:09 ubuntu2004 supervisord[550606]: 2020-05-30 05:49:09,676 INFO spawned: 'netbox' with pid 550626
May 30 05:49:11 ubuntu2004 supervisord[550606]: 2020-05-30 05:49:11,060 INFO success: netbox entered RUNNING state, process has stayed up for

Nginx를 위한 NetBox 구성

Nginx를 리버스 프록시로 구성하여 포트 80에서 Netbox에 접근하는 것이 좋습니다. 다음 명령어를 사용하여 새로운 Nginx 가상 호스트 구성을 생성할 수 있습니다:

nano /etc/nginx/sites-available/netbox.conf

다음과 같은 줄을 추가합니다:

server {
    listen 80;
    server_name your-server-ip;
    client_max_body_size 25m;

    location /static/ {
        alias /opt/netbox/netbox/static/;
    }

    location / {
        proxy_pass http://your-server-ip:8001;
    }
}

파일을 저장하고 닫습니다. 그런 다음, /etc/nginx/sites-enabled/ 디렉토리에 대한 심볼릭 링크를 생성합니다:

ln -s /etc/nginx/sites-available/netbox.conf /etc/nginx/sites-enabled/

다음 명령어로 Nginx의 구문 오류를 확인합니다:

ginx -t

모든 것이 정상이라면 다음과 같은 출력이 표시되어야 합니다:

ginx: the configuration file /etc/nginx/nginx.conf syntax is ok
ginx: configuration file /etc/nginx/nginx.conf test is successful

마지막으로, 다음 명령어로 Nginx 서비스를 재시작하여 변경 사항을 적용합니다.

systemctl restart nginx

다음 명령어로 Nginx를 확인할 수도 있습니다:

systemctl status nginx

다음과 같은 출력이 표시되어야 합니다:

? nginx.service - Nginx HTTP 및 리버스 프록시 서버
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
   Active: active (running) since Sat 2020-05-30 22:28:13 EST; 4min 14s ago
  Process: 984 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS)
  Process: 982 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
  Process: 980 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
 Main PID: 985 (nginx)
    Tasks: 3 (limit: 25028)
   Memory: 5.5M
   CGroup: /system.slice/nginx.service
           ??985 nginx: master process /usr/sbin/nginx
           ??986 nginx: worker process
           ??987 nginx: worker process

May 30 21:28:12 ubuntu2004 systemd[1]: Starting The nginx HTTP and reverse proxy server...
Mar 30 21:28:12 ubuntu2004 nginx[982]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
Mar 30 21:28:12 ubuntu2004 nginx[982]: nginx: configuration file /etc/nginx/nginx.conf test is successful
Mar 30 21:28:13 ubuntu2004 systemd[1]: Started The nginx HTTP and reverse proxy server.

이 시점에서 Nginx 웹 서버는 포트 80에서 Netbox를 제공하도록 구성되었습니다. 이제 Netbox 웹 인터페이스에 접근할 수 있습니다.

Netbox 웹 인터페이스 접근

웹 브라우저를 열고 URL http://your-server-ip를 방문합니다. 다음 페이지로 리디렉션됩니다:

Netbox 인터페이스

로그인 버튼을 클릭합니다. 다음 화면에서 Netbox 로그인 페이지가 표시되어야 합니다:

Netbox 로그인

Netbox 관리자 사용자 이름, 비밀번호를 제공하고 로그인 버튼을 클릭합니다. 다음 페이지에서 Netbox 기본 대시보드가 표시되어야 합니다:

Netbox 관리자 대시보드

결론

이 가이드에서는 Ubuntu 20.04에 Nginx와 함께 Netbox를 설치하는 방법을 배웠습니다. 이제 네트워크 인프라를 문서화할 수 있습니다. 더 많은 정보는 Netbox 공식 문서를 방문하십시오. 질문이 있으면 언제든지 문의해 주세요.

Share: X/Twitter LinkedIn

새 게시물을 받은 편지함에서 받기

스팸은 없습니다. 언제든지 구독 해지 가능합니다.