Simple question, but no resources found about this. Is there any way to install only a PostgreSQL client, the terminal-based one, psql
, on a CentOS7 system, without installing the complete PostgreSQL server? There is no dedicated postgresql-client
or postgresql94-client
or anything similar on the repositories.
- A full postgres install comes down to 26 Mb on my system. If the daemon is not started, there is no reason why it would hurt to hgave some extra files around. Is there a particular reason why you do want to spare some extra megabytes?– joepdCommentedDec 15, 2015 at 13:50
- 1I didn't notice the comment early enough, sorry. Well, not really (except having the need to disable the daemon). Just call it OCD, I don't like surplus software laying around.– Aleksandar StojadinovicCommentedApr 12, 2016 at 7:56
5 Answers
I think the naming convention might simply be backwards from what you expect there: there's a package
postgresql-server The programs needed to create and run a PostgreSQL server
and a package
postgresql PostgreSQL client programs
(and postgresql
does not have a dependency on postgresql-server
, at least not in CentOS 6, though they both depend on a common postgresql-libs
package).
- 4On 64-bit red hat it will be
postgresql.x86_64
. The command to figure this out is login as root and runyum list | grep postgresql
.– arunCommentedSep 14, 2016 at 19:24 - @arun: yes. (Once the OS is installed, you will automatically get the version matching your architecture, unless you explicitly ask for the
.i686
or.x86_64
)CommentedSep 15, 2016 at 17:46 - Same on Amazon linux. you can tell its correct because the server one uses it as a dependency.CommentedNov 16, 2021 at 21:24
In order to get the postgresql client in red hat or centos on ec2 instance, you have to install theses two pacakges: yum install -y postgresql-libs-9.2.24-1.amzn2.0.1.x86_64 postgresql-9.2.24-1.amzn2.0.1.x86_64
If these versions don't exist use this command to work out which versions you have:
yum list | grep postgres
And then issue the command with the two libraries you have access to, eg:
yum install -y postgresql96-libs.x86_64 postgresql96.x86_64
On CentOS 8 you can do the following to install the client:
dnf install postgresql
And if you need a server:
dnf install postgresql-server
There should be a posgresql client sub-group , you can use
sudo yum install @postgresql:VERSION/client
Where the VERSION is the version identifier of postgres:
e.g. sudo yum install @postgresql:15/client
Yes, you can install only the PostgreSQL client, psql, on a CentOS 7 system without installing the full PostgreSQL server; however, there is no dedicated package named postgresql-client in the default repository; to install psql, you can use the package called postgresql, which includes both the server and the client component, but you can specify to install only the client aspect using the following:
sudo yum install postgresql
After you have installed the postgresql package, to access psql , simply type:
psql
This command will start the PostgreSQL client, which would allow an operator to connect with PostgreSQL databases through the command line.
If you're interested in more detailed instructions on installing PostgreSQL on Linux, including CentOS, you can refer to the following resource: How to Install PostgreSQL on Linux.
I hope this helps!