CentOS
#Postgres installation
ref: https://wiki.postgresql.org/wiki/YUM_Installation
ref2: http://karolgalanciak.com/blog/2013/07/19/centos-6-4-server-setup-with-ruby-on-rails-nginx-and-postgresql/
#as root
vim /etc/yum.repos.d/CentOS-Base.repo
#add following line into [base] and [updates] section
exclude=postgresql*
yum localinstall http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-centos94-9.4-1.noarch.rpm
yum install postgresql94-server
To delete postgres:
yum install postgresql94 postgresql94-devel postgresql94-server postgresql94-libs postgresql94-contrib
Installation is complete: next setup
/usr/pgsql-9.4/bin/postgresql94-setup initdb
#service postgresql-9.4 init db - failed
#systemctl initdb postgresql-9.4.service - didnt work
chkconfig postgresql-9.4 on #postgres start on startup
#CONFIG
vi /var/lib/pgsql/9.3/data/pg_hba.conf
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all md5
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
service postgresql-9.4 restart
#db setup
https://wiki.postgresql.org/wiki/First_steps
$>su - postgres
$>psql
psql>alter user postgres with password 'postgres-user-password';
psql>ctrl+d
exit
$> su - newuser #user in rails installation
$> psql postgres -U postgres #postgres password from previous step
psql>create user username with password 'secretPassword'; #username - new db account user
psql>create database testdb owner=username;
To delete postgres:
yum erase postgresql94*
No comments:
Post a Comment