Installation¶
Instructions to install PostgreSQL on different platforms.
Google Cloud¶
According to the documentation on Google Community.
Install PostgreSQL
Follow these steps to install PostgreSQL on your Compute Engine instance.
Open the terminal and enter the ssh command to connect to the Google Compute Instance:
gcloud compute ssh logistics_dev_01 --zone us-west1-bUpdate the packages. In the SSH terminal, enter the following command:
sudo apt-get updateInstall PostgreSQL, including the PSQL client and server instrumentation:
sudo apt-get -y install postgresql postgresql-client postgresql-contrib
Use PSQL to complete the setup
PostgreSQL created a default user, named “postgres”, during installation. This user doesn’t yet have a password, so you’ll need to set one.
In your SSH terminal, run the root shell:
sudo -s2.Run PSQL as user postgres, instead of root, accessing the database named postgres:
sudo -u postgres psql postgres
Enter the following command to set the password:
\password postgresPassphrase: see KeePass.
When prompted, enter and confirm the password you’ve chosen.
Important: For any system with an Internet connection, use a strong password to help keep the system secure.
Install the admin pack extension to enable the server instrumentation that you installed earlier. The console prints CREATE EXTENSION when successful:
CREATE EXTENSION adminpack;Enter q to exit PSQL.
\qEnter exit to exit the root shell.
exit
Settings
Configure PostgreSQL to accept connections from outside the VM
Change to the settings directory of PostgreSQL:
cd /etc/postgresql/15/mainConfigure
postgresql.confto listen on external interfaces:sudo nano postgresql.confSet
listen_addressesto ‘*’: By default,listen_addressesis usually set tolocalhost, meaning PostgreSQL only listens for connections on the localhost (127.0.0.1). To allow connections from external hosts, change this parameter to'*', which tells PostgreSQL to listen on all available network interfaces.# To allow connections from external hosts, # which tells PostgreSQL to listen on all available network interfaces. listen_addresses = '*'Allow External Connections
sudo nano pg_hba.confAdd a line to allow connections from external hosts using password authentication (
password).# allow connections to all databases from all IP addresses without password authentication # customized modification host all all 0.0.0.0/0 passwordConfigure accounts
Set passwords to all odoo users, as to use passwords during the login to PostgreSQL, is used by the program
TablePlus, here for the userodoo:sudo -i passwd odoo exit
macOS¶
Instructions for the installation and configuration of the PostgreSQL Database on macOS Operating System. This system is used for Development of the odoo System and Python Modules.
Installation
brew install postgresqlStart by launchd
To have launchd start postgresql now and restart at login:
brew services start postgresqlStop by launchd
To stop postgresql:
brew services stop postgresql
Error Message: „psql: error: connection to server on socket “/tmp/.s.PGSQL.5432” failed: FATAL: database “Friedrich” does not exist“
Create the DB “Friedrich”:
createdb --owner=Friedrich Friedrich
Raspbian¶
Instructions for the installation and configuration of the PostgreSQL Database on a Raspberry Pi System: Install PostgreSQL on Raspberry Pi. This system is used for testing and deploying purposes.
Installation
sudo apt-get install postgresql postgresql-contrib libpq-dev
Settings: Directories
config: /etc/postgresql/9.4/main
data: /var/lib/postgresql/9.4/main
Settings: Parameter
locale: de_DE.UTF-8
Port: 5432
Error Message: „psql: FATAL: role “pi” does not exist“
Login with User „postgres“ to create user “pi” with psql:
sudo -i -u postgres psql createuser pi ccreatedb --owner=pi pi \q
Start and enable Services of PostgreSQL
Start service PostgreSQL:
systemctl start postgresqlEnable service PostgreSQL:
systemctl enable postgresql