NETBOX v4.0.8  https://github.com/netbox-community/netbox

  apt -y install wget; wget remontti.com.br/debian; bash debian; su –
  apt install gcc vim net-tools wget redis-server supervisor\
  postgresql-contrib postgresql libpq-dev \
  python3 python3-pip python3-venv python3-dev\
  build-essential libxml2-dev  libxslt1-dev\
  libffi-dev libssl-dev libpq-dev libssl-dev zlib1g-dev graphviz\
  nginx redis python3-setuptools python3-gunicorn

su – postgres

psql

CREATE DATABASE netboxdb;
CREATE USER netboxuser WITH PASSWORD ‘8TnKP9lcnydCPpqu’;
GRANT ALL PRIVILEGES ON DATABASE netboxdb TO netboxuser;
ALTER USER netboxuser WITH SUPERUSER;
\q
exit

cd /tmp
wget https://github.com/netbox-community/netbox/archive/refs/tags/v4.0.8.tar.gz
tar vxf v4.0.8.tar.gz

mv netbox*/ /opt/netbox
cd /opt/netbox/
chown
www-data: /opt/netbox/netbox/media/ -R

/opt/netbox/netbox/generate_secret_key.py
dKIUySEW-xc(m!YR76yeS)P7RDiJ61q@fbYcA1vsotkc=X3K6q

cp /opt/netbox/netbox/netbox/configuration_example.py /opt/netbox/netbox/netbox/configuration.py

nano /opt/netbox/netbox/netbox/configuration.py

ALLOWED_HOSTS = [‘*’]
DATABASE = {
    ‘NAME’: ‘netboxdb’,
    ‘USER’: ‘netboxuser’,
    ‘PASSWORD’: ‘8TnKP9lcnydCPpqu’,
    ‘HOST’: ‘localhost’,
    ‘PORT’: ”,
    ‘CONN_MAX_AGE’: 300,

}

SECRET_KEY = ‘UO#hI#KrFq8(al-FIj!QL%-)Ou^b5uG4iNQUZAt5vv^2AzMoD)’

LOGIN_REQUIRED = True

/opt/netbox/upgrade.sh

source /opt/netbox/venv/bin/activate

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

exit

LIMPEZA

su –

ln -s /opt/netbox/contrib/netbox-housekeeping.sh /etc/cron.daily/netbox-housekeeping

TESTES:

redis-cli ping

source /opt/netbox/venv/bin/activate

cd /opt/netbox/netbox

python3 manage.py runserver 0.0.0.0:8000 –insecure

exit

su –

# cp /opt/netbox/contrib/gunicorn.py /opt/netbox/gunicorn.py
#  cp /opt/netbox/contrib/*.service /etc/systemd/system/
# sed -i ‘s/User=netbox/User=root/’ /etc/systemd/system/netbox*.service
#  sed -i ‘s/Group=netbox/Group=root/’ /etc/systemd/system/netbox*.service
# systemctl daemon-reload
#  systemctl enable netbox netbox-rq netbox-housekeeping
# systemctl start netbox netbox-rq netbox-housekeeping
#  systemctl status netbox netbox-rq

apt -y install nginx

rm /etc/nginx/sites-enabled/default

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

server {

    listen 80;

    listen [::]:80;

    server_name doc.rapeedo.com.br;

    client_max_body_size 25m;

    location /static/ {

        alias /opt/netbox/netbox/static/;

    }

    location / {

        proxy_pass http://localhost:8001;

        proxy_set_header Host $http_host;

        proxy_set_header X-Real-IP $remote_addr;

        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        proxy_set_header X-Forwarded-Proto $scheme;

    }

}

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

systemctl restart nginx
systemctl status nginx

apt install certbot python3-certbot-nginx
certbot

certbot -q renew


Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *