{"id":687,"date":"2025-07-18T08:37:05","date_gmt":"2025-07-18T06:37:05","guid":{"rendered":"https:\/\/whoami.lausitz-event.info\/?p=687"},"modified":"2025-10-16T11:07:04","modified_gmt":"2025-10-16T09:07:04","slug":"netbox-installation-unter-debian-12-x","status":"publish","type":"post","link":"https:\/\/whoami.lausitz-event.info\/?p=687","title":{"rendered":"NetBox Installation unter Debian 12.x"},"content":{"rendered":"\n\n<p><strong>PostgreSQL Installation<\/strong><\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update\nsudo apt install -y postgresql<\/code><\/pre>\n\n\n\n\n\n<p><strong>Anlegen der Datenbank<\/strong><\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>sudo -u postgres psql\nCREATE DATABASE netbox;\nCREATE USER netbox WITH PASSWORD 'SICHERES_PASSWORT';\nALTER DATABASE netbox OWNER TO netbox;\n-- the next two commands are needed on PostgreSQL 15 and later\n\\connect netbox;\nGRANT CREATE ON SCHEMA public TO netbox;<\/code><\/pre>\n\n\n\n\n\n<p><strong>Test der Datenbank Verbindung<\/strong><\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>$ psql --username netbox --password --host localhost netbox\nPassword for user netbox: \npsql (12.5 (Ubuntu 12.5-0ubuntu0.20.04.1))\nSSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)\nType \"help\" for help.\n\nnetbox=&gt; \\conninfo\nYou are connected to database \"netbox\" as user \"netbox\" on host \"localhost\" (address \"127.0.0.1\") at port \"5432\".\nSSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)\nnetbox=&gt; \\q<\/code><\/pre>\n\n\n\n\n\n<p><strong>Redis<\/strong><\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install -y redis-server\nredis-server -v<\/code><\/pre>\n\n\n\n\n\n<p><strong>Test Redis -&gt; es sollte ein Pong zur\u00fcckkommen<\/strong><\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>redis-cli ping\n<\/code><\/pre>\n\n\n\n\n\n<p><strong>NetBox Installation (supports Python 3.10, 3.11 and 3.12)<\/strong><\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>apt install -y python3 python3-pip python3-venv python3-dev \\\nbuild-essential libxml2-dev libxslt1-dev libffi-dev libpq-dev \\\nlibssl-dev zlib1g-dev<\/code><\/pre>\n\n\n\n\n\n<p><strong>Python Version pr\u00fcfen<\/strong><\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>python3 -V<\/code><\/pre>\n\n\n\n\n\n<p><strong>Installation wget, Download NetBox und entpacken nach \/opt<\/strong><\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>apt install -y wget\n\nwget https:\/\/github.com\/netbox-community\/netbox\/archive\/refs\/tags\/v4.3.4.tar.gz\ntar xvzf v4.3.4.tar.gz -C \/opt\nln -s \/opt\/netbox-4.3.4\/ \/opt\/netbox<\/code><\/pre>\n\n\n\n\n\n<p><strong>Nutzer anlegen und Rechte vergeben<\/strong><\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>adduser --system --group netbox\nchown --recursive netbox \/opt\/netbox\/netbox\/media\/\nchown --recursive netbox \/opt\/netbox\/netbox\/reports\/\nchown --recursive netbox \/opt\/netbox\/netbox\/scripts\/<\/code><\/pre>\n\n\n\n\n\n<p><strong>Konfigurationsdatei configuration.py kopieren und bearbeiten<\/strong><\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>cd \/opt\/netbox\/netbox\/netbox\/\ncp configuration_example.py configuration.py<\/code><\/pre>\n\n\n\n\n\n<p><strong>vi configuration.py<\/strong><\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>DATABASES = {\n    'default': {\n        'NAME': 'netbox',               # Database name\n        'USER': 'netbox',               # PostgreSQL username\n        'PASSWORD': 'SICHERES_PASSWORT', # PostgreSQL password\n        'HOST': 'localhost',            # Database server\n        'PORT': '',                     # Database port (leave blank for default)\n        'CONN_MAX_AGE': 300,            # Max database connection age (seconds)\n    }\n}\n\nREDIS = {\n    'tasks': {\n        'HOST': 'localhost',      # Redis server\n        'PORT': 6379,             # Redis port\n        'PASSWORD': '',           # Redis password (optional)\n        'DATABASE': 0,            # Database ID\n        'SSL': False,             # Use SSL (optional)\n    },\n    'caching': {\n        'HOST': 'localhost',\n        'PORT': 6379,\n        'PASSWORD': '',\n        'DATABASE': 1,            # Unique ID for second database\n        'SSL': False,\n    }\n}<\/code><\/pre>\n\n\n\n\n\n<p><strong>Key erzeugen und in die configuration.py eintragen<\/strong><\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>python3 ..\/generate_secret_key.py<\/code><\/pre>\n\n\n\n\n\n<p><strong>Update Script aufrufen<\/strong><\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>\/opt\/netbox\/upgrade.sh<\/code><\/pre>\n\n\n\n\n\n<p><strong>Super User anlegen<\/strong><\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>source \/opt\/netbox\/venv\/bin\/activate\n\ncd \/opt\/netbox\/netbox\npython3 manage.py createsuperuser<\/code><\/pre>\n\n\n\n\n\n<p><strong>Housekeeping<\/strong><\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>ln -s \/opt\/netbox\/contrib\/netbox-housekeeping.sh \/etc\/cron.daily\/netbox-housekeeping<\/code><\/pre>\n\n\n\n\n\n<p><strong>Startscripte<\/strong><\/p>\n\n\n\n\n\n<p>\/etc\/systemd\/system\/netbox.service<\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;Unit]\nDescription=NetBox WSGI Service\nAfter=network.target\n\n&#91;Service]\nType=simple\nUser=netbox\nGroup=netbox\nWorkingDirectory=\/opt\/netbox-4.4.4\/netbox\nExecStart=\/opt\/netbox-4.4.4\/venv\/bin\/gunicorn --workers 3 --max-requests 500 --timeout 120 \\\n  --bind 127.0.0.1:8001 netbox.wsgi\nRestart=on-failure\n\n&#91;Install]\nWantedBy=multi-user.target\n<\/code><\/pre>\n\n\n\n\n\n<p>\/etc\/systemd\/system\/netbox-rq.service<\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;Unit]\nDescription=NetBox RQ Worker\nAfter=network.target\n\n&#91;Service]\nType=simple\nUser=netbox\nGroup=netbox\nWorkingDirectory=\/opt\/netbox-4.4.4\/netbox\nExecStart=\/opt\/netbox-4.4.4\/venv\/bin\/python \/opt\/netbox-4.4.4\/netbox\/manage.py rqworker\nRestart=on-failure\n\n&#91;Install]\nWantedBy=multi-user.target\n<\/code><\/pre>\n\n\n\n\n\n<p><strong>Fertig!<\/strong><\/p>\n\n\n\n\n\n<p><strong>Strukturhinweise<\/strong><\/p>\n\n\n\n\n\n<p><em>Organization<\/em><\/p>\n\n\n\n\n\n<p>    Sites - \u00d6rtlichkeit (Bsp.: Headquarter Company A)<\/p>\n\n\n\n\n\n<p>    Regions - Standort (Bsp.: Europa -&gt; Deutschland -&gt; Senftenberg)<\/p>\n\n\n\n\n\n<p>    Site Groups - Gruppierung der Sites (Bsp.: Headquarter Company A, Aussenstelle 1 Company A, ...)<\/p>\n\n\n\n\n\n<p>    Locations - Raumbezeichnung (Bsp.: Serverraum 301, B\u00fcro 212, etc.)<\/p>\n\n\n\n\n\n<p>    Tenants - Mandanten<\/p>\n\n\n\n\n\n<p>    Tenant Groups - Gruppierung von Mandanten<\/p>\n\n\n\n\n\n<p>    Contacts - Kontakte<\/p>\n\n\n\n\n\n<p>    Contact Groups - Gruppierung von Kontakten<\/p>\n\n\n\n\n\n<p>    Contact Roles - spezifische Rollen der Kontakte (Bsp.: IT-Administrator, IT-Koordinator, ...)<\/p>\n\n\n\n\n\n<p><em>Racks<\/em><\/p>\n\n\n\n\n\n<p>    Racks - Anlegen von Racks f\u00fcr den sp\u00e4teren \"Einbau\" der Systeme<\/p>\n\n\n\n\n\n<p>    Rack Roles - Funktionale Einordnung der Racks (Bsp.: Passive Komponenten)<\/p>\n\n\n\n\n\n<p><em>Devices<\/em><\/p>\n\n\n\n\n\n<p>    Devices - Konkrete Ger\u00e4te (Bsp.: hqswitch01, hqrouter02, pc-gf, Dose-3.1, etc.)<\/p>\n\n\n\n\n\n<p>    Modules - Module welche in Ger\u00e4ten verbaut sein k\u00f6nnen<\/p>\n\n\n\n\n\n<p>    Device Roles - Funktionale Rollen der Ger\u00e4te (Bsp.: Switch, Router, Firewall, ...)<\/p>\n\n\n\n\n\n<p>    Platforms - Betriebssysteme der Ger\u00e4te<\/p>\n\n\n\n\n\n<p>    Virtual Chassis - Logische Einheiten bestehend aus mehreren physischen Ger\u00e4ten (Bsp.: Gestackter Switch)<\/p>\n\n\n\n\n\n<p>    Device Types - Konkrete Typen-Bezeichnung des Ger\u00e4ts (Bsp.: ASA5512)<\/p>\n\n\n\n\n\n<p>    Manufacturers - Hersteller (Bsp.: Cisco, Fujitsu, ...)<\/p>\n\n\n","protected":false},"excerpt":{"rendered":"<p>PostgreSQL Installation Anlegen der Datenbank Test der Datenbank Verbindung Redis Test Redis -&gt; es sollte ein Pong zur\u00fcckkommen NetBox Installation (supports Python 3.10, 3.11 and 3.12) Python Version pr\u00fcfen Installation wget, Download NetBox und entpacken nach \/opt Nutzer anlegen und Rechte vergeben Konfigurationsdatei configuration.py kopieren und bearbeiten vi configuration.py Key erzeugen und in die configuration.py [&hellip;]<\/p>","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[3,16],"tags":[],"class_list":["post-687","post","type-post","status-publish","format-standard","hentry","category-it","category-netbox"],"_links":{"self":[{"href":"https:\/\/whoami.lausitz-event.info\/index.php?rest_route=\/wp\/v2\/posts\/687","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/whoami.lausitz-event.info\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/whoami.lausitz-event.info\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/whoami.lausitz-event.info\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/whoami.lausitz-event.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=687"}],"version-history":[{"count":5,"href":"https:\/\/whoami.lausitz-event.info\/index.php?rest_route=\/wp\/v2\/posts\/687\/revisions"}],"predecessor-version":[{"id":895,"href":"https:\/\/whoami.lausitz-event.info\/index.php?rest_route=\/wp\/v2\/posts\/687\/revisions\/895"}],"wp:attachment":[{"href":"https:\/\/whoami.lausitz-event.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=687"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/whoami.lausitz-event.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=687"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/whoami.lausitz-event.info\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=687"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}