Setting up a PostgreSQL Database on Ubuntu

sudo apt-get update && sudo apt-get upgrade
sudo apt-get install postgresql
# TYPE  DATABASE        USER            ADDRESS                 METHOD # "local" is for Unix domain socket connections only
local all all peer
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
# TYPE  DATABASE        USER            ADDRESS                 METHOD # "local" is for Unix domain socket connections only
local all all peer
# IPv4 local connections:
host all all 0.0.0.0/0 md5
# IPv6 local connections:
host all all ::1/128 md5
#listen_addresses = 'localhost'
listen_addresses = '*'
sudo /etc/init.d/postgresql restart
sudo - su postgres
psql
CREATE USER ubuntu_user SUPERUSER;
ALTER USER power_user WITH PASSWORD 'password';
CREATE DATABASE mydatabase WITH OWNER power_user;

Related Blog Posts

Setting up a PostgreSQL database on an Ubuntu instance

Related Market Product

Postgres Pro Standard Database 11 (Ubuntu 16)

Related Documentation

Migrate data to AnalyticDB for PostgreSQL by using the Copy command

Related Products

AnalyticDB for PostgreSQL

Reference

https://www.alibabacloud.com/blog/setting-up-a-postgresql-database-on-ubuntu_594910?spm=a2c41.13018659.0.0

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alibaba Cloud

Alibaba Cloud

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com