pg_config: command not found

Have You tried accessing the binary with the full path?

Maybe Your $PATH variable doesn't contain the default paths? echo $PATH should give something like:

[root@server ~]# echo $PATH
/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

If it's empty, You may set the PATH variable with this command

export PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin"

On CentOS possible default full paths are:

/usr/bin/pg_config - from package: postgresql-devel

You may install the required package with command yum install {package}

On Debian possible default full paths are:

/usr/bin/pg_config - from package: libpq-dev
/usr/bin/pg_config - from package: postgresql-common
/usr/lib/postgresql/9.4/bin/pg_config - from package: postgresql-server-dev-9.4

You may install the required package with command apt-get install {package}
Error in other languages:
pg_config: bevel nie gevind nie
pg_config: comandă negăsită
pg_config: comando não encontrado
pg_config: commande introuvable
pg_config: command not found
pg_config: käsku ei ole
pg_config: không tìm thấy lệnh
pg_config: komanda nerasta
pg_config: Kommando nicht gefunden.
pg_config: kommandot finns inte
pg_config: komut yok
pg_config: nie znaleziono polecenia
pg_config: níor aimsíodh an t-ordú
pg_config: no se encontró la orden
pg_config: no s'ha trobat l'ordre
pg_config: opdracht niet gevonden
pg_config: parancs nem található
pg_config: perintah tidak ditemukan
pg_config: príkaz nenájdený
pg_config: příkaz nenalezen
pg_config: команда не найдена
pg_config: командата не е открита
pg_config: 命令找不到
pg_config: コマンドが見つかりません