「PostgreSQL」- 安装部署(Ubuntu,CentOS)

on Ubuntu 20.04 LTS

https://www.postgresql.org/download/linux/ubuntu/

# Create the file repository configuration:
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'

# Import the repository signing key:
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

# Update the package lists:
sudo apt-get update

# Install the latest version of PostgreSQL.
# If you want a specific version, use 'postgresql-12' or similar instead of 'postgresql':
sudo apt-get -y install postgresql
sudo apt-get -y install postgresql-14                                           # 安装 PostgreSQL 14 版本

PostgreSQL 10 On CentOS 7.x

yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
yum install -y postgresql10-server

/usr/pgsql-10/bin/postgresql-10-setup initdb

systemctl enable postgresql-10
systemctl start postgresql-10

PostgreSQL 9.2.24 on CentOS 7.5

# 安装
yum install postgresql-server

# 初始化
postgresql-setup initdb

# 启动服务
systemctl start postgresql

参考文献

Linux downloads (Red Hat family)