Installation
PostgreSQL Installation System Requirements
-
64-bit architecture (x86_64 or ARM64)
-
Minimum 1GB RAM (4GB+ recommended for production)
-
512MB+ free disk space for installation
8 Supported operating systems: Ubuntu 20.04+, RHEL/CentOS 8+, Windows 10+, macOS 10.15+
Installation Methods Ubuntu/Debian Installation
bash
# Install PostgreSQL from official repository
sudo apt-get update
sudo apt-get install wget ca-certificates
# Add PostgreSQL official APT repository
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
# Update package list
sudo apt-get update
# Install PostgreSQL 17
sudo apt-get install postgresql-17 postgresql-client-17 postgresql-contrib-17
# Start and enable service
sudo systemctl start postgresql
sudo systemctl enable postgresql
RHEL/CentOS Installation
bash
# Install PostgreSQL repository
sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
# Install PostgreSQL 17
sudo yum install -y postgresql17-server postgresql17-contrib
# Initialize database
sudo /usr/pgsql-17/bin/postgresql-17-setup initdb
# Start and enable service
sudo systemctl start postgresql-17
sudo systemctl enable postgresql-17
Windows Installation
-
Download PostgreSQL 17 installer from official website
-
Run installer with administrative privileges
-
Choose installation directory and components
-
Set superuser password during installation
-
Configure port (default: 5432) and locale settings
Source Installation
bash
# Download and compile from source
wget https://ftp.postgresql.org/pub/source/v17.0/postgresql-17.0.tar.gz
tar -xzf postgresql-17.0.tar.gz
cd postgresql-17.0
# Configure build
./configure --prefix=/usr/local/pgsql --with-openssl --with-libxml --with-libxslt
# Compile and install
make
sudo make install
# Initialize database cluster
sudo /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
Docker Installation
bash
# Pull PostgreSQL 17 image
docker pull postgres:17
# Run PostgreSQL container
docker run -d \
--name postgres17 \
-e POSTGRES_PASSWORD=password \
-e POSTGRES_DB=myapp \
-p 5432:5432 \
-v postgres_data:/var/lib/postgresql/data \
postgres:17