title: Install and use PostgreSQL 9.3 on Amazon EC2
body: <p>I'm having a problem with an Amazon Linux (CentOs based) instance when trying to install the latest stable Postgres (version 9.3).</p>
  
  <p>That version doesn't ships in the main repositories of that distro and I tried some of the RPM's that are available in the <a href="http://yum.postgresql.org/repopackages.php#pg93" rel="nofollow">Postgres download site</a>. CentOs and Fedora versions didn't worked, since they complained about the distro I'm using not to be the one they're made to. The Red Hat .rpm worked well and I could see the new packages available to yum. </p>
  
  <p>I used the following:</p>
  
  <pre><code>wget http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-redhat93-9.3-1.noarch.rpm
  rpm -Uvh pgdg-redhat93-9.3-1.noarch.rpm
  </code></pre>
  
  <p>So, I installed the Postgres packages of the version I'm interested in:</p>
  
  <pre><code>yum install postgresql93 postgresql93-devel postgresql93-server
  </code></pre>
  
  <p>So far, so good. Everything installed beatifully (just a php package conflicted, but I blew it up).</p>
  
  <p>As said in every blog and help page, I initialized the database. For me, there is a need to change the PORT, so I did it in <code>/etc/init.d/postgresql-9.3</code> script, changing the port to 5552, that is available in this box. To initialize and start the server, nothing new:</p>
  
  <pre><code>service postgresql-9.3 initdb 
  service postgresql-9.3 start
  </code></pre>
  
  <p>(the name of the service has the version, differently from the service installed from the mainstream amazon repositories)</p>
  
  <p>It just works. I have no sign of problem until I tried to connect using <code>psql</code> utility:</p>
  
  <pre><code>[root@local]# su - postgres
  -bash-4.1$ psql 
  psql: FATAL:  role "postgres" does not exist
  </code></pre>
  
  <p>As usual, I also can't do it with root, but with the user "postgres" it seems reasonable that the role at least should have been created. </p>
  
  <p>I can't use <code>createdb</code> for the same strange reason. I've been receiving the same error for any operation I try in the bin folder that could interact with the database. For that, Im stuck with a "working" database but no user able to connect to it. </p>
  
  <p>When searching around the tips I could find are always related to a user trying to connect using the <strong>root</strong> user and the solution is to use <strong>postgres</strong> user and I'm doing it, as you saw.</p>
  
  <p>This is a problem that just happened when trying the version 9.3. When I tried the repository package (that is still 9.2) it worked just fine. I could connect and test the database normally.</p>
  
  <p>Before this package I tried to compile Postgres from source, but the hell of dependencies just didn't let me go.</p>
  
  <p>Is there any other adjust I might be missing, some package that is needed or even a guess you could share to help me solve this issue? </p>