티스토리 뷰

출처 : http://www.toyos.nl/2010/09/21/install-postgresql-9-0-on-centos-5-5/

 

 Today PostgreSQL 9.0 was released, so it’s testing time. Here is a little howto on installing it on a CentOS 5.5 machine.


First do a minimal CentOS 5.5 install.

Read this.

Exclude postgres from the base and updates repos:

vi /etc/yum.repos.d/CentOS-Base.repo

And add:

exclude=postgresql*

to the bottom of both sections.

Get the following RPM and install it:

wget http://yum.pgrpms.org/reporpms/9.0/pgdg-centos-9.0-2.noarch.rpm
rpm -Uvh pgdg-centos-9.0-2.noarch.rpm

Update:

yum update
yum upgrade

Install pgsql and -server itself:

yum install postgresql90 postgresql90-server

Add some sysconfig:

cat > /etc/sysconfig/pgsql/postgresql <<EOF
PGDATA=/var/lib/pgsql/9.0/data
PGPORT=5432
PGLOG=/var/lib/pgsql/9.0/pgstartup.log
PGOPTS=
EOF

Now initialize your db (which also creates some default config files)

service postgresql-9.0 initdb

If you want to let pgsql listen on an ethernet interface (besides lo), edit /var/lib/pgsql/9.0/data/postgresql.conf and add the following lines:

listen_addresses = 'localhost,172.31.0.16'
port = 5432

Also give access to some users to some db’s in your /var/lib/pgsql/9.0/data/pg_hba.conf:

cat >> /var/lib/pgsql/9.0/data/pg_hba.conf <<EOF
 
host all all 127.0.0.1/32 md5
host all all 172.31.0.0/24 md5
EOF

(Of course ‘all all’ is probably too open, it’s only as example for my internal test machine!)

If you want to let pgsql start at boot, enter:

chkconfig postgresql-9.0 on

This time start it manually:

service postgresql-9.0 start

Set a password for your postgres user:

su - postgres
psql
ALTER USER postgres WITH PASSWORD 'topsecret';
\q

And you’re done !

댓글
댓글쓰기 폼