| 113 | |
| 114 | === 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. |
| 116 | {{{ |
| 117 | # cd /opt/netbox/netbox/netbox/ |
| 118 | # sudo cp configuration_example.py configuration.py |
| 119 | }}} |
| 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: |
| 121 | * ALLOWED_HOSTS |
| 122 | * DATABASE |
| 123 | * REDIS |
| 124 | * SECRET_KEY |
| 125 | |
| 126 | === 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.) |
| 128 | |
| 129 | {{{ |
| 130 | # vim configuration.py |
| 131 | |
| 132 | ALLOWED_HOSTS = ['netbox.example.com', '192.0.2.123'] |
| 133 | }}} |
| 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: |
| 135 | {{{ |
| 136 | ALLOWED_HOSTS = ['*'] |
| 137 | }}} |
| 138 | |
| 139 | === DATABASE === |
| 140 | This parameter holds the database configuration details. You must define the username and password used when you configured PostgreSQL. If the service is running on a remote host, update the '''HOST and PORT ''' parameters accordingly. See the configuration documentation for more detail on individual parameters. |
| 141 | {{{ |
| 142 | DATABASE = { |
| 143 | 'NAME': 'netbox', # Database name |
| 144 | 'USER': 'netbox', # PostgreSQL username |
| 145 | 'PASSWORD': 'netbox123', # PostgreSQL password |
| 146 | 'HOST': 'localhost', # Database server |
| 147 | 'PORT': '', # Database port (leave blank for default) |
| 148 | 'CONN_MAX_AGE': 300, # Max database connection age (seconds) |
| 149 | } |
| 150 | }}} |
| 151 | |