Versão avaliada: Debian 13
Não é possível usar somente Nginx ou somente Gunicorn para uma implantação funcional e completa, pois cada um tem uma função específica que o outro não consegue realizar sozinho
# apt update
# apt install git gcc nginx redis-server python3 python3-dev python3-pip python3-venv libssl-dev libpq-dev postgresql postgresql-contrib -y
# systemctl start postgresql.service
# systemctl enable postgresql.service
# su - postgres
# psql -c "CREATE DATABASE netbox WITH ENCODING 'UTF8' LC_COLLATE='C.UTF-8' LC_CTYPE='C.UTF-8' TEMPLATE template0;" -c "CREATE USER netboxuser WITH PASSWORD '<SENHA>';" -c "GRANT ALL PRIVILEGES ON DATABASE netbox TO netboxuser;"
# psql -d netbox -c "GRANT CREATE ON SCHEMA public TO netboxuser;"
# exit
Diu
Baixe o NetBox para /opt/netbox, gere a chave secreta e edite a configuração:
# cd /opt
# git clone --depth 1 https://github.com/netbox-community/netbox.git
############################ chown -R netbox:netbox /opt/netbox
######################### su - netbox
# cd /opt/netbox/netbox/netbox
# python3 ../generate_secret_key.py
_f9@OELJ6R)$-Oym8rMT1234#8DbeUq8Y4QyU)qn(@)n0qf=3A
# openssl rand -base64 64
j3Bh6gPNJX/XhoPZ4cC4KwXuYngvg6HkfH/oZZkjHs+S2NBVqWLsSjZ/mlWN10vHkZsGdlfJmaC81PeE/OIZaA==
# cp configuration_example.py configuration.py
# vi configuration.py
....
ALLOWED_HOSTS = ['<IP_SERVIDOR>' , 'localhost' , '127.0.0.1']
....
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql', # Database engine
'NAME': 'netbox', # Database name
'USER': 'netboxuser', # PostgreSQL username
'PASSWORD': '<SENHA>', # PostgreSQL password
'HOST': 'localhost', # Database server
'PORT': '5432', # Database port (leave blank for default)
'CONN_MAX_AGE': 300, # Max database connection age
}
}
....
SECRET_KEY = '_f9@OELJ6R)$-Oym8rMT1234#8DbeUq8Y4QyU)qn(@)n0qf=3A'
....
API_TOKEN_PEPPERS = {5xJxX4FykMDKfVDGGyq/8gNgRM8WAa1easdXn49Henc=}
....
# /opt/netbox/upgrade.sh
You are installing (or upgrading to) NetBox version 4.6.7
....
Completed. Total entries: 7
Removing expired user sessions (python3 netbox/manage.py clearsessions)...
Upgrade complete! Don't forget to restart the NetBox services:
> sudo systemctl restart netbox netbox-rq
#########################cd /opt/netbox
# source /opt/netbox/venv/bin/activate
# python3 ../manage.py createsuperuser
Username: suporte
Email address: suporte@domain.internal
Password:
Password (again):
Superuser created successfully.
################## su - netbox
# cp /opt/netbox/contrib/gunicorn.py /opt/netbox/
# vi /opt/netbox/gunicorn.py
# /opt/netbox/upgrade.sh
# cp -v /opt/netbox/contrib/*.service /etc/systemd/system/
# systemctl daemon-reload
# systemctl enable netbox.service netbox-rq.service
# systemctl restart netbox.service netbox-rq.service
outros pacotes??????
apt install net-tools supervisor\
build-essential libxml2-dev libxslt1-dev\
libffi-dev zlib1g-dev graphviz\
python3-setuptools python3-gunicorn