This is quick guide howto install PostgreSQL 8.4 (current stable 8.4.4) database server on CentOS, Fedora and Red Hat. Fedora 12, Fedora 13, CentOS 5.5 and Red Hat (RHEL) 5.5 has PostgreSQL 8.4 database server as default so extra repositories is not needed. Personally, I like to use Postgres own repositories, because the latest version of PostgreSQL may be quickly and easily installed. The following commands run as root and postgres user, so “su -” or “sudo -i” first.
Install PostgreSQL 8.4 Database Server Using PostgreSQL’s repositories
Install PostgreSQL repository:
## CentOS rpm -Uvh http://yum.pgsqlrpms.org/reporpms/8.4/pgdg-centos-8.4-2.noarch.rpm ## Fedora rpm -Uvh http://yum.pgsqlrpms.org/reporpms/8.4/pgdg-fedora-8.4-2.noarch.rpm ## Red Hat rpm -Uvh http://yum.pgsqlrpms.org/reporpms/8.4/pgdg-redhat-8.4-2.noarch.rpm
Install postgresql and postgresql-server packages from PostgreSQL’s repositories:
yum install postgresql postgresql-server postgresql-contribAlternative PostgreSQL 8.4 Install Method for Fedora 12, Fedora 13, CentOS 5.5, Red Hat (RHEL) 5.5
Install postgresql and postgresql-server packages on CentOS 5.5 and Red Hat (RHEL) 5.5:
yum install postgresql84 postgresql84-server postgresql84-contribInstall postgresql and postgresql-server packages on Fedora 12 and Fedora 13:
yum install postgresql postgresql-server postgresql-contribConfigure PostgreSQL 8.4 Database Server
Initialize the cluster first with initdb command:
service postgresql initdb ## OR ## /etc/init.d/postgresql initdb
Edit /var/lib/pgsql/data/postgresql.conf file:
nano -w /var/lib/pgsql/data/postgresql.conf
Set PostgreSQL server to listen all addresses and Change PostgreSQL port (default is 5432). Add/Uncomment/Edit following lines:
listen_addresses = '*' port = 5432
Edit /var/lib/pgsql/data/pg_hba.conf file:
nano -w /var/lib/pgsql/data/pg_hba.conf
Add (example) your local network with md5 passwords:
# Local networks host all all xx.xx.xx.xx/xx md5 # Example host all all 10.20.4.0/24 md5
Start/Restart PostgreSQL Server:
service postgresql start ## OR ## /etc/init.d/postgresql start
Change to postgres user:
su postgresCreate test database (as postgres user):
createdb testLogin test database (as postgres user):
psql testCreate New “testuser” Role with Superuser and Password:
CREATE ROLE testuser WITH SUPERUSER LOGIN PASSWORD 'test';
Open PostgreSQL Port (5432) on Iptables Firewall (as root user again)
Edit /etc/sysconfig/iptables file:
nano -w /etc/sysconfig/iptables
Add following line before COMMIT:
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5432 -j ACCEPT
Restart Iptables Firewall:
service iptables restart ## OR ## /etc/init.d/iptables restart
Test remote connection:
psql -h dbserver -U testuser test
Related posts:
- Install Apache (httpd) and PHP 5.3.3 on Fedora 13, CentOS/RHEL 5.5/6 This guide shows howto install Apache HTTP Server (httpd) with PHP 5.3.3 and following modules: PEAR PDO MySQL PostgreSQL Memcache...
- Install MongoDB 1.6.0 on Fedora 13, CentOS 5.5, Red Hat (RHEL) 5.5 What is MongoDB?MongoDB (from “humongous”) is a scalable, high-performance, open source, schema-free, document-oriented database. Written in C++. MongoDB bridges the...
- Install MySQL 5.1 (5.1.50) on Fedora 13, CentOS 5.5, Red Hat (RHEL) 5.5 MySQL is a relational database management system (RDBMS) that runs as a server providing multi-user access to a number of...
- Install Memcached (Memcache) on CentOS 5.5, Fedora 13, Red Hat (RHEL) 5.5 Memcached is a high-performance, distributed memory object caching system, generic in nature, but originally intended for use in speeding up...
- LAMP on Fedora 13, CentOS/Red Hat (RHEL) 5.5/6 – (Linux, Apache, MySQL, PHP) LAMP (Linux, Apache, MySQL, PHP) server is very powerful server setup behind any website or web based service. This guide...
after editting hba file , I wasn’t able to start postgresql. Then I tried next thing that is iptable , but it says ‘having error in line 13′ which is the line I added before comet as you said.
Don’t know what is wrong , my system is i686 archetecture and I have installed postgresql for that only but still their is problem. I can’t restart or start.
Hi Dhawal,
It is impossible to say any reason without seeing to conf files.
So could you post your /var/lib/pgsql/data/pg_hba.conf file and your /etc/sysconfig/iptables file?
http://yum.pgsqlrpms.org/reporpms/8.4/pgdg-fedora-8.4-1.noarch.rpm
returns 404 error
How to install PostgreSql 8.4 on FC 11 RC ?
Hi Andrus,
Working address is currently:
http://yum.pgsqlrpms.org/reporpms/8.4/pgdg-fedora-8.4-2.noarch.rpm
I updated it to this guide also.
I have not tested this guide with Fedora 11, but I think this should work nicely with Fedora 11 (and even fc10, fc9…), because PostgreSQL 8.4 doesn’t have any dependencies to Fedora 12 or Fedora 13 packages.
Please let me know, if you get it working or if you have any problems?
Thank you.
In Fedora 11 there is no /etc/sysconfig/iptables file mentioned.
How to open 5432 port? How to find router IP address ? Maybe router needs also configured.
Where to find instructions to install latest mono + mod_mono in Fedora 11 ?
yum mod_mono installs old 2.4 version.
Andrus.
In Fedora 11 try add configurations to /etc/iptables.up.rules file.
It is difficult to say anything about network configuration without seeing it.
[root@server /etc]# ls /etc/ipt*
ls: cannot access /etc/ipt*: No such file or directory
There is no to /etc/iptables.up.rules in Fedora 11
Ok, I do not have Fedora 11 now, but then try simple something like following (as root):
Save rules (as root):
CREATE ROLE testuser WITH SUPERUSER LOGIN PASSWORD=’test’;
is incorrect. correct is
CREATE ROLE testuser WITH SUPERUSER LOGIN PASSWORD ‘test’;
Yes you’re right, it’s typo.
I fix it to guide.
Thanks!
Another typo that got me, because I was copy-n-pasting. That should be
listen_addresses = ‘*’
*not*
listen_addressses = ‘*’
Count the S’s
Hi Nick,
Thans for the correction!
Updated guide again… :)
I would like to recommend to also install the contrib libraries (for VACUUMing etc),
since v8.2 it is a separate package (postgresql84-contrib)
yum install postgresql84 postgresql84-server postgresql84-contrib/patrick
Hi Patrick,
Thanks for the tip!
I added it in the guide.