在AWS上安装Postgresql 9.6-EC2

我必须在Postgresql实例上安装特定版本的AWS-EC2。 我遵循了教程:Setting up PostgreSQ

过去,我按照教程进行操作,效果很好。这次,因为我需要9.6版本,所以我有点扭曲:

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

安装正常。我现在正在尝试恢复设置:

sudo postgresql-setup initdb

,并出现以下错误:

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

为此我也尝试了以下方法。

$ 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
xutuzi 回答:在AWS上安装Postgresql 9.6-EC2

很有可能Amazon Linux不适合PostgreSQL 9.6或需要额外的未记录的自定义安装步骤。

要安装诸如PostgreSQL之类的特定版本的服务,最简单的方法以及可能的新标准是使用Docker(和docker-compose)。

因此,(几乎)您正在使用的任何Linux发行版:

  • sudo yum install docker然后sudo service docker startAmazon Linuxother Linux distributions的广泛文档)

  • 然后安装docker-compose

  • 找到PostgreSQL的docker-compose.yml文件的示例,有很多。只要确保将您的图片参数设置为image: "postgres:9.6"

  • docker-compose up,您应该一切就绪
本文链接:https://www.f2er.com/3162214.html

大家都在问