{"id":334,"date":"2023-03-31T12:12:22","date_gmt":"2023-03-31T10:12:22","guid":{"rendered":"https:\/\/whoami.lausitz-event.info\/?p=334"},"modified":"2023-05-11T13:04:00","modified_gmt":"2023-05-11T11:04:00","slug":"netbox","status":"publish","type":"post","link":"https:\/\/whoami.lausitz-event.info\/?p=334","title":{"rendered":"Netbox"},"content":{"rendered":"\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"680\" src=\"https:\/\/whoami.lausitz-event.info\/wp-content\/uploads\/2023\/05\/netbox-ui-1024x680.png\" alt=\"\" class=\"wp-image-359\" srcset=\"https:\/\/whoami.lausitz-event.info\/wp-content\/uploads\/2023\/05\/netbox-ui-1024x680.png 1024w, https:\/\/whoami.lausitz-event.info\/wp-content\/uploads\/2023\/05\/netbox-ui-300x199.png 300w, https:\/\/whoami.lausitz-event.info\/wp-content\/uploads\/2023\/05\/netbox-ui-768x510.png 768w, https:\/\/whoami.lausitz-event.info\/wp-content\/uploads\/2023\/05\/netbox-ui.png 1406w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n\n\n<p>Netbox ist ein spannendes OpenSource Tool um seine gesamte IT-Landschaft zu dokumentieren. Im folgenden beschreibe ich die Installation von Netbox unter RockyLinux 8.x<\/p>\n\n\n\n\n\n<p>Als erstes installieren wir den Postgresql. Da Netbox hier aber den Postgres 11 oder h\u00f6her haben m\u00f6chte, m\u00fcssen wir an dieser Stelle einen kleinen Umweg machen.<\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf install -y https:\/\/download.postgresql.org\/pub\/repos\/yum\/reporpms\/EL-8-x86_64\/pgdg-redhat-repo-latest.noarch.rpm\nsudo dnf update -y\nsudo dnf -qy module disable postgresql\nsudo dnf install -y postgresql15-server\nsudo \/usr\/pgsql-15\/bin\/postgresql-15-setup initdb\nsudo systemctl enable postgresql-15\nsudo systemctl start postgresql-15\nsystemctl status postgresql-15<\/code><\/pre>\n\n\n\n\n\n<p><strong>\/var\/lib\/pgsql\/15\/data\/pg_hba.conf<\/strong><\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>#host    all             all             127.0.0.1\/32            scram-sha-256\n#host    all             all             ::1\/128                 scram-sha-256\nhost    all             all             127.0.0.1\/32            md5\nhost    all             all             ::1\/128                 md5<\/code><\/pre>\n\n\n\n\n\n<p><strong>Aktivierung und Neustart postgresql<\/strong><\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl start postgresql-15\nsudo systemctl enable postgresql-15<\/code><\/pre>\n\n\n\n\n\n<p><strong>Datenbankerstellung<\/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 'netbox';\nGRANT ALL PRIVILEGES ON DATABASE netbox TO netbox;\nALTER DATABASE netbox OWNER TO netbox;<\/code><\/pre>\n\n\n\n\n\n<p><strong>Test DB-Anmeldung als netbox user<\/strong><\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>psql --username netbox --password --host localhost netbox\n\nnetbox=&gt; \\conninfo\nYou are connected to database \"netbox\" as user \"netbox\" on host \"localhost\" (address \"::1\") at port \"5432\".\nnetbox=&gt;<\/code><\/pre>\n\n\n\n\n\n<p><strong>Redis Installation<\/strong><\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>sudo yum install -y redis\nsudo systemctl start redis\nsudo systemctl enable redis<\/code><\/pre>\n\n\n\n\n\n<p><strong>Test Redis<\/strong><\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>redis-cli ping\n\nes sollte folgendes zur\u00fcckkommen\n\nPONG<\/code><\/pre>\n\n\n\n\n\n<p><strong>Python3.8 Installation<\/strong><\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>dnf module -y install python38<\/code><\/pre>\n\n\n\n\n\n<p><strong>Installation zus\u00e4tzlicher System Packages<\/strong><\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf install -y gcc libxml2-devel libxslt-devel libffi-devel libpq-devel openssl-devel redhat-rpm-config<\/code><\/pre>\n\n\n\n\n\n<p><strong>Clone GIT Repository<\/strong><\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>sudo mkdir -p \/opt\/netbox\/\ncd \/opt\/netbox\/\nsudo dnf install -y git\nsudo git clone -b master --depth 1 https:\/\/github.com\/netbox-community\/netbox.git .<\/code><\/pre>\n\n\n\n\n\n<p>Erstellung Netbox System User<\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>sudo groupadd --system netbox\nsudo adduser --system -g netbox netbox\nsudo chown --recursive netbox \/opt\/netbox\/netbox\/media\/<\/code><\/pre>\n\n\n\n\n\n<p><strong>Konfiguration<\/strong><\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>cd \/opt\/netbox\/netbox\/netbox\/\nsudo cp configuration_example.py configuration.py<\/code><\/pre>\n\n\n\n\n\n<p><strong>\/opt\/netbox\/netbox\/netbox\/configuration.py<\/strong><\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>ALLOWED_HOSTS = &#91;'netboxdemo.domain.de', '192.168.29.33']\n\nDATABASE = {\n    'NAME': 'netbox',         # Database name\n    'USER': 'netbox',               # PostgreSQL username\n    'PASSWORD': 'netbox',           # PostgreSQL password\n    'HOST': 'localhost',      # Database server\n    'PORT': '',               # Database port (leave blank for default)\n    'CONN_MAX_AGE': 300,      # Max database connection age\n}\n<\/code><\/pre>\n\n\n\n\n\n<p><strong>Secret Key generieren und in der 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>\/opt\/netbox\/netbox\/netbox\/configuration.py<\/strong><\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>SECRET_KEY = 'yRy=J^qzpF@=!%&amp;*&amp;rn)KFq#O5^XbV4on_L*p2OHhWxF3YoqwK'<\/code><\/pre>\n\n\n\n\n\n<p><strong>Upgrade Script starten<\/strong><\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>sudo PYTHON=\/usr\/bin\/python3.8 \/opt\/netbox\/upgrade.sh\ncp \/opt\/netbox\/contrib\/netbox-rq.service \/etc\/systemd\/system\/\ncp \/opt\/netbox\/contrib\/netbox.service \/etc\/systemd\/system\/\nsudo systemctl daemon-reload\nsudo systemctl enable netbox netbox-rq\nsudo systemctl start netbox netbox-rq<\/code><\/pre>\n\n\n\n\n\n<p><strong>Super-User erstellen<\/strong><\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>source \/opt\/netbox\/venv\/bin\/activate\ncd \/opt\/netbox\/netbox\npython3 manage.py createsuperuser<\/code><\/pre>\n\n\n\n\n\n<p><strong>Symlink f\u00fcr Aufr\u00e4umscript erstellen<\/strong><\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ln -s \/opt\/netbox\/contrib\/netbox-housekeeping.sh \/etc\/cron.daily\/netbox-housekeeping<\/code><\/pre>\n\n\n\n\n\n<p><strong>Test<\/strong><\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>python3 manage.py runserver 0.0.0.0:8000 --insecure\n\nPerforming system checks...\n\n<strong>System check identified no issues (0 silenced).<\/strong>\nMarch 31, 2023 - 10:47:43\nDjango version 4.1.7, using settings 'netbox.settings'\nStarting development server at http:\/\/0.0.0.0:8000\/\nQuit the server with CONTROL-C.\n<\/code><\/pre>\n\n\n\n\n\n<p><strong>Gunicorn<\/strong><\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>sudo cp \/opt\/netbox\/contrib\/gunicorn.py \/opt\/netbox\/gunicorn.py<\/code><\/pre>\n\n\n\n\n\n<p><strong>Webserver konfigurieren<\/strong><\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf install httpd mod_ssl openssh\nsudo systemctl enable httpd\nsudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout \/etc\/pki\/tls\/netbox.key -out \/etc\/pki\/tls\/netbox.crt\nsudo cp \/opt\/netbox\/contrib\/apache.conf \/etc\/httpd\/conf.d\/netbox.conf<\/code><\/pre>\n\n\n\n\n\n<p><strong>\/etc\/httpd\/conf.d\/netbox.conf<\/strong><\/p>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>    SSLCertificateFile \/etc\/pki\/tls\/netbox.crt\n    SSLCertificateKeyFile \/etc\/pki\/tls\/netbox.key<\/code><\/pre>\n\n\n","protected":false},"excerpt":{"rendered":"<p>Netbox ist ein spannendes OpenSource Tool um seine gesamte IT-Landschaft zu dokumentieren. Im folgenden beschreibe ich die Installation von Netbox unter RockyLinux 8.x Als erstes installieren wir den Postgresql. Da Netbox hier aber den Postgres 11 oder h\u00f6her haben m\u00f6chte, m\u00fcssen wir an dieser Stelle einen kleinen Umweg machen. \/var\/lib\/pgsql\/15\/data\/pg_hba.conf Aktivierung und Neustart postgresql Datenbankerstellung [&hellip;]<\/p>","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"","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":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","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-334","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\/334","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=334"}],"version-history":[{"count":12,"href":"https:\/\/whoami.lausitz-event.info\/index.php?rest_route=\/wp\/v2\/posts\/334\/revisions"}],"predecessor-version":[{"id":360,"href":"https:\/\/whoami.lausitz-event.info\/index.php?rest_route=\/wp\/v2\/posts\/334\/revisions\/360"}],"wp:attachment":[{"href":"https:\/\/whoami.lausitz-event.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=334"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/whoami.lausitz-event.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=334"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/whoami.lausitz-event.info\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=334"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}