Installing Postgresql 9.6 on AWS - EC2

Franky Doul

I have to install a specific version of Postgresql to my AWS-EC2 instance. I followed the tutorial :Setting up PostgreSQ.

In the past i did as per the tutorial and it worked perfectly fine. This time, since I need the 9.6 version, I twisted a bit :

$ sudo yum install postgresql96 postgresql96-server postgresql96-devel postgresql96-contrib postgresql96-docs

the installation worked fine. I am now trying to resume the setup :

sudo postgresql-setup initdb

and get the following error:

$ sudo postgresql-setup initdb
sudo: postgresql-setup: command not found

i tried the following as well just for the sake of it.

$ sudo postgresql96-setup initdb
sudo: postgresql96-setup: command not found



$ ls -ila /etc/rc.d/init.d
total 264
393352 drwxr-xr-x  2 root root  4096 Nov  5 08:25 .
393347 drwxr-xr-x 10 root root  4096 Aug 26 18:05 ..
393961 -rwxr-xr-x  1 root root  1729 Mar 27  2017 acpid
394280 -rwxr-xr-x  1 root root  2062 Aug 16  2016 atd
394415 -rwxr-xr-x  1 root root  3448 Mar  8  2017 auditd
394323 -r-xr-xr-x  1 root root  1362 Mar 30  2017 blk-availability
394399 lrwxrwxrwx  1 root root    46 Aug 26 18:05 cfn-hup -> /opt/aws/apitools/cfn-init/init/redhat/cfn-hup
393935 -rwxr-xr-x  1 root root  5160 Feb 28  2014 cgconfig
393936 -rwxr-xr-x  1 root root  3580 Feb 28  2014 cgred
394243 -rwxr-xr-x  1 root root  3782 Oct  4  2018 cloud-config
394244 -rwxr-xr-x  1 root root  3763 Oct  4  2018 cloud-final
394245 -rwxr-xr-x  1 root root  3855 Oct  4  2018 cloud-init
394246 -rwxr-xr-x  1 root root  3840 Oct  4  2018 cloud-init-local
394058 -rwxr-xr-x  1 root root  2826 Sep 28  2016 crond
393819 -rw-r--r--  1 root root 25651 Aug 17  2017 functions
393820 -rwxr-xr-x  1 root root  6037 Aug 17  2017 halt
394186 -rwxr-xr-x  1 root root  1395 Dec 13  2017 hibagent
394131 -rwxr-xr-x  1 root root  2267 Nov 12  2018 hibinit-agent
393401 -rwxr-xr-x  1 root root  8563 Sep 27  2013 ip6tables
393402 -rwxr-xr-x  1 root root  8468 Sep 27  2013 iptables
394156 -rwxr-xr-x  1 root root  1955 Oct 29  2018 irqbalance
393821 -rwxr-xr-x  1 root root   652 Jan 18  2017 killall
394324 -r-xr-xr-x  1 root root  2137 Mar 30  2017 lvm2-lvmetad
394325 -r-xr-xr-x  1 root root  2274 Mar 30  2017 lvm2-lvmpolld
394326 -r-xr-xr-x  1 root root  3045 Mar 30  2017 lvm2-monitor
394211 -rwxr-xr-x  1 root root  2904 Sep 18  2014 mdmonitor
394195 -rwxr-xr-x  1 root root  2200 Jul  2 17:59 messagebus
393822 -rwxr-xr-x  1 root root  4334 Jan 18  2017 netconsole
393823 -rwxr-xr-x  1 root root  5309 Jan 18  2017 netfs
393824 -rwxr-xr-x  1 root root  6742 Aug 17  2017 network
394003 -rwxr-xr-x  1 root root  6703 Oct  8  2015 nfs
394074 -rwxr-xr-x  1 root root  3526 Oct  8  2015 nfslock
394152 -rwxr-xr-x  1 root root  1926 May  3  2019 ntpd
393919 -rwxr-xr-x  1 root root  2049 May  3  2019 ntpdate
394548 -rwxr-xr-x  1 root root  7949 Dec  4  2018 postgresql96
394426 -rwxr-xr-x  1 root root  1556 Sep 10  2014 psacct
393778 -rwxr-xr-x  1 root root  2034 Sep 27  2013 quota_nld
393748 -rwxr-xr-x  1 root root  1515 May 17  2016 rdisc
394296 -rwxr-xr-x  1 root root  1816 Aug 17  2017 rngd
393273 -rwxr-xr-x  1 root root  2073 May  9  2018 rpcbind
394082 -rwxr-xr-x  1 root root  2518 Oct  8  2015 rpcgssd
394084 -rwxr-xr-x  1 root root  2305 Oct  8  2015 rpcidmapd
394087 -rwxr-xr-x  1 root root  2464 Oct  8  2015 rpcsvcgssd
393972 -rwxr-xr-x  1 root root  2011 Nov 11  2014 rsyslog
393643 -rwxr-xr-x  1 root root  2056 Sep 10  2014 saslauthd
394014 -rwxr-xr-x  1 root root  3702 Aug 17  2016 sendmail
393825 -rwxr-xr-x  1 root root   647 Jan 18  2017 single
394647 -rwxr-xr-x  1 root root  4180 Oct 23 23:47 sshd
393639 -rwxr-xr-x  1 root root  1642 Mar 19  2014 udev-post
Wiil

