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:
Debian-based Linux (see Installation methods for others).
A supported database backend (e.g., MySQL, PostgreSQL)
Administrative access to the server
Quick Installation Steps
Database Installation
Install PostgreSQL
sudo apt update
sudo apt install postgresql postgresql-contribEnsure PostgreSQL starts now and on boot:
sudo systemctl start postgresql
sudo systemctl enable postgresqlCreate database and user, and set up the required permissions:
Replace credentials as needed. This example uses:
Username:
ocsuserPassword:
ocsuserDatabase 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;
EOFConfigure 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.confAdd 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.confRestart the PostgreSQL service to apply the configuration changes:
sudo systemctl restart postgresqlServer Installation
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,trixieUbuntu:
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
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.
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:
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

