title: Bash Script to install PostgreSQL - Not working
body: <p>I have a script which runs when my debian 6.0 server is deployed and it is designed to build postgreSQL from source, create a system user for it, create a database and start it running. I am new to this but I did a lot of homework and this is what I came up with:</p>
  
  <pre><code># Initial
      apt-get update
      apt-get -y install aptitude bzip2 libbz2-dev git-core bison flex
      aptitude -y install sudo python-all-dev python-setuptools libxml2-dev libgeoip-dev libxslt1-dev uuid-dev gcc automake autoconf libpcre3-dev libssl-dev unzip zip python-psycopg2 libpq-dev wget make libreadline-dev
      aptitude -y full-upgrade 
  
  
  # POSTGRESQL
  ###############################
  
  # Postgresql Download &amp; Install
      wget http://ftp.postgresql.org/pub/source/v8.4.6/postgresql-8.4.6.tar.gz -P /tmp
      mkdir /tmp/postgresql
      tar xzf /tmp/postgresql-8.4.6.tar.gz -C "/tmp/postgresql"
      cd /tmp/postgresql/postgresql-8.4.6
      ./configure
      make
      make install
  
  # Add User
      useradd postgres
      chown "postgres" /usr/local/pgsql
      mkdir /usr/local/pgsql/data
      chown postgres:postgres /usr/local/pgsql/data
      su - postgres
      /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data/
      /usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data
      /usr/local/pgsql/bin/createdb test
  </code></pre>
  
  <p>Since this is run on deployment its difficult to debug what is going wrong, but I can see that the download and install of postgres seems to work ok. However, what I do know is postgres isnt running on my server. I was wondering for the last part of my code if anyone can see anything I am doing incorrectly which might cause this?</p>