skip to Main Content

I’m trying to run the Apache AGE extension on Ubuntu 22. I have postgres 12.14 installed, and I’ve cloned the AGE repository as instructed in the documentation. However, when I try running the pg_config command, bash says that this command does not exist.

What am I doing wrong?

6

Answers


  1. You should have added postgresql’s bin directory to the $PATH (environment variables) to be accessed directly using pg_config
    otherwise you will need to call it from its original path i.e.
    /usr/local/pgsql/bin/pg_config

    During the installation of AGE you will add that to the PG_CONFIG parameter

    To make sure of your paths to check whether Postgresql’s bin is included or not

    echo $PATH
    

    output should include (may changes based on installation)

    /usr/local/pgsql/bin
    

    You can add your bin path permanently to $PATH variable if it is not added through editing your .bashrc file

    export PATH="/usr/local/pgsql/bin:$PATH"
    
    Login or Signup to reply.
  2. In order to run pg_config you either need to export it via:
    export PATH="/usr/local/pgsql/bin:$PATH"
    Although I suggest going into the .bashrc file and adding the above command directly there because if you don’t do that you would have to export the path everytime you close the session.

    Login or Signup to reply.
  3. I also faced this problem when I switched from Ubuntu 18.04 to 22.04. May be Ubuntu 22.04 system does not come pre-installed with the PostgreSQL development packages, which normally contain the pg_config command. So I tried to Install the PostgreSQL development packages:

    sudo apt install postgresql-server-dev-14
    

    This script will install the development files necessary to create PostgreSQL extensions for PostgreSQL version 12. The pg_config command should work after installing the postgresql-server-dev-14 package, allowing you to choose the best build configurations for your AGE extension.

    Login or Signup to reply.
  4. You may need to export the PATH variable first.

    1. Type the following command in the terminal to open the .bashrc file:
    nano ~/.bashrc
    
    1. Add the path to your bin in the file:
    export PATH="/usr/local/pgsql/bin:$PATH"
    
    1. To apply these changes, run:
    source ~/.bashrc
    

    Confirm this by echo $PATH in the terminal.

    Login or Signup to reply.
  5. The path to pg_config is added to the PATH variable on installation, but if it was not done automatically for some reason, you can add it manually by adding

    export PATH="$PATH:/path/to/postgresql/installation/bin"

    at the end of .bashrc or .bash_profile files and then using source ~/.bashrc

    If you do not know the original path of the pg_config file, you can use the command find . -name pg_config. The pg_config file which we need is directly under the bin directory.

    After exporting you can check it by using which pg_config. This should return the path to the executable file.

    Login or Signup to reply.
  6. export PATH="$PATH:/usr/pg/dist/postgresql-12.14/bin/"
    export LD_LIBRARY_PATH="/usr/pg/dist/postgresql-12.14/lib/"
    

    these commands will help you

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search