Postgres Extesions Not Available - CentOS 8

2.1k views Asked by At

I have recently installed PostgreSQL 12 on My CentOS 8 Machine. It seems that there are not Extensions available, and when I try to create one I receive the following error:

[lloyd@localhost postgres]$ PATH=/home/lloyd/opt/GNAT/2019/bin:$PATH
[lloyd@localhost postgres]$ sudo -u postgres psql
[sudo] password for lloyd: 
could not change directory to "/home/lloyd/gnatcoll-db-20.0/postgres": Permission denied
psql (12.4)
Type "help" for help.

postgres=# \dx
                 List of installed extensions
  Name   | Version |   Schema   |         Description          
---------+---------+------------+------------------------------
 plpgsql | 1.0     | pg_catalog | PL/pgSQL procedural language
(1 row)

postgres=# CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
ERROR:  could not open extension control file "/usr/pgsql-12/share/extension/uuid-ossp.control": No such file or directory
postgres=# 

Any help as to why this is happening would be greatly appreciated.

Thanks, Lloyd

1

There are 1 answers

1
Megan On

For anyone else who stumbles across this issue, this is happening because you need to install the contrib package first, before gaining access to the uuid-ossp package.

First, ssh into your server and install postgresql-contrib by running the following:

Note: I had postgres12 installed and as a result installed postgresql12-contrib instead of postgresql-contrib because postgresql-contrib installs what looks like postgresql10-contrib.

sudo dnf install postgresql12-contrib

Be sure that this is the correct version of contrib for your version of postgresql. You can do so by making sure that the output of the install includes something like:

postgresql<your-version>-contrib-X.X-1PGDG.rhel8.x86_64.rpm

Now, you should be able to add your extension!

CREATE EXTENSION IF NOT EXISTS "uuid-ossp";