I have an Amazon EC2 instance based on Amazon Linux AMI 2014.03. I installed PostresSQL from their repos:
yum install postgresql-libs postgresql postgresql-server postgresql-devel
I've read about Amazon's unexpected upgrade from 9.1 to 9.2, so I added this line to the end of
/etc/yum.conf so hopefully I can control any upgrades:
So far so good. Now I'm setting up continuous archiving and I want to run
pg_archivecleanup. However I can't find the
postgresql-contrib package on the Amazon distro, and it's not listed in the packages:
Is there someplace else to get that pre-compiled? I tried the following to compile it myself:
sudo su -
tar -xzf postgresql-9.2.7.tar.gz
./configure --without-readline # fails until you add --without-readline
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard pg_archivecleanup.o -L../../src/port -Wl,--as-needed -Wl,-rpath,'/usr/local/pgsql/lib',--enable-new-dtags -lpgport -lz -lcrypt -ldl -lm -o pg_archivecleanup
/usr/bin/ld: cannot find -lpgport
collect2: error: ld returned 1 exit status
gmake: *** [pg_archivecleanup] Error 1
What is my best option?
- Find another source for the contrib package - where?
- Find a way to compile this module - how?
- Ditch Amazon Linux and start from scratch with an Ubuntu AMI.
pg_archivecleanupand write a script to delete old WAL files.
I'm using Elastic Beanstalk with some pretty tight integration to the Amazon AMI. I'm sure it could be made to work with another AMI, but I expect there would be other gotchas. What about this option, adapted from this post:
# Change to home directory to download the software cd ~/ # Get the right postgresql package (Redhat 64 Bit) wget http://yum.postgresql.org/9.2/redhat/rhel-6-x86_64/pgdg-redhat92-9.2-7.noarch.rpm # Install the package sudo rpm -ivh pgdg-redhat92-9.2-7.noarch.rpm sudo yum install postgresql92-contrib
Does that give me the best of both worlds, an Amazon AMI with an official Postgres repo? If necessary, I could completely re-install Postgres from that RHEL repo.