Step 3: Install PostgreSQL

Odoo requires PostgreSQL as its database management system. Install it and create a user for Odoo. 

bash
sudo apt install -y postgresql
sudo -u postgres createuser --createdb --username postgres --pwprompt odoo

note : 

By default, PostgreSQL only allows connection over UNIX sockets and loopback connections (from “localhost”, the same machine the PostgreSQL server is installed on).


UNIX socket is fine if you want Odoo and PostgreSQL to execute on the same machine, and is the default when no host is provided, but if you want Odoo and PostgreSQL to execute on different machines 1 it will need to listen to network interfaces 2, either:


    Only accept loopback connections and use an SSH tunnel between the machine on which Odoo runs and the one on which PostgreSQL runs, then configure Odoo to connect to its end of the tunnel


    Accept connections to the machine on which Odoo is installed, possibly over ssl (see PostgreSQL connection settings for details), then configure Odoo to connect over the network


Configuration sample


    Allow tcp connection on localhost


    Allow tcp connection from 192.168.1.x network


in /etc/postgresql/<YOUR POSTGRESQL VERSION>/main/pg_hba.conf set:


# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
host    all             all             192.168.1.0/24          md5


in /etc/postgresql/<YOUR POSTGRESQL VERSION>/main/postgresql.conf set:


listen_addresses = 'localhost,192.168.1.2'
port = 5432
max_connections = 80
Rating
0 0

There are no comments for now.

to be the first to leave a comment.