Installing System Dependencies - Nautobot Documentation

Skip to content

# Installing Nautobot System Dependencies

The documentation assumes that you are running one of the following:

- Ubuntu 20.04+
- Debian 11+
- Fedora, RHEL/CentOS 8.2+ and derivatives
  - Delimited by `Fedora/RHEL` tabs in the docs, but also includes other derivatives of RHEL such as RockyLinux or AlmaLinux

## Install System Packages

Install the prerequisite system libraries and utilities.

This will install:

- Git
- Python 3
- Pip
- Redis server and client

Ubuntu/Debian Fedora/RHEL
Install system dependencies

    sudo apt update -y
    sudo apt install -y git python3 python3-pip python3-venv python3-dev redis-server

Install system dependencies

    sudo dnf check-update
    sudo dnf install -y git python3 python3-devel python3-pip redis

## Database Setup

In this step you'll set up your database server, create a database and database user for use by Nautobot, and verify your connection to the database.

You must select either MySQL (MariaDB is not supported) or PostgreSQL. PostgreSQL is used by default with Nautobot, so if you just want to get started or don't have a preference, please stick with PostgreSQL.

Please follow the steps for your selected database backend below.

Ubuntu/Debian Fedora/RHEL
PostgreSQL MySQL

### Install PostgreSQL

This will install the PostgreSQL database server and client.

Install Postgres

    sudo apt install -y postgresql

### Create a PostgreSQL Database

At a minimum, we need to create a database for Nautobot 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. Choose a strong, random password to ensure secure database authentication for your Nautobot installation.

Enter into Postgres

    sudo -u postgres psql

Example of Entering Postgres
Entering Postgres DB

    psql (16.3 (Ubuntu 16.3-0ubuntu0.24.04.1))
    Type "help" for help.

    postgres=#

Create the Nautobot DB

    CREATE DATABASE nautobot;
    CREATE USER nautobot WITH PASSWORD 'insecure_password';
    GRANT ALL PRIVILEGES ON DATABASE nautobot TO nautobot;
    \connect nautobot
    GRANT CREATE ON SCHEMA public TO nautobot;
    \q

Example Postgres DB Creation Output
Example output of creating the DB

    postgres=# CREATE DATABASE nautobot;
    CREATE DATABASE
    postgres=# CREATE USER nautobot WITH PASSWORD 'insecure_password';
    CREATE ROLE
    postgres=# GRANT ALL PRIVILEGES ON DATABASE nautobot TO nautobot;
    GRANT
    postgres=# \connect nautobot
    You are now connected to database "nautobot" as user "postgres".
    nautobot=# GRANT CREATE ON SCHEMA public TO nautobot;
    GRANT
    nautobot=# \q

### Verify PostgreSQL Service Status

You can verify that authentication works issuing the following command and providing the configured password. (Replace `localhost` with your database server if using a remote database.)

If successful, you will enter a `nautobot` prompt. Type `\conninfo` to confirm your connection, or type `\q` to exit.

Connect to the Nautobot DB

    psql --username nautobot --password --host localhost nautobot

Example Postgres Connection Output
Example output

    Password for user nautobot:
    psql (16.3 (Ubuntu 16.3-0ubuntu0.24.04.1))
    SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, compression: off)
    Type "help" for help.

    nautobot=> \conninfo
    You are connected to database "nautobot" as user "nautobot" on host "localhost" (address "::1") at port "5432".
    SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, compression: off)
    nautobot=> \q

### Install MySQL

This will install the MySQL database server and client. Additionally, MySQL requires that the MySQL development libraries and the `pkg-config` package are both installed so that we may compile the Python `mysqlclient` library during the Nautobot installation steps.

Install MySQL required packages

    sudo apt install -y libmysqlclient-dev mysql-server pkg-config

### Create a MySQL Database

At a minimum, we need to create a database for Nautobot and assign it a username and password for authentication. This is done with the following commands.

Note

Replace `localhost` below with your database server if using a remote database.

Danger

Do not use the password from the example. Choose a strong, random password to ensure secure database authentication for your Nautobot installation.

Connect to MySQL

    sudo -u root mysql

Create the Nautobot DB

    CREATE DATABASE nautobot;
    CREATE USER 'nautobot'@'localhost' IDENTIFIED BY 'insecure_password';
    GRANT ALL ON nautobot.* TO 'nautobot'@'localhost';
    \q

Example MySQL output
Example MySQL DB creation output.

    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 11
    Server version: 8.0.37-0ubuntu0.24.04.1 (Ubuntu)

    Copyright (c) 2000, 2024, Oracle and/or its affiliates.

    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.

    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

    mysql> CREATE DATABASE nautobot;
    Query OK, 1 row affected (0.00 sec)

    mysql> CREATE USER 'nautobot'@'localhost' IDENTIFIED BY 'insecure_password';
    Query OK, 0 rows affected (0.01 sec)

    mysql> GRANT ALL ON nautobot.* TO 'nautobot'@'localhost';
    Query OK, 0 rows affected (0.00 sec)

    mysql> \q
    Bye

