How to install pgcrypto extension in postgres 10 on CentOS 7
From the docs on CREATE EXTENSION


  PostgreSQL will create the extension using details from the file SHAREDIR/extension/extension_name.control.


You need to check what SHAREDIR is set to with pg_config --sharedir. If that's not set to /usr/share/pgsql/extension then likely your postgresql-contrib was packaged by someone different than your copy of postgresql. These are compile time variables and they should be the same. Moving them in likely won't work either because if these are packaged by two separate entities they're likely built against different libraries.

CentOS

In your case I assume


You're installing the PostgreSQL from the PostgreSQL repos.
You're installing the -contrib from the CentOS repos.


What you probably want to do is install from the CentOS repos. Uninstall all things related to PostgreSQL, and delete those files you copied or linked and run this

# Adds the PostgreSQL repo
rpm -Uvh https://yum.postgresql.org/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm

# I think this should install them explicitly from the PostgreSQL repo
rpm -Uvh https://yum.postgresql.org/10/redhat/rhel-7-x86_64/postgresql10-10.1-1PGDG.rhel7.x86_64.rpm
rpm -Uvh https://yum.postgresql.org/10/redhat/rhel-7-x86_64/postgresql10-contrib-10.1-1PGDG.rhel7.x86_64.rpm