NetBox Guided Install - v2.9.9 on Ubuntu 20.04.1 LTS

Опубликовано: 28 Сентябрь 2024
на канале: System MTU One
6,775
87

NetBox install for v2.9.9 into Ubuntu 20.04.1 LTS following the official instructions.
NetBox on GitHub: https://github.com/netbox-community/n...
NetBox documentation: https://netbox.readthedocs.io/en/stable/

I am in no way affiliated with the creation, maintenance, or development of NetBox. Just a guy who loves the software.
--------------------------------
apt install postgresql libpq-dev -y

sudo -u postgres psql
CREATE DATABASE netbox;
CREATE USER netbox WITH PASSWORD 'USE YOUR OWN PASSWORD';
GRANT ALL PRIVILEGES ON DATABASE netbox TO netbox;
\q

psql --username netbox --password --host localhost netbox

apt install redis-server -y

redis-cli ping

apt install python3 python3-pip python3-venv python3-dev build-essential \
libxml2-dev libxslt1-dev libffi-dev libpq-dev libssl-dev zlib1g-dev -y

pip3 install --upgrade pip

wget https://github.com/netbox-community/n...
tar -xzf v2.9.9.tar.gz -C /opt
ln -s /opt/netbox-2.9.9/ /opt/netbox


adduser --system --group netbox
chown --recursive netbox /opt/netbox/netbox/media/

cd /opt/netbox/netbox/netbox/
cp configuration.example.py configuration.py

python3 ../generate_secret_key.py

nano configuration.py

/opt/netbox/upgrade.sh

source /opt/netbox/venv/bin/activate

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

python3 manage.py runserver 0.0.0.0:8000 --insecure

cd /opt/netbox
cp contrib/gunicorn.py /opt/netbox/gunicorn.py

cp contrib/*.service /etc/systemd/system/

systemctl daemon-reload
systemctl start netbox netbox-rq
systemctl enable netbox netbox-rq

systemctl status netbox

openssl req -config netbox.cnf \
-new -sha256 -newkey rsa:2048 -nodes -keyout /etc/ssl/private/netbox.key \
-x509 -days 825 -out /etc/ssl/certs/netbox.crt

apt install nginx -y

cp /opt/netbox/contrib/nginx.conf /etc/nginx/sites-available/netbox

cd /etc/nginx/sites-enabled/
rm default
ln -s /etc/nginx/sites-available/netbox

service nginx restart

---- START CERT REQUEST FILE - netbox.cnf ----
[req]
default_bits = 2048
default_md = sha256
encrypt_key = no
prompt = no
distinguished_name = subject
req_extensions = req_ext
x509_extensions = x509_ext

[ subject ]
C = US
ST = Illinois
L = Chicago
O = Me Corp
OU = IT
emailAddress = [email protected]
CN = netbox

[ req_ext ]
subjectKeyIdentifier = hash
basicConstraints = CA:FALSE
keyUsage = digitalSignature, keyEncipherment
extendedKeyUsage = serverAuth, clientAuth
subjectAltName = @alternate_names
nsComment = "Self-Signed SSL Certificate"

[ x509_ext ]
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid,issuer
basicConstraints = CA:FALSE
keyUsage = digitalSignature, keyEncipherment
extendedKeyUsage = serverAuth, clientAuth
subjectAltName = @alternate_names
nsComment = "Self-Signed SSL Certificate"

[ alternate_names ]
DNS.1 = localhost
DNS.2 = netbox.lan
DNS.3 = 192.168.86.68
IP.1 = 192.168.86.68
---- END CERT REQUEST FILE - netbox.cnf ----