Debian 11 – Upgrade IPAM NetBox

Auteur : Vince Nadus
Date de publication : 2 décembre 2021
python django netbox

Nous allons ici mettre à jour Netbox de la version 3.0.3 à 3.0.11 Faire un snap ou un backup de sa machine avant de réaliser la mise à jour. Se placer dans le dossier netbox

cd /opt/netbox

Activer l'environnement virtuel Python

source /opt/netbox/venv/bin/activate

Se conformer aux pré-requis

NetBox v3.0 and later requires the following: Dependency Minimum Version Python 3.7 PostgreSQL 9.6 Redis 4.0

Regarder ses versions logiciels

(venv) root@netbox:/opt/netbox# python -V Python 3.9.2 (venv) root@netbox:/opt/netbox# psql -V psql (PostgreSQL) 13.3 (Debian 13.3-1) (venv) root@netbox:/opt/netbox# redis-server --version Redis server v=6.0.15 sha=00000000:0 malloc=jemalloc-5.2.1 bits=64 build=4610f4c3acf7fb25

Recupérer le lien de la dernière archive

https://github.com/netbox-community/netbox/releases

Mettre à jour la suite en fonction de la version(ici 3.0.11)

wget https://github.com/netbox-community/netbox/archive/v3.0.11.tar.gz tar -xzf v3.0.11.tar.gz -C /opt ln -sfn /opt/netbox-3.0.11/ /opt/netbox

Transférer les fichiers depuis la précédente installation vers la nouvelle

cp /opt/netbox-3.0.3/local_requirements.txt /opt/netbox/ cp /opt/netbox-3.0.3/netbox/netbox/configuration.py /opt/netbox/netbox/netbox/ cp /opt/netbox-3.0.3/netbox/netbox/ldap_config.py /opt/netbox/netbox/netbox/ cp -pr /opt/netbox-3.0.3/netbox/media/ /opt/netbox/netbox/ cp -r /opt/netbox-3.0.3/netbox/scripts /opt/netbox/netbox/ cp -r /opt/netbox-3.0.3/netbox/reports /opt/netbox/netbox/ cp /opt/netbox-3.0.3/gunicorn.py /opt/netbox/ cp -r /opt/netbox-3.0.3/venv /opt/netbox/

On sort de l'environnement actuel

(venv) root@netbox:/opt/netbox# deactivate root@netbox:/opt/netbox#

On se connecte au nouveau

source /opt/netbox/venv/bin/activate (venv) root@netbox:/opt/netbox# cd netbox/

Réaliser la mise à jour (pip, venv, etc ...)

./upgrade.sh

Nettoyer les relicats (optionnel)

python3 netbox/manage.py remove_stale_contenttypes --no-input python3 netbox/manage.py clearsessions

Rédémarrer les services

systemctl restart netbox netbox-rq

Erreur suite au redémarrage des services error_netbox.png

(venv) root@netbox:/opt/netbox/netbox# python manage.py collectstatic 240 static files copied to '/opt/netbox-3.0.11/netbox/static'.

Mes Mémos - Nadus · Créé et maintenue par Vincent NADEAU