1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

59 lines
1.6 KiB
Markdown
Raw Normal View History

2016-07-08 16:00:53 -04:00
NetBox requires a PostgreSQL database to store data. MySQL is not supported, as NetBox leverage's PostgreSQL's built-in [network address types](https://www.postgresql.org/docs/9.1/static/datatype-net-types.html).
# Installation
**Debian/Ubuntu**
2016-07-08 16:00:53 -04:00
2016-11-30 12:01:45 -05:00
```shell
# apt-get install -y postgresql libpq-dev python-psycopg2
```
**CentOS/RHEL**
2016-07-08 16:00:53 -04:00
2016-11-30 12:01:45 -05:00
```shell
# yum install -y postgresql postgresql-server postgresql-devel python-psycopg2
# postgresql-setup initdb
```
If using CentOS, modify the PostgreSQL configuration to accept password-based authentication by replacing `ident` with `md5` for all host entries within `/var/lib/pgsql/data/pg_hba.conf`. For example:
2016-11-30 12:01:45 -05:00
```text
host all all 127.0.0.1/32 md5
host all all ::1/128 md5
2016-07-08 16:00:53 -04:00
```
Then, start the service:
2016-11-30 12:01:45 -05:00
```shell
# systemctl start postgresql
```
2016-07-08 16:00:53 -04:00
# Database Creation
2016-07-08 16:00:53 -04:00
At a minimum, we need to create a database for NetBox and assign it a username and password for authentication. This is done with the following commands.
!!! danger
DO NOT USE THE PASSWORD FROM THE EXAMPLE.
2016-11-30 12:01:45 -05:00
```shell
2016-07-08 16:00:53 -04:00
# sudo -u postgres psql
psql (9.3.13)
Type "help" for help.
postgres=# CREATE DATABASE netbox;
CREATE DATABASE
postgres=# CREATE USER netbox WITH PASSWORD 'J5brHrAXFLQSif0K';
CREATE ROLE
postgres=# GRANT ALL PRIVILEGES ON DATABASE netbox TO netbox;
GRANT
postgres=# \q
```
You can verify that authentication works issuing the following command and providing the configured password:
2016-11-30 12:01:45 -05:00
```shell
2016-07-08 16:00:53 -04:00
# psql -U netbox -h localhost -W
```
If successful, you will enter a `postgres` prompt. Type `\q` to exit.