Setting up PostgreSQL on Red Hat Enterprise Linux
March 5th, 2009 by Anthony Curreri
As a regular user, or as root if you leave off the sudo bits:
sudo yum -y install postgresql postgresql-server php-pgsql
sudo /sbin/chkconfig postgresql on
sudo /sbin/service postgresql start
This is setting up the postgres user. Enter a password you’ll remember when prompted.
sudo passwd postgres
After this command, enter that password again. Now you’ll be logged in as the new postgres user.
su – postgres
psql
create user gpsdata;
create database gpsdata owner gpsdata;
control+d
The following makes it possible to access the database from another computer.
vi /var/lib/pgsql/data/postgresql.conf
add the line:
listen_addresses=’*’vi /var/lib/pgsql/data/pg_hba.conf
add the line:
host all all 192.168.3.0/24 trustcontrol+d
sudo /etc/init.d/postgresql restart
Now you’ve just got to open port 5432 on your firewall.
sudo vi /etc/sysconfig/iptables
add the line:
-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 5432 -j ACCEPTsudo /etc/init.d/iptables restart
If you found this helpful, help me by checking out the ads on the right. Thank you!
Link to this post! Copy and paste this code into your blog or website:
