-->

Monday, June 4, 2012

PostgreSQL 9 install for rails on centos

sudo -s
# follow instructions in the next link, to install the needed RPM
http://wiki.postgresql.org/wiki/YUM_Installation
#change the name to the version you need
yum install postgresql9
yum install postgresql9-devel
yum install postgresql9-server

service postgresql initdb
service postgresql start
# start on boot
chkconfig --levels 235 postgresql on

# create user that already exists in the system, and should have a database create rights
sudo -u postgres createuser ec2-user -d


# exit from the sudo to the user that is going to be owner of the db (ec2-user in here)
exit

createdb smifr_prod

login to that db with the current user :

psql -d smifr_prod

you should be in the psql console

\q
to exit


set up access to this user throgh rails , it is acting as a loclhost connection so we need to edit :
edit /var/lib/pgsql9/data/pg_hba.conf using root user and set:
local    all         all                                     trust

host    all         all         127.0.0.1/32          trust
host    all         all         ::1/128               trust


TODO : better security method needed here

sudo service postgresql restart

check in the application folder for db connection :


No comments:

Post a Comment