Chances are high that Amazon Linux doesn't fit well with PostgreSQL 9.6 or need extra undocumented custom installation steps.

To install a specific version of services like PostgreSQL, the easiest way and probably the new standard is using Docker (and docker-compose).

So, (almost) whatever the Linux distribution you are using:

  • sudo yum install docker then sudo service docker start (The extensive doc for Amazon Linux or other Linux distributions)

  • Then install docker-compose

  • Find an example of a docker-compose.yml file for PostgreSQL, there are many. Just make sure your image parameter is set to image: "postgres:9.6"

  • docker-compose up and you should be all set

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

AWS EC2 Operation timeout after installing SSl

分類Dev

AWSへのPostgresql9.6のインストール-EC2

分類Dev

Amazon ec2 ubuntu installing gcc

分類Dev

AWS Cloud 9上のRailsとPostgresql:ロール「ec2-user」は存在しません

分類Dev

Amazon AWS EC2 GoLang

分類Dev

robomongo aws ec2 ubuntu

分類Dev

CircleCI deployment to AWS EC2

分類Dev

Certbot renewal error - AWS EC2

分類Dev

Spontaneous shutdowns in AWS EC2 instance

分類Dev

Run Elasticsearch on AWS EC2 with Docker

分類Dev

Installing phpMyAdmin onto Amazon EC2 instance

分類Dev

Library failure when installing Libsodium (Amazon EC2)

分類Dev

AWS Amazon Linux(EC2)AMIへのPostgreSQLクライアントv10のインストール

分類Dev

AWS EC2 : upgrade from AMI 1 to AMI 2

分類Dev

Hazelcast AWS ec2自動検出

分類Dev

Troubleshooting ssh login failure for AWS EC2 using powershell

分類Dev

AWS IAM: Allow EC2 instance to stop itself

分類Dev

AWS Application in Private EC2 and HTTP traffic

分類Dev

AWS ec2 - Disk uuid of volume added from a snapshot

分類Dev

Setting up SocketIO server on AWS EC2

分類Dev

AWS EC2, command line display instance type

分類Dev

'Launch More like this' AWS EC2 instance

分類Dev

Securing/Encrypting Database Password on AWS EC2

分類Dev

Twig Template Cache on EC2(AWS Auto Scaling)

分類Dev

aws ec2 run infinite time job remotely

分類Dev

How to install a GUI on Amazon AWS EC2

分類Dev

AWS ec2 instance not open from some ip

分類Dev

Redirect URL for Google API client on AWS ec2 instance?

分類Dev

Crontab failing to run on AWS ec2 Ubuntu Instance