Table of Contents
Two Methods of installing PostgreSQL 10
PostgreSQL can be installed by means of two ways
- Installing from source
- Installing binary packages
Each method has its own advantages and disadvantages, however, we will limit this post to learn how to install PostgreSQL using binaries packages.
The most common way of installing the PostgreSQL using binary packages is RPM-based, the list of repositories provided by the community version of PostgreSQL can be found here.
In the last post, we learned how to install PostgreSQL using source code, In this tutorial, we will learn the installation process of PostgreSQL 10 in Linux from the Yum repository.
PostgreSQL 10 Linux Install – Yum Repository Method [step by step]:
I assume that all the prerequisites for installing PostgreSQL have met, I highly recommend to follow this link to learn more about prerequisites.
To use the PostgreSQL Yum Repository, follow these steps:
-
Open the following link to select Linux version.
Choose the following things from the repository list
- Select Version (I choose 10)
- Select Platform (I choose Rhel 6)
- Select Architecture ( I choose x86_64)
-
Install the repository RPM:
1 |
yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-6-x86_64/pgdg-redhat-repo-latest.noarch.rpm |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
[root@postgres02 ~]# yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-6-x86_64/pgdg-redhat-repo-latest.noarch.rpm Loaded plugins: refresh-packagekit, security Setting up Install Process pgdg-redhat-repo-latest.noarch.rpm | 5.5 kB 00:00 Examining /var/tmp/yum-root-iL3EHf/pgdg-redhat-repo-latest.noarch.rpm: pgdg-redhat-repo-42.0-4.noarch Marking /var/tmp/yum-root-iL3EHf/pgdg-redhat-repo-latest.noarch.rpm to be installed Resolving Dependencies --> Running transaction check ---> Package pgdg-redhat-repo.noarch 0:42.0-4 will be installed --> Finished Dependency Resolution Dependencies Resolved ====================================================================================================================================== Package Arch Version Repository Size ====================================================================================================================================== Installing: pgdg-redhat-repo noarch 42.0-4 /pgdg-redhat-repo-latest.noarch 6.8 k Transaction Summary ====================================================================================================================================== Install 1 Package(s) Total size: 6.8 k Installed size: 6.8 k Is this ok [y/N]: Y Downloading Packages: Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : pgdg-redhat-repo-42.0-4.noarch 1/1 Verifying : pgdg-redhat-repo-42.0-4.noarch 1/1 Installed: pgdg-redhat-repo.noarch 0:42.0-4 Complete! |
-
Install the client packages
1 |
yum install postgresql10 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
[root@postgres02 ~]# yum install postgresql10 Loaded plugins: refresh-packagekit, security Setting up Install Process pgdg10 | 3.6 kB 00:00 pgdg10/primary_db | 235 kB 00:12 pgdg11 | 3.7 kB 00:00 pgdg11/primary_db | 186 kB 00:07 pgdg94 | 3.7 kB 00:00 pgdg94/primary_db | 257 kB 00:12 pgdg95 | 3.7 kB 00:00 pgdg95/primary_db | 264 kB 00:09 pgdg96 | 3.7 kB 00:00 pgdg96/primary_db | 255 kB 00:04 Resolving Dependencies --> Running transaction check ---> Package postgresql10.x86_64 0:10.10-1PGDG.rhel6 will be installed --> Processing Dependency: postgresql10-libs(x86-64) = 10.10-1PGDG.rhel6 for package: postgresql10-10.10-1PGDG.rhel6.x86_64 --> Running transaction check ---> Package postgresql10-libs.x86_64 0:10.10-1PGDG.rhel6 will be installed --> Finished Dependency Resolution Dependencies Resolved ====================================================================================================================================== Package Arch Version Repository Size ====================================================================================================================================== Installing: postgresql10 x86_64 10.10-1PGDG.rhel6 pgdg10 1.6 M Installing for dependencies: postgresql10-libs x86_64 10.10-1PGDG.rhel6 pgdg10 327 k Transaction Summary ====================================================================================================================================== Install 2 Package(s) Total download size: 1.9 M Installed size: 9.5 M Is this ok [y/N]: y Downloading Packages: (1/2): postgresql10-10.10-1PGDG.rhel6.x86_64.rpm | 1.6 MB 00:12 (2/2): postgresql10-libs-10.10-1PGDG.rhel6.x86_64.rpm | 327 kB 00:01 -------------------------------------------------------------------------------------------------------------------------------------- Total 131 kB/s | 1.9 MB 00:15 warning: rpmts_HdrFromFdno: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG Importing GPG key 0x442DF0F8: Userid : PostgreSQL RPM Building Project <pgsqlrpms-hackers@pgfoundry.org> Package: pgdg-redhat-repo-42.0-4.noarch (@/pgdg-redhat-repo-latest.noarch) From : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG Is this ok [y/N]: y Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : postgresql10-libs-10.10-1PGDG.rhel6.x86_64 1/2 Installing : postgresql10-10.10-1PGDG.rhel6.x86_64 2/2 Verifying : postgresql10-10.10-1PGDG.rhel6.x86_64 1/2 Verifying : postgresql10-libs-10.10-1PGDG.rhel6.x86_64 2/2 Installed: postgresql10.x86_64 0:10.10-1PGDG.rhel6 Dependency Installed: postgresql10-libs.x86_64 0:10.10-1PGDG.rhel6 Complete! |
-
Install the server packages
1 |
yum install postgresql10-server |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
[root@postgres02 ~]# yum install postgresql10-server Loaded plugins: refresh-packagekit, security Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package postgresql10-server.x86_64 0:10.10-1PGDG.rhel6 will be installed --> Finished Dependency Resolution Dependencies Resolved ====================================================================================================================================== Package Arch Version Repository Size ====================================================================================================================================== Installing: postgresql10-server x86_64 10.10-1PGDG.rhel6 pgdg10 5.1 M Transaction Summary ====================================================================================================================================== Install 1 Package(s) Total download size: 5.1 M Installed size: 18 M Is this ok [y/N]: y Downloading Packages: postgresql10-server-10.10-1PGDG.rhel6.x86_64.rpm | 5.1 MB 00:19 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : postgresql10-server-10.10-1PGDG.rhel6.x86_64 1/1 Verifying : postgresql10-server-10.10-1PGDG.rhel6.x86_64 1/1 Installed: postgresql10-server.x86_64 0:10.10-1PGDG.rhel6 Complete! |
-
Initialize the database and enable automatic start
1 2 3 |
service postgresql-10 initdb chkconfig postgresql-10 on service postgresql-10 start |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
[root@postgres02 ~]# [root@postgres02 ~]# service postgresql-10 initdb Initializing database: [ OK ] [root@postgres02 ~]# [root@postgres02 ~]# [root@postgres02 ~]# chkconfig postgresql-10 on [root@postgres02 ~]# service postgresql-10 start Starting postgresql-10 service: [ OK ] [root@postgres02 ~]# [root@postgres02 ~]# [root@postgres02 ~]# [root@postgres02 ~]# ps -ef | grep postgres postgres 2228 1 0 19:52 ? 00:00:00 /usr/pgsql-10/bin/postmaster -D /var/lib/pgsql/10/data postgres 2230 2228 0 19:52 ? 00:00:00 postgres: logger process postgres 2232 2228 0 19:52 ? 00:00:00 postgres: checkpointer process postgres 2233 2228 0 19:52 ? 00:00:00 postgres: writer process postgres 2234 2228 0 19:52 ? 00:00:00 postgres: wal writer process postgres 2235 2228 0 19:52 ? 00:00:00 postgres: autovacuum launcher process postgres 2236 2228 0 19:52 ? 00:00:00 postgres: stats collector process postgres 2237 2228 0 19:52 ? 00:00:00 postgres: bgworker: logical replication launcher root 2243 2028 0 19:52 pts/0 00:00:00 grep postgres [root@postgres02 ~]# |
-
Confirm PostgreSQL installation
1 2 3 4 5 6 7 8 9 |
[root@postgres02 ~]# su - postgres -bash-4.1$ -bash-4.1$ -bash-4.1$ -bash-4.1$ /usr/pgsql-10/bin/psql psql (10.10) Type "help" for help. postgres=# |
Words from postgreshelp
Thank you for giving your valuable time to read the above information. I hope the content served your purpose in reaching out the blog.
Suggestions for improvement of the blog are highly appreciable. Please contact us for any information/suggestion/feedback.
If you want to be updated with all our articles
please follow us on Facebook | Twitter
Please subscribe to our newsletter.