3. Before you install
3.1 How version numbers work
Section titled “3.1 How version numbers work”Definition: A PostgreSQL version has two parts: major.minor. In 18.7, the major version is 18
and the minor version is 7.
- Minor upgrade (18.6 to 18.7): stop the server, install the new programs, start it again. Your data files do not change.
- Major upgrade (17 to 18): the data files change format. You need
pg_upgradeor a dump and restore. That is a later module. - Before version 10 the major version had two numbers (
9.6) and the minor was third (9.6.24). If you see an old server running9.6.x, its major version is9.6.
Each major version is supported for five years. After that it gets no more fixes.
| Version | First release | Supported until |
|---|---|---|
| 19 | November 19, 2026 | November 2031 |
| 18 (this course) | September 25, 2025 | November 2030 |
| 17 | September 26, 2024 | November 2029 |
| 16 | September 14, 2023 | November 2028 |
| 15 | October 13, 2022 | November 2027 |
| 14 | September 30, 2021 | Ended November 12, 2026 |
3.2 Ways to install PostgreSQL
Section titled “3.2 Ways to install PostgreSQL”| Method | What it is | Version you get | Used for |
|---|---|---|---|
| PGDG repository | Packages from the PostgreSQL project itself | Every supported version, latest minor | Most company Linux servers. This course. |
| OS AppStream | Packages from the Linux vendor | What the vendor ships (18.1 on Stream 9 today) | Simple servers that follow the OS vendor |
| Source code | Compile it yourself | Any | Developers, special builds |
| Container (Docker) | A ready-made image | Any | Testing, development |
| Managed cloud (Amazon RDS, Azure, Google) | The cloud runs it for you | What the provider offers | Companies that do not want to manage servers |
We use PGDG (PostgreSQL Global Development Group) because it gives the latest minor release,
lets one server hold several major versions side by side, and uses the folder layout you will see
at work: /usr/pgsql-18 for programs and /var/lib/pgsql/18/data for data.
3.3 Prerequisites
Section titled “3.3 Prerequisites”| Item | What you need | Why |
|---|---|---|
| Operating system | CentOS Stream 9, 64-bit | The commands in this handout are tested on it |
| Memory | 1 GB or more | PostgreSQL starts small (about 35 MB on the test server). The rest is for Linux and your queries |
| Disk | A few GB free under /var/lib/pgsql |
The data, the WAL and the logs live there |
| Admin rights | You can run sudo |
Installing software changes the whole server |
| Port | 5432 free | The PostgreSQL default port |
| Internet | The server can reach download.postgresql.org |
To download the packages |
Two tools from Linux Foundations, Class 8: sudo and su
sudoruns one command as the administrator (root). On Windows this is "Run as administrator".sudo su - postgresswitches your whole session to the postgres user until you typeexit. The install creates this user. PostgreSQL runs as postgres, never as root.
Was this page helpful?
Thanks. Glad it helped.
Thanks for telling us. Email the instructor what was missing, or ask in class.