แสดงบทความที่มีป้ายกำกับ PostgreSQL11 แสดงบทความทั้งหมด
แสดงบทความที่มีป้ายกำกับ PostgreSQL11 แสดงบทความทั้งหมด

วันศุกร์ที่ 12 เมษายน พ.ศ. 2562

Install PostgreSQL 11 on Ubuntu 18.04

การติดตั้ง PostgreSQL 11


*ถ้าไม่ต้องการติดตั้ง Version 11 จะลงตาม Version ที่มากับ Repository Linux ให้ข้ามไปตรง #Install PostgreSQL ได้เลยครับ

Official: PostgreSQL Installation
Reference: Install PostgreSQL, Install pgAdmin4, Getting Started
bash/shell
1
2
3
# Install PostgreSQL
sudo apt update
sudo apt install wget gnupg2

Create the file /etc/apt/sources.list.d/pgdg.list and add repository
/etc/apt/sources.list.d/pgdg.list
1
deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main
bash/shell
1
2
3
4
5
6
7
8
9
# Import repository signing key, then update package lists
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt update
 
# Install PostgreSQL, ถ้าไม่ทำตามขั้นตอนข้างบนจะติดตั้งตาม Version ที่มากับ Repository ของ Linux
sudo apt install postgresql postgresql-contrib
 
# Check PostgreSQL Status
sudo systemctl status postgresql

ทำการทดสอบโดยใช้ user postgres
bash/shell
1
2
3
# Connect to PostgreSQL
sudo su - postgres
psql
postgres-#
1
2
3
4
5
6
7
8
9
10
11
-- Show your connection information
 
\connifo
-- You are connected to database "postgres" as user "postgres"
-- via socket in "/var/run/postgresql" at port "5432".
 
-- Show help
\?
 
-- Quit
\q