1-a) Installation postgreSQL
apt-get update
apt-get install -y postgresql libpq-dev
1-b)Création base de données
su postgres
psql
CREATE DATABASE netbox;
CREATE USER netbox WITH PASSWORD 'netbox';
GRANT ALL PRIVILEGES ON DATABASE netbox TO netbox;
1-c)Tester la connexion à Postgres
su postgres
psql -U netbox -W -h localhost netbox
1-*) Importer ancienne base de données
2-a)Installation Netbox
apt-get install -y python3 python3-pip python3-dev build-essential libxml2-dev libxslt1-dev libffi-dev graphviz libpq-dev libssl-dev redis-server zlib1g-dev
2-b)Récuperer la derniere version de Netbox
wget https://github.com/netbox-community/netbox/archive/v2.6.4.zip
apt-get install unzip
unzip v2.6.4.zip
mv netbox-2.6.4/ netbox
mv netbox/ /opt/
3-a)Installer les pré-requis Python pour Netbox
cd /opt/netbox
pip3 install -r requirements.txt
pip3 install napalm
3-b)Configuration Netbox
cd netbox/netbox/
cp configuration.example.py configuration.py
cd /opt/netbox/netbox/
generate_secret_key.py
ALLOWED_HOSTS = ['netbox.example.com', '192.0.2.123']
DATABASE = {
'NAME': 'netbox', # Database name
'USER': 'netbox', # PostgreSQL username
'PASSWORD': 'netbox', # PostgreSQL password
'HOST': 'localhost', # Database server
'PORT': '', # Database port (leave blank for default)
}
generate_secret_key.py SECRET_KEY
cd /opt/netbox/netbox/
python3 manage.py migrate
4-a)Create a Super User
python3 manage.py createsuperuser
4-b)Collect Static Files
python3 manage.py collectstatic --no-input
4-c)Load Initial Data (Optional)
python3 manage.py loaddata initial_data
4-d)Test the Application
python3 manage.py runserver 0.0.0.0:8000 --insecure
** ) Sauvegarder Base de données PostGreSQL
pg_dump -U netbox -W -h localhost netbox > netbox-20-07-2020.sql
Le mot de passe de l’utilisateur netbox (-U) est demandé.
Commentaires récents