### Verify MySQL Service Status

You can verify that authentication works issuing the following command and providing the configured password.

If successful, you will enter a `mysql>` prompt. Type `status` to confirm your connection, or type `\q` to exit.

Note

Replace `localhost` below with your database server if using a remote database.

Test the MySQL DB connection

    mysql --user nautobot --password --host localhost nautobot

Then after the password prompt you can use `status` and `\q` commands

Check the status and quit

    status
    \q

Example Verification of MySQL database
Example test output

    Enter password:
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 13
    Server version: 8.0.37-0ubuntu0.24.04.1 (Ubuntu)

    Copyright (c) 2000, 2024, Oracle and/or its affiliates.

    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.

    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

    mysql> status
    --------------
    mysql  Ver 8.0.37-0ubuntu0.24.04.1 for Linux on x86_64 ((Ubuntu))

    Connection id:          13
    Current database:       nautobot
    Current user:           nautobot@localhost
    SSL:                    Not in use
    Current pager:          stdout
    Using outfile:          ''
    Using delimiter:        ;
    Server version:         8.0.37-0ubuntu0.24.04.1 (Ubuntu)
    Protocol version:       10
    Connection:             Localhost via UNIX socket
    Server characterset:    utf8mb4
    Db     characterset:    utf8mb4
    Client characterset:    utf8mb4
    Conn.  characterset:    utf8mb4
    UNIX socket:            /var/run/mysqld/mysqld.sock
    Binary data as:         Hexadecimal
    Uptime:                 26 min 31 sec

    Threads: 2  Questions: 29  Slow queries: 0  Opens: 193  Flush tables: 3  Open tables: 112  Queries per second avg: 0.018
    --------------

    mysql> \q
    Bye

PostgreSQL MySQL

### Install PostgreSQL

This will install the PostgreSQL database server and client.

Install Postgres

    sudo dnf install -y postgresql-server

### Initialize PostgreSQL

Fedora/RHEL and related distros typically require a manual step to generate the initial configurations required by PostgreSQL.

Setup initial required configurations

    sudo postgresql-setup --initdb

### Configure Authentication

Fedora/RHEL and related distros typically configure PostgreSQL to use `ident` host-based authentication by default. Because Nautobot will need to authenticate using a username and password, we must update `pg_hba.conf` to support `md5` password authentication.

Tip

Under many distros, you may be able to use the more secure `scram-sha-256` as an alternative to `md5`, but this option may not be available by default; enabling it is beyond the scope of this documentation.

As root, edit `/var/lib/pgsql/data/pg_hba.conf` and change `ident` to `md5` for the lines below.

Before:

Before /var/lib/pgsql/data/pg_hba.conf

    # IPv4 local connections:
    host    all             all             127.0.0.1/32            ident
    # IPv6 local connections:
    host    all             all             ::1/128                 ident

After:

After /var/lib/pgsql/data/pg_hba.conf

    # IPv4 local connections:
    host    all             all             127.0.0.1/32            md5
    # IPv6 local connections:
    host    all             all             ::1/128                 md5

### Start PostgreSQL

Start the service and enable it to run at system startup:

Start and enable the Postgres service at start up

    sudo systemctl enable --now postgresql

### Create a PostgreSQL Database

At a minimum, we need to create a database for Nautobot 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. Choose a strong, random password to ensure secure database authentication for your Nautobot installation.

Enter into Postgres

    sudo -u postgres psql

Create the database and grant permissions to the Nautobot user.

Create Nautobot DB

    CREATE DATABASE nautobot;
    CREATE USER nautobot WITH PASSWORD 'insecure_password';
    GRANT ALL PRIVILEGES ON DATABASE nautobot TO nautobot;
    \connect nautobot
    GRANT CREATE ON SCHEMA public TO nautobot;
    \q

Example Database creation output.
Example DB creation output

    postgres=# CREATE DATABASE nautobot;
    CREATE DATABASE
    postgres=# CREATE USER nautobot WITH PASSWORD 'insecure_password';
    CREATE ROLE
    postgres=# GRANT ALL PRIVILEGES ON DATABASE nautobot TO nautobot;
    GRANT
    postgres=# \connect nautobot
    You are now connected to database "nautobot" as user "postgres".
    nautobot=# GRANT CREATE ON SCHEMA public TO nautobot;
    GRANT
    nautobot=# \q

### Verify PostgreSQL Service Status

You can verify that authentication works issuing the following command and providing the configured password. (Replace `localhost` with your database server if using a remote database.)

If successful, you will enter a `nautobot` prompt. Type `\conninfo` to confirm your connection, or type `\q` to exit.

