Skip to navigation
Setup Postgres v15 and create a sample user and database for remote access
28.04.23
1. Login as root ```console su root ``` 1. Create the file repository configuration for the latest postgresql ```console sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' ``` 1. Download and import the repository signing key for postgres: ```console wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - ``` 1. Update the package lists: ```console sudo apt-get update ``` 1. Install the latest version of PostgreSQL. If you want a specific version, use 'postgresql-12' or similar instead of 'postgresql': ```console sudo apt-get -y install postgresql ``` 1. Make the postgres accessible from other other servers, adjust the file /etc/postgresql/15/main/at pg_hba.conf ```console local all postgres peer local all all md5 host all all all md5 host all all 127.0.0.1/32 scram-sha-256 host all all ::1/128 scram-sha-256 local replication all peer host replication all 127.0.0.1/32 scram-sha-256 host replication all ::1/128 scram-sha-256 ``` 1. Make the postgres accessible from other other servers as well open the binding port edit /etc/postgresql/11/main/postgresql.conf listen_addresses = '*' 1. Create a Postgres User like dcms ```console su - postgres createuser dcms ```console 1. Create a Postgres User like dcms and a database like bodypiercing2 ```console su - postgres createuser dcms ```console 1. Create a Postgres Database like bodypiercing2 ```console su - postgres createuser dcms -P createdb bodypiercing1 exit ```console 1. Assign the created User to the Database ```console u - postgres psql GRANT ALL PRIVILEGES ON DATABASE dcms TO bodypiercing2; ALTER DATABASE bodypiercing2 OWNER TO dcms; ALTER ROLE shininglight dcms; ```console
https://www.postgresql.org/docs/current/install-procedure.html
Reply
Anonymous
Information Epoch 1742213963
Think parallel.
Home
Notebook
Contact us