../_images/openl2m_logo.png

The Database

NOTE: this is a copy of the NetBox PostgreSQL installation document.

OpenL2M requires a PostgreSQL database to store data. This can be hosted locally or on a remote server. Please note that MySQL is not supported, as OpenL2M leverages PostgreSQL’s built-in Postgresql types

The installation instructions provided here have been tested to work on Ubuntu 22.04 and 20.04. Installation should still work on CentOS 7.x & 8.x, but those distributions are no longer tested or supported.

The particular commands needed to install dependencies on other distributions may vary significantly. Unfortunately, this is outside the control of the OpenL2M maintainers. Please consult your distribution’s documentation for assistance with any errors.

Installation - Ubuntu

sudo apt install -y postgresql
sudo systemctl start postgresql
sudo systemctl enable postgresql

Database Creation

Now that we have the database server installed, at a minimum, we need to create a database for OpenL2M and assign it a username and password for authentication.

NOTE: DO NOT USE THE PASSWORD FROM THE EXAMPLE:

sudo -u postgres psql
psql (12.17)
Type "help" for help.
postgres=# CREATE DATABASE openl2m;
CREATE DATABASE
postgres=# CREATE USER openl2m WITH PASSWORD 'xxxxxxxxxxxx';
CREATE ROLE
postgres=# GRANT ALL PRIVILEGES ON DATABASE openl2m TO openl2m;
GRANT
postgres=# \q

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.):

psql -U openl2m -W -h localhost openl2m
<output>
openl2m=> \connfinfo
You are connected to database "openl2m" as user "openl2m" on host "localhost"
<more output>
\q

If successful, you will enter a openl2m prompt. Type \q to exit.

If all is well, you are now ready to install the OpenL2M application components