Test connection to Nautobot DB

    psql --username nautobot --password --host localhost nautobot

Example Verification Output

    Password for user nautobot:
    psql (16.3)
    Type "help" for help.

    nautobot=> \conninfo
    You are connected to database "nautobot" as user "nautobot" on host "localhost" (address "::1") at port "5432".
    nautobot=> \q

### Install MySQL

This will install the MySQL database server and client. Additionally, MySQL requires that `gcc` and the MySQL development libraries are installed so that we may compile the Python `mysqlclient` library during the Nautobot installation steps.

Install MySQL packages

    sudo dnf install -y gcc mysql-server mysql-devel

Tip

If you get an error about `Unable to find a match: mysql-devel`, you may need to enable additional sources for packages. On at least CentOS 9 and AlmaLinux 9, the command `sudo dnf config-manager --set-enabled crb` is the way to enable the necessary repository.

### Start MySQL

Start the service and enable it to run at system startup:

Start and enable at start up of the MySQL service

    sudo systemctl enable --now mysql

Tip

Depending on your Linux distribution, the service may be named `mysqld` instead of `mysql`. If you get an error with the above command, try `sudo systemctl enable --now mysqld` instead.

### Create a MySQL Database

At a minimum, we need to create a database for Nautobot and assign it a username and password for authentication. This is done with the following commands.

Note

Replace `localhost` below with your database server if using a remote database.

Danger

Do not use the password from the example. Choose a strong, random password to ensure secure database authentication for your Nautobot installation.

Connect to MySQL

    sudo -u root mysql

Create Nautobot DB

    CREATE DATABASE nautobot;
    CREATE USER 'nautobot'@'localhost' IDENTIFIED BY 'insecure_password';
    GRANT ALL ON nautobot.* TO 'nautobot'@'localhost';
    \q

Example Creation of MySQL DB
Example output creation of DB

    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 8
    Server version: 8.0.37 Source distribution

    Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.

    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.

    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

    mysql> CREATE DATABASE nautobot;
    Query OK, 1 row affected (0.00 sec)

    mysql> CREATE USER 'nautobot'@'localhost' IDENTIFIED BY 'insecure_password';
    Query OK, 0 rows affected (0.00 sec)

    mysql> GRANT ALL ON nautobot.* TO 'nautobot'@'localhost';
    Query OK, 0 rows affected (0.00 sec)

    mysql> \q
    Bye

### Verify MySQL Service Status

You can verify that authentication works issuing the following command and providing the configured password.

If successful, you will enter a `mysql>` prompt. Type `status` to confirm your connection, or type `\q` to exit.

Note

Replace `localhost` below with your database server if using a remote database.

    mysql --user nautobot --password --host localhost nautobot

Example MySQL Verification

    Enter password:
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 10
    Server version: 8.0.37 Source distribution

    Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.

    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.

    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

    mysql> status
    --------------
    mysql  Ver 8.0.37 for Linux on x86_64 (Source distribution)

    Connection id:          10
    Current database:       nautobot
    Current user:           nautobot@localhost
    SSL:                    Not in use
    Current pager:          stdout
    Using outfile:          ''
    Using delimiter:        ;
    Server version:         8.0.37 Source distribution
    Protocol version:       10
    Connection:             Localhost via UNIX socket
    Server characterset:    utf8mb4
    Db     characterset:    utf8mb4
    Client characterset:    utf8mb4
    Conn.  characterset:    utf8mb4
    UNIX socket:            /var/lib/mysql/mysql.sock
    Binary data as:         Hexadecimal
    Uptime:                 4 min 12 sec

    Threads: 2  Questions: 12  Slow queries: 0  Opens: 151  Flush tables: 3  Open tables: 69  Queries per second avg: 0.047
    --------------

    mysql> \q
    Bye

### Troubleshooting

#### django.db.utils.NotSupportedError: conversion between UTF8 and SQL_ASCII is not supported

Django requires the database encoding for PostgreSQL databases to be set to UTF-8. If you receive the error `django.db.utils.NotSupportedError: conversion between UTF8 and SQL_ASCII is not supported`, you will need to drop and re-create the `nautobot` database with the correct encoding.

## Redis Setup

Ubuntu/Debian Fedora/RHEL

Since Redis was already installed, let's just verify that it's working using `redis-cli`:

Test Redis connection

    redis-cli ping

Example Redis check output
redis-cli ping output

    PONG

### Start Redis

Start the service and enable it to run at system startup:

Enable Redis to start on boot and start Redis now

    sudo systemctl enable --now redis

### Verify Redis Service Status

Use the `redis-cli` utility to ensure the Redis service is functional:

Test Redis connection

    redis-cli ping

Example Redis check output

    PONG

## Deploy Nautobot

Now that Nautobot dependencies are installed and configured, you're ready to Install Nautobot!