{"id":561,"date":"2025-04-14T08:12:38","date_gmt":"2025-04-14T06:12:38","guid":{"rendered":"https:\/\/whoami.lausitz-event.info\/?p=561"},"modified":"2025-04-16T12:07:11","modified_gmt":"2025-04-16T10:07:11","slug":"netbox-2","status":"publish","type":"post","link":"https:\/\/whoami.lausitz-event.info\/?p=561","title":{"rendered":"Netbox"},"content":{"rendered":"\n\n<p>Aktualisierung des Operating System<\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>apt install sudo\nsudo apt update\nsudo apt upgrade<\/code><\/pre>\n\n\n\n\n\n<p>Installation der Paketabh\u00e4ngigkeiten<\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install apache2 postgresql postgresql-common libpq-dev redis-server git python3 python3-pip python3-venv python3-dev build-essential libxml2-dev libxslt1-dev libffi-dev  libssl-dev zlib1g-dev<\/code><\/pre>\n\n\n\n\n\n<p>Pr\u00fcfung ob der Apache Service enabled ist und l\u00e4uft<\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl is-enabled apache2\nsudo systemctl status apache2<\/code><\/pre>\n\n\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"389\" height=\"52\" src=\"https:\/\/whoami.lausitz-event.info\/wp-content\/uploads\/2025\/04\/image.png\" alt=\"\" class=\"wp-image-581\" srcset=\"https:\/\/whoami.lausitz-event.info\/wp-content\/uploads\/2025\/04\/image.png 389w, https:\/\/whoami.lausitz-event.info\/wp-content\/uploads\/2025\/04\/image-300x40.png 300w\" sizes=\"auto, (max-width: 389px) 100vw, 389px\" \/><\/figure>\n\n\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"711\" height=\"306\" src=\"https:\/\/whoami.lausitz-event.info\/wp-content\/uploads\/2025\/04\/image-1.png\" alt=\"\" class=\"wp-image-582\" srcset=\"https:\/\/whoami.lausitz-event.info\/wp-content\/uploads\/2025\/04\/image-1.png 711w, https:\/\/whoami.lausitz-event.info\/wp-content\/uploads\/2025\/04\/image-1-300x129.png 300w\" sizes=\"auto, (max-width: 711px) 100vw, 711px\" \/><\/figure>\n\n\n\n\n\n<p>Pr\u00fcfung ob der PostgreSQL aktiviert ist und l\u00e4uft<\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl is-enabled postgresql\nsudo systemctl status postgresql<\/code><\/pre>\n\n\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"416\" height=\"47\" src=\"https:\/\/whoami.lausitz-event.info\/wp-content\/uploads\/2025\/04\/image-2.png\" alt=\"\" class=\"wp-image-583\" srcset=\"https:\/\/whoami.lausitz-event.info\/wp-content\/uploads\/2025\/04\/image-2.png 416w, https:\/\/whoami.lausitz-event.info\/wp-content\/uploads\/2025\/04\/image-2-300x34.png 300w\" sizes=\"auto, (max-width: 416px) 100vw, 416px\" \/><\/figure>\n\n\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"695\" height=\"189\" src=\"https:\/\/whoami.lausitz-event.info\/wp-content\/uploads\/2025\/04\/image-3.png\" alt=\"\" class=\"wp-image-584\" srcset=\"https:\/\/whoami.lausitz-event.info\/wp-content\/uploads\/2025\/04\/image-3.png 695w, https:\/\/whoami.lausitz-event.info\/wp-content\/uploads\/2025\/04\/image-3-300x82.png 300w\" sizes=\"auto, (max-width: 695px) 100vw, 695px\" \/><\/figure>\n\n\n\n\n\n<p>Pr\u00fcfung ob Redis aktiviert ist und l\u00e4uft<\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl is-enabled redis\nsudo systemctl status redis<\/code><\/pre>\n\n\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"387\" height=\"50\" src=\"https:\/\/whoami.lausitz-event.info\/wp-content\/uploads\/2025\/04\/image-4.png\" alt=\"\" class=\"wp-image-585\" srcset=\"https:\/\/whoami.lausitz-event.info\/wp-content\/uploads\/2025\/04\/image-4.png 387w, https:\/\/whoami.lausitz-event.info\/wp-content\/uploads\/2025\/04\/image-4-300x39.png 300w\" sizes=\"auto, (max-width: 387px) 100vw, 387px\" \/><\/figure>\n\n\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"758\" height=\"276\" src=\"https:\/\/whoami.lausitz-event.info\/wp-content\/uploads\/2025\/04\/image-5.png\" alt=\"\" class=\"wp-image-586\" srcset=\"https:\/\/whoami.lausitz-event.info\/wp-content\/uploads\/2025\/04\/image-5.png 758w, https:\/\/whoami.lausitz-event.info\/wp-content\/uploads\/2025\/04\/image-5-300x109.png 300w\" sizes=\"auto, (max-width: 758px) 100vw, 758px\" \/><\/figure>\n\n\n\n\n\n<p><strong>Konfiguration PostgreSQL<\/strong><\/p>\n\n\n\n\n\n<p>Anmeldung an der PostgreSQL DB<\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>sudo -u postgres psql<\/code><\/pre>\n\n\n\n\n\n<p>Erstellung eines neuen DB-Nutzers und der Datenbank f\u00fcr Netbox<\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>CREATE USER netbox LOGIN CREATEDB PASSWORD 'SECURE';\nCREATE DATABASE netbox OWNER netbox;<\/code><\/pre>\n\n\n\n\n\n<p>Wenn du alles richtig gemacht hast, sollte es folgenderma\u00dfen aussehen.<\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>\\l\n\\du<\/code><\/pre>\n\n\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"884\" height=\"320\" src=\"https:\/\/whoami.lausitz-event.info\/wp-content\/uploads\/2025\/04\/image-6.png\" alt=\"\" class=\"wp-image-589\" srcset=\"https:\/\/whoami.lausitz-event.info\/wp-content\/uploads\/2025\/04\/image-6.png 884w, https:\/\/whoami.lausitz-event.info\/wp-content\/uploads\/2025\/04\/image-6-300x109.png 300w, https:\/\/whoami.lausitz-event.info\/wp-content\/uploads\/2025\/04\/image-6-768x278.png 768w\" sizes=\"auto, (max-width: 884px) 100vw, 884px\" \/><\/figure>\n\n\n\n\n\n<p><strong>Konfiguration Redis Server<\/strong><\/p>\n\n\n\n\n\n<pre class=\"wp-block-preformatted\">sudo nano \/etc\/redis\/redis.conf<\/pre>\n\n\n\n\n\n<p>Such den Parameter requirepass, enable den Eintrag und setze dein Passwort<\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>requirepass SECURE<\/code><\/pre>\n\n\n\n\n\n<p>Neustart Redis<\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl restart redis<\/code><\/pre>\n\n\n\n\n\n<p>Test ob Redis funktioniert<\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>redis-cli\nAUTH SECURE\nping<\/code><\/pre>\n\n\n\n\n\n<p><strong>Installation Netbox<\/strong><\/p>\n\n\n\n\n\n<p>Erstellung eines Nutzers f\u00fcr Netbox<\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>sudo useradd -r -d \/opt\/netbox -s \/usr\/sbin\/nologin netbox<\/code><\/pre>\n\n\n\n\n\n<p>Herunterladen von Netbox und setzen der Verzeichnisrechte<\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>cd \/opt; sudo git clone -b master --depth 1 https:\/\/github.com\/netbox-community\/netbox.git\nsudo chown -R netbox:netbox \/opt\/netbox<\/code><\/pre>\n\n\n\n\n\n<p>Setzen des Schl\u00fcssels f\u00fcr Netbox<\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>cd \/opt\/netbox\/netbox\/netbox\nsudo -u netbox python3 ..\/generate_secret_key.py<\/code><\/pre>\n\n\n\n\n\n<p>Kopieren und editieren der Konfigurationsdatei. Kopiere dir dazu den eben erzeugten Schl\u00fcssel in die Zwischenablage.<\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>sudo -u netbox cp configuration_example.py configuration.py\nsudo -u netbox nano configuration.py<\/code><\/pre>\n\n\n\n\n\n<p>Das sollte dann wie folgt aussehen:<\/p>\n\n\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"979\" height=\"925\" src=\"https:\/\/whoami.lausitz-event.info\/wp-content\/uploads\/2025\/04\/image-7.png\" alt=\"\" class=\"wp-image-590\" srcset=\"https:\/\/whoami.lausitz-event.info\/wp-content\/uploads\/2025\/04\/image-7.png 979w, https:\/\/whoami.lausitz-event.info\/wp-content\/uploads\/2025\/04\/image-7-300x283.png 300w, https:\/\/whoami.lausitz-event.info\/wp-content\/uploads\/2025\/04\/image-7-768x726.png 768w\" sizes=\"auto, (max-width: 979px) 100vw, 979px\" \/><\/figure>\n\n\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"973\" height=\"108\" src=\"https:\/\/whoami.lausitz-event.info\/wp-content\/uploads\/2025\/04\/image-8.png\" alt=\"\" class=\"wp-image-591\" srcset=\"https:\/\/whoami.lausitz-event.info\/wp-content\/uploads\/2025\/04\/image-8.png 973w, https:\/\/whoami.lausitz-event.info\/wp-content\/uploads\/2025\/04\/image-8-300x33.png 300w, https:\/\/whoami.lausitz-event.info\/wp-content\/uploads\/2025\/04\/image-8-768x85.png 768w\" sizes=\"auto, (max-width: 973px) 100vw, 973px\" \/><\/figure>\n\n\n\n\n\n<p>Als n\u00e4chstes f\u00fchrst du das Upgrade Script aus.<\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>sudo -u netbox \/opt\/netbox\/upgrade.sh<\/code><\/pre>\n\n\n\n\n\n<p>Nachdem das Script durch ist, musst du dich in der virtuellen Python Umgebung anmelden.<\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>source \/opt\/netbox\/venv\/bin\/activate<\/code><\/pre>\n\n\n\n\n\n<p>Als n\u00e4chstes legen wir einen Admin User f\u00fcr Netbox an.<\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>cd \/opt\/netbox\/netbox\npython3 manage.py createsuperuser\n<\/code><\/pre>\n\n\n\n\n\n<p>Test des Netbox Server.<\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>python3 manage.py runserver 0.0.0.0:8000 --insecure<\/code><\/pre>\n\n\n\n\n\n<p>Browser aufrufen und sich mit dem eben erzeugten Nutzer anmelden. http:\/\/&lt;IP-Adresse-Netbox>:8000<\/p>\n\n\n\n\n\n<p>Wenn das funktioniert, m\u00fcssen wir Netbox als Systemd-Dienst konfigurieren.<\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>sudo -u netbox cp \/opt\/netbox\/contrib\/gunicorn.py \/opt\/netbox\/gunicorn.py\nsudo -u netbox nano \/opt\/netbox\/gunicorn.py<\/code><\/pre>\n\n\n\n\n\n<p>Startscripte kopieren und Netbox Dienst starten.<\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>sudo cp -v \/opt\/netbox\/contrib\/*.service \/etc\/systemd\/system\/\nsudo systemctl daemon-reload\nsudo systemctl start netbox netbox-rq netbox-housekeeping\nsudo systemctl enable netbox netbox-rq netbox-housekeeping<\/code><\/pre>\n\n\n\n\n\n<p><strong>Apache als Reverse Proxy konfigurieren<\/strong><\/p>\n\n\n\n\n\n<p>Erstellung der SSL Zertifikate<\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>openssl req -x509 -newkey rsa:4096 -sha256 -days 365 -nodes -keyout \/etc\/ssl\/private\/netbox.key -out \/etc\/ssl\/certs\/netbox.crt -subj \"\/CN=netbox addext \"subjectAltName=DNS:netbox,IP:192.168.1.4\n<\/code><\/pre>\n\n\n\n\n\n<p>Kopiere nun die Beispiel-Konfigurationsdateien f\u00fcr Apache und passe in dieser den Hostnamen an.<\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>sudo cp \/opt\/netbox\/contrib\/apache.conf \/etc\/apache2\/sites-available\/netbox.conf\nsudo nano \/etc\/apache2\/sites-available\/netbox.conf<\/code><\/pre>\n\n\n\n\n\n<p>Aktivierung Apache Module<\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>sudo a2enmod ssl proxy proxy_http headers rewrite<\/code><\/pre>\n\n\n\n\n\n<p>Aktivierung der Seite und Syntaxtest f\u00fcr den Apachen.<\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>sudo a2ensite netbox.conf\nsudo apachectl configtest<\/code><\/pre>\n\n\n\n\n\n<p>Neustart des Apachen<\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl restart apache2\n<\/code><\/pre>\n\n\n","protected":false},"excerpt":{"rendered":"<p>Aktualisierung des Operating System Installation der Paketabh\u00e4ngigkeiten Pr\u00fcfung ob der Apache Service enabled ist und l\u00e4uft Pr\u00fcfung ob der PostgreSQL aktiviert ist und l\u00e4uft Pr\u00fcfung ob Redis aktiviert ist und l\u00e4uft Konfiguration PostgreSQL Anmeldung an der PostgreSQL DB Erstellung eines neuen DB-Nutzers und der Datenbank f\u00fcr Netbox Wenn du alles richtig gemacht hast, sollte es [&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":[1],"tags":[],"class_list":["post-561","post","type-post","status-publish","format-standard","hentry","category-allgemein"],"_links":{"self":[{"href":"https:\/\/whoami.lausitz-event.info\/index.php?rest_route=\/wp\/v2\/posts\/561","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=561"}],"version-history":[{"count":7,"href":"https:\/\/whoami.lausitz-event.info\/index.php?rest_route=\/wp\/v2\/posts\/561\/revisions"}],"predecessor-version":[{"id":596,"href":"https:\/\/whoami.lausitz-event.info\/index.php?rest_route=\/wp\/v2\/posts\/561\/revisions\/596"}],"wp:attachment":[{"href":"https:\/\/whoami.lausitz-event.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=561"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/whoami.lausitz-event.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=561"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/whoami.lausitz-event.info\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=561"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}