Changes between Version 12 and Version 13 of Nmm2022/Agenda/Netbox


Ignore:
Timestamp:
Jun 2, 2022, 4:14:57 AM (2 years ago)
Author:
geethike
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Nmm2022/Agenda/Netbox

    v12 v13  
    1 = Installing NetBox on Ubuntu 20.04 =
    2 NetBox requires PostgreSQL 10 or later. Please note that MySQL and other relational databases are not supported.
     1= Installing !NetBox on Ubuntu 20.04 =
     2!NetBox requires PostgreSQL 10 or later. Please note that MySQL and other relational databases are not supported.
    33
    44=== PostgreSQL Database Installation ===
     
    1515
    1616=== Database Creation ===
    17 At a minimum, we need to create a database for NetBox and assign it a username and password for authentication. Start by invoking the PostgreSQL shell as the system Postgres user.
     17At a minimum, we need to create a database for !NetBox and assign it a username and password for authentication. Start by invoking the PostgreSQL shell as the system Postgres user.
    1818{{{
    1919# sudo -u postgres psql
     
    2626GRANT ALL PRIVILEGES ON DATABASE netbox TO netbox;
    2727}}}
    28 Do not use the password from the example. Choose a strong, random password to ensure secure database authentication for your NetBox installation.
     28Do not use the password from the example. Choose a strong, random password to ensure secure database authentication for your !NetBox installation.
    2929
    3030Once complete, enter ''' \q ''' to exit the PostgreSQL shell.
     
    3232=== Redis Installation ===
    3333
    34 Redis is an in-memory key-value store which NetBox employs for caching and queuing. This section entails the installation and configuration of a local Redis instance.
     34Redis is an in-memory key-value store which !NetBox employs for caching and queuing. This section entails the installation and configuration of a local Redis instance.
    3535Redis v4.0 or later required.
    3636{{{
     
    5656If successful, you should receive a ''' PONG ''' response from the server.
    5757
    58 == NetBox Installation ==
    59 This section of the documentation discusses installing and configuring the NetBox application itself.
     58== !NetBox Installation ==
     59This section of the documentation discusses installing and configuring the !NetBox application itself.
    6060=== Install System Packages ===
    61 Begin by installing all system packages required by NetBox and its dependencies.
     61Begin by installing all system packages required by !NetBox and its dependencies.
    6262Python 3.8 or later required
    6363
     
    6969# python3 -V
    7070}}}
    71 === Download NetBox ===
    72 This documentation provides two options for installing NetBox: from a downloadable archive, or from the git repository. Installing from a package (option A below) requires manually fetching and extracting the archive for every future update, whereas installation via git (option B) allows for seamless upgrades by re-pulling the master branch.
     71=== Download !NetBox ===
     72This documentation provides two options for installing !NetBox: from a downloadable archive, or from the git repository. Installing from a package (option A below) requires manually fetching and extracting the archive for every future update, whereas installation via git (option B) allows for seamless upgrades by re-pulling the master branch.
    7373
    7474=== Option A: Download a Release Archive ===
    75 Download the latest stable release from GitHub as a tarball or ZIP archive and extract it to your desired path. In this example, we'll use ''' /opt/netbox ''' as the NetBox root.
     75Download the latest stable release from !GitHub as a tarball or ZIP archive and extract it to your desired path. In this example, we'll use ''' /opt/netbox ''' as the !NetBox root.
    7676{{{
    7777# sudo wget https://github.com/netbox-community/netbox/archive/vX.Y.Z.tar.gz
     
    8181
    8282=== Option B: Clone the Git Repository ===
    83 Create the base directory for the NetBox installation. For this guide, we'll use ''' /opt/netbox. '''
     83Create the base directory for the !NetBox installation. For this guide, we'll use ''' /opt/netbox. '''
    8484{{{
    8585# sudo mkdir -p /opt/netbox/
     
    9090# sudo apt install -y git
    9191}}}
    92 Next, clone the master branch of the NetBox GitHub repository into the current directory. (This branch always holds the current stable release.)
     92Next, clone the master branch of the !NetBox !GitHub repository into the current directory. (This branch always holds the current stable release.)
    9393{{{
    9494sudo git clone -b master --depth 1 https://github.com/netbox-community/netbox.git .
     
    105105}}}
    106106
    107 === Create the NetBox System User ===
    108 Create a system user account named ''' netbox '''. We'll configure the WSGI and HTTP services to run under this account. We'll also assign this user ownership of the media directory. This ensures that NetBox will be able to save uploaded files.
     107=== Create the !NetBox System User ===
     108Create a system user account named ''' netbox '''. We'll configure the WSGI and HTTP services to run under this account. We'll also assign this user ownership of the media directory. This ensures that !NetBox will be able to save uploaded files.
    109109{{{
    110110# sudo adduser --system --group netbox
     
    113113
    114114=== Configuration ===
    115 Move into the NetBox configuration directory and make a copy of ''' configuration_example.py ''' named ''' configuration.py.''' This file will hold all of your local configuration parameters.
     115Move into the !NetBox configuration directory and make a copy of ''' configuration_example.py ''' named ''' configuration.py.''' This file will hold all of your local configuration parameters.
    116116{{{
    117117# cd /opt/netbox/netbox/netbox/
    118118# sudo cp configuration_example.py configuration.py
    119119}}}
    120 Open ''' configuration.py ''' with your preferred editor to begin configuring NetBox. NetBox offers many configuration parameters, but only the following four are required for new installations:
     120Open ''' configuration.py ''' with your preferred editor to begin configuring !NetBox. !NetBox offers many configuration parameters, but only the following four are required for new installations:
    121121* ALLOWED_HOSTS
    122122* DATABASE
     
    125125
    126126=== ALLOWED_HOSTS ===
    127 This is a list of the valid hostnames and IP addresses by which this server can be reached. You must specify at least one name or IP address. (Note that this does not restrict the locations from which NetBox may be accessed: It is merely for HTTP host header validation.)
     127This is a list of the valid hostnames and IP addresses by which this server can be reached. You must specify at least one name or IP address. (Note that this does not restrict the locations from which !NetBox may be accessed: It is merely for HTTP host header validation.)
    128128
    129129{{{
     
    132132ALLOWED_HOSTS = ['netbox.example.com', '192.0.2.123']
    133133}}}
    134 If you are not yet sure what the domain name and/or IP address of the NetBox installation will be, you can set this to a wildcard (asterisk) to allow all host values:
     134If you are not yet sure what the domain name and/or IP address of the !NetBox installation will be, you can set this to a wildcard (asterisk) to allow all host values:
    135135{{{
    136136ALLOWED_HOSTS = ['*']
     
    151151
    152152=== REDIS ===
    153 Redis is a in-memory key-value store used by NetBox for caching and background task queuing. Redis typically requires minimal configuration; the values below should suffice for most installations.
    154 
    155 Note that NetBox requires the specification of two separate Redis databases: ''' tasks and caching.''' These may both be provided by the same Redis service, however each should have a unique numeric database ID.
     153Redis is a in-memory key-value store used by !NetBox for caching and background task queuing. Redis typically requires minimal configuration; the values below should suffice for most installations.
     154
     155Note that !NetBox requires the specification of two separate Redis databases: ''' tasks and caching.''' These may both be provided by the same Redis service, however each should have a unique numeric database ID.
    156156{{{
    157157REDIS = {
     
    182182
    183183=== Run the Upgrade Script ===
    184 Once NetBox has been configured, we're ready to proceed with the actual installation. We'll run the packaged upgrade script (upgrade.sh) to perform the following actions:
     184Once !NetBox has been configured, we're ready to proceed with the actual installation. We'll run the packaged upgrade script (upgrade.sh) to perform the following actions:
    185185
    186186* Create a Python virtual environment
     
    193193# sudo /opt/netbox/upgrade.sh
    194194}}}
    195 Note that Python 3.8 or later is required for NetBox v3.2 and later releases.
     195Note that Python 3.8 or later is required for !NetBox v3.2 and later releases.
    196196
    197197=== Create a Super User ===
    198 NetBox does not come with any predefined user accounts. You'll need to create a super user (administrative account) to be able to log into NetBox. First, enter the Python virtual environment created by the upgrade script:
     198!NetBox does not come with any predefined user accounts. You'll need to create a super user (administrative account) to be able to log into !NetBox. First, enter the Python virtual environment created by the upgrade script:
    199199{{{
    200200# source /opt/netbox/venv/bin/activate
     
    208208}}}
    209209=== Test the Application ===
    210 At this point, we should be able to run NetBox's development server for testing. We can check by starting a development instance:
     210At this point, we should be able to run !NetBox's development server for testing. We can check by starting a development instance:
    211211{{{
    212212# python3 manage.py runserver 0.0.0.0:8000 --insecure
     
    223223Quit the server with CONTROL-C.
    224224}}}
    225 Next, connect to the name or IP of the server (as defined in ALLOWED_HOSTS) on port 8000; for example, http://127.0.0.1:8000/. You should be greeted with the NetBox home page. Try logging in using the username and password specified when creating a superuser.
     225Next, connect to the name or IP of the server (as defined in ALLOWED_HOSTS) on port 8000; for example, http://127.0.0.1:8000/. You should be greeted with the !NetBox home page. Try logging in using the username and password specified when creating a superuser.
    226226
    227227Type ''' Ctrl+c ''' to stop the development server.
    228228
    229229=== Gunicorn ===
    230 Like most Django applications, NetBox runs as a WSGI application behind an HTTP server. This documentation shows how to install and configure gunicorn (which is automatically installed with NetBox) for this role, however other WSGI servers are available and should work similarly well. uWSGI is a popular alternative.
     230Like most Django applications, !NetBox runs as a WSGI application behind an HTTP server. This documentation shows how to install and configure gunicorn (which is automatically installed with !NetBox) for this role, however other WSGI servers are available and should work similarly well. uWSGI is a popular alternative.
    231231
    232232''' Configuration '''
    233233
    234 NetBox ships with a default configuration file for gunicorn. To use it, copy ''' /opt/netbox/contrib/gunicorn.py to /opt/netbox/gunicorn.py. '''(We make a copy of this file rather than pointing to it directly to ensure that any local changes to it do not get overwritten by a future upgrade.)
     234!NetBox ships with a default configuration file for gunicorn. To use it, copy ''' /opt/netbox/contrib/gunicorn.py to /opt/netbox/gunicorn.py. '''(We make a copy of this file rather than pointing to it directly to ensure that any local changes to it do not get overwritten by a future upgrade.)
    235235
    236236{{{
     
    239239
    240240''' systemd Setup '''
    241 We'll use systemd to control both gunicorn and NetBox's background worker process. First, copy ''' contrib/netbox.service ''' and ''' contrib/netbox-rq.service ''' to the ''' /etc/systemd/system/ '''directory and reload the ''' systemd ''' daemon:
     241We'll use systemd to control both gunicorn and !NetBox's background worker process. First, copy ''' contrib/netbox.service ''' and ''' contrib/netbox-rq.service ''' to the ''' /etc/systemd/system/ '''directory and reload the ''' systemd ''' daemon:
    242242{{{
    243243# sudo cp -v /opt/netbox/contrib/*.service /etc/systemd/system/
     
    275275''' Obtain an SSL Certificate '''
    276276
    277 To enable HTTPS access to NetBox, you'll need a valid SSL certificate. You can purchase one from a trusted commercial provider, obtain one for free from Let's Encrypt, or generate your own (although self-signed certificates are generally untrusted). Both the public certificate and private key files need to be installed on your NetBox server in a location that is readable by the netbox user.
     277To enable HTTPS access to !NetBox, you'll need a valid SSL certificate. You can purchase one from a trusted commercial provider, obtain one for free from Let's Encrypt, or generate your own (although self-signed certificates are generally untrusted). Both the public certificate and private key files need to be installed on your !NetBox server in a location that is readable by the netbox user.
    278278
    279279The command below can be used to generate a self-signed certificate for testing purposes, however it is strongly recommended to use a certificate from a trusted authority in production. Two files will be created: the public certificate ''' (netbox.crt) ''' and the private key ''' (netbox.key).''' The certificate is published to the world, whereas the private key must be kept secret at all times.
     
    294294}}}
    295295
    296 Once nginx is installed, copy the nginx configuration file provided by NetBox to '''/etc/nginx/sites-available/netbox. ''' Be sure to replace ''' netbox.example.com ''' with the domain name or IP address of your installation. (This should match the value configured for ALLOWED_HOSTS in configuration.py.)
     296Once nginx is installed, copy the nginx configuration file provided by !NetBox to '''/etc/nginx/sites-available/netbox. ''' Be sure to replace ''' netbox.example.com ''' with the domain name or IP address of your installation. (This should match the value configured for ALLOWED_HOSTS in configuration.py.)
    297297{{{
    298298# sudo cp /opt/netbox/contrib/nginx.conf /etc/nginx/sites-available/netbox