Installing PostgreSQL Client v10 on AWS Amazon Linux (EC2) AMI

前端 未结 11 988
臣服心动
臣服心动 2021-01-30 21:12

I have successfully launched new AWS RDS PostgreSQL v10 instance and need to install PostgreSQL v10 client on Amazon Linux EC2 instance.

I have tried to install

11条回答
  •  执念已碎
    2021-01-30 21:58

    Since none of the previous answers worked for me, I'm adding a solution that let me install the postgresql10 client. We're using VERSION="2018.03" of Amazon Linux AMI in our pipelines.

    Building from source:

    Note: The link below points to postgresql 10.4, you may want to check for newer subversions

    sudo yum install -y gcc readline-devel zlib-devel
    wget https://ftp.postgresql.org/pub/source/v10.4/postgresql-10.4.tar.gz
    tar -xf postgresql-10.4.tar.gz
    cd postgresql-10.4
    ./configure
    make -C src/bin
    sudo make -C src/bin install
    make -C src/include
    sudo make -C src/include install
    make -C src/interfaces
    sudo make -C src/interfaces install
    make -C doc
    sudo make -C doc install
    

    The new package should be installed with all its executables in here: /usr/local/pgsql/bin

    Now, keep in mind that commands psql, pg_dump etc. still point to the old version of the psql client. You can run with the full executable paths (/usr/local/pgsql/bin/psql) or prepend the new directory at the beginning of your $PATH so that the system will look it up first:

    Edit ~/.bash_profile adding this at the end:

    export PATH="/usr/local/pgsql/bin:$PATH"
    

    Then run:

    source ~/.bash_profile
    

    Now everything should be ready:

    [ec2-user@ip-xx-x-x-xxx ~]$ psql --version
    psql (PostgreSQL) 10.4
    

提交回复
热议问题