For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to page URLs.
Skip to content

Installation essentials

This guide will walk you through the basic steps to quickly install and set up OCS Inventory using our Debian repositories. For advanced setups or other installation methods, see the Server Setup and System Requirements sections.


Before You Begin

System Requirements

Ensure you have the following prerequisites before starting this installation:

  • A server running a supported operating system:

  • A supported database backend (e.g., MySQL, PostgreSQL)

  • Administrative access to the server

This guide covers the default configuration. Advanced setup (e.g., distributed components) is covered in the Installation methods section.


Quick Installation Steps

Database Installation

1

Install PostgreSQL

sudo apt update
sudo apt install postgresql postgresql-contrib

Ensure PostgreSQL starts now and on boot:

sudo systemctl start postgresql
sudo systemctl enable postgresql
2

Create database and user, and set up the required permissions:

Replace credentials as needed. This example uses:

  • Username: ocsuser

  • Password: ocsuser

  • Database Name: ocsdb

sudo -u postgres psql <<EOF
-- Create user and database
CREATE USER ocsuser WITH PASSWORD 'ocsuser';
CREATE DATABASE ocsdb;

-- Grant basic connect permission
GRANT ALL PRIVILEGES ON DATABASE ocsdb TO ocsuser;

-- Connect to the database to set default privileges
\c ocsdb

-- Allow the application user to create objects in the public schema
GRANT USAGE, CREATE ON SCHEMA public TO ocsuser;

-- Set default privileges for future tables, sequences, and functions
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON TABLES TO ocsuser;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON SEQUENCES TO ocsuser;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON FUNCTIONS TO ocsuser;
EOF
3

Configure PostgreSQL for remote connections:

Update postgresql.conf to listen for remote connections. Assuming PostgreSQL version 17, modify the listen_addresses setting:

sudo sed -i "s/#listen_addresses = 'localhost'/listen_addresses = '*'/" /etc/postgresql/17/main/postgresql.conf

Add a client authentication rule. Allow remote connections for the ocsuser user and ocsdb database:

echo "host    ocsdb          ocsuser         0.0.0.0/0               scram-sha-256" | sudo tee -a /etc/postgresql/17/main/pg_hba.conf

Restart the PostgreSQL service to apply the configuration changes:

sudo systemctl restart postgresql
4

Test the remote connection

From a remote machine with psql installed, verify access:

  • Replace <remote-server-ip> with your PostgreSQL server's IP address.

  • Enter the password (ocsuser) when prompted.

psql -h <remote-server-ip> -U ocsuser -d ocsdb

For advanced configuration or customization, refer to the official PostgreSQL documentation.


Server Installation

1

Add the OCS Inventory repository

Add the OCS Inventory repository. This imports the GPG key used to sign OCS Inventory packages and registers the APT repository.

Replace <distribution_codename> with your system’s codename.

Supported codenames:

  • Debian: bookworm, trixie

  • Ubuntu: jammy, noble, plucky

This installs:

  • /etc/apt/trusted.gpg.d/ocs-archive-keyring.gpg - the public GPG key used to verify package signatures

  • /etc/apt/sources.list.d/ocsinventory.list - the repository definition

2

Install the packages

This pulls in both ocsinventory-backend and ocsinventory-frontend with matching versions.

On installation, ocsinventory-backend creates a dedicated system user used to run the uWSGI worker process and own the application files. It also generates a Django SECRET_KEY automatically.

3

Configure the backend

Run the interactive configuration script. Set the database connection and frontend redirection URL. The script then applies database migrations.

You will be prompted for:

  • The database engine: PostgreSQL or MySQL/MariaDB.

  • The database host, port, name, username, and password.

  • The frontend URL used for login redirection: FRONTEND_REDIRECT.

The script installs the matching Python database driver and runs manage.py migrate.

The following example shows the database prompts:

After successful configuration:

  • Database migrations will run automatically.

  • Logs for the database migrations can be found at /tmp/ocsinventory-backend-configuration.log.

4

Configure domain names

By default, both vhosts use server_name _;. They answer any request, regardless of its Host header. Configure a distinct hostname for each component when they share a server.

Update server_name in each Nginx vhost. For example, use ocsinventory-backend.com for the API. Use ocsinventory-frontend.com for the web console.

When both components share a node, two catch-all vhosts conflict. Assign each component a distinct hostname.

Ensure both domains resolve to this server's IP address. Use DNS or /etc/hosts.

If you configure a backend domain, update the frontend API route. Edit /usr/share/ocsinventory-frontend/config/config.json:

config.json is a static file. The change applies on the next page load.

5

Access the application

  • Frontend (web console): http://<server-ip-or-domain>/

  • Backend (API): http://<server-ip-or-domain>:8081/

A 401 Unauthorized response at the backend API root is expected. It confirms the backend is reachable.

6

Services installed

Service
Description
Port

nginx

Serves the frontend and reverse-proxies the backend.

80 (frontend), 8081 (backend)

ocsinventory-backend-uwsgi

Runs the Django backend through uWSGI.

Unix socket: /var/run/ocsinventory-backend/ocsinventory-backend.sock

Useful commands:

7

Verify installation

To confirm the installation was successful:

  • Log into the web console and verify the interface loads correctly.

  • Connect an OCS agent to the server and verify data transmission.

Having trouble? Check our Troubleshooting section.

Last updated