I needed to install postgresql for tiny tiny rss an online rss application I recently found. And I was having problems with the application not connecting to the db after following these instructions.
I scoured the Internet and pieced together what needed to be done.
Step 1. Install Postgresql
My server runs Fedora core 2 so I ran this fro mt he command line:
yum -y install postgresql postgresql-server php-pgsql
Step 2 . Configure Postgresql
From the command line:
$ vi /var/lib/pgsql/data/postgresql.conf
- change tcpip_socket = true
$ vi /var/lib/pgsql/data/pg_hba.conf
- add:local all all trust
host all all 127.0.0.1 255.255.255.255 trust
host all all 0.0.0.0 255.255.255.255 reject
Or through a text editor just edit these files:
open /var/lib/pgsql/data/postgresql.conf
and change tcpip_socket = true (make sure to uncomment the line)
open /var/lib/pgsql/data/pg_hba.conf
and add these 3 lines to the bottom, no need to edit anything else.
local all all trust
host all all 127.0.0.1 255.255.255.255 trust
host all all 0.0.0.0 255.255.255.255 reject
Step 3. Restart Postgresql
I use
service postgresql restart
you can replace restart with start.
Step 4. Create a DB
from the command line:
su - postgres
createdb db_name
Step 5. Create a postgresql username and password for the newly created DB
createuser -P -U postgres db_username
This command will initiate an user creation script.
Enter password for user "db_username":
Enter it again:
Shall the new user be allowed to create databases? (y/n) y
Shall the new user be allowed to create more new users? (y/n) y
CREATE USER
The CREATE USER statement indicates that the command was successful.
Step 6. Restart Postgresql again
Step 7. Test your connection
from root:
psql -U web_user web_database
Step 8. It’s all up to you. I installed phpPgAdmin






I'm a
Thanks for the advice. For an Oracle DBA this really helped me in comming up to speed on Postgres administration.
thanks a lot.
i have loaded postgres on mandrake 10.1. get the following error on starting my application. qpsql7 driver not loaded.. connection refused…
regards manish…
Hello!
I’m new on such issue” Postgresql” But since I started dealing with it I am looking for information in order to improve my knowledge on it. Reading in this homepage I saw one howto install for Fedora. I use Debina 3.1 at the present and I have tried to update Postgresql 7.0 to 8-1.3, but it simply does not match. Is there anything I can do to update it?
Waiting for some kind of help, I thank very much in advance.
Stark - from Brasil
thanks but with example and commands
Hello!
My Postgres difficulties go on. I simply haven’t been able to make it run .
Even trying to run the one 7.0 native on Debian 3.1 I have had problems to get it running.
I simply need to know what mistkes have I been done. For insttance I ‘ve done as follow: ]#su posgres
then it becommes: postgres@mymcahine/home/user],
so, I try psql -l , but nothing else happen. Among my lots of researches performed, I have already
got: vi /postgres/postgres.conf and altered a lot of # comments and uncommented, and so on, but I have lost time reading for nothing.
Please, in case someone has one hints cues to send me, I thank very much.
Waiting for some messages, I thank in advance.
Stark
Hi,
Thanks for setting this up. It looks like it will be a great help!
I just wanted to comment that for people starting from scratch, you will need to initialize your database before you can configure Postgres.
Step 1a should look something like this:
initdb -E UTF8 /usr/local/pgsql/data
Only after completing this step will your .conf files be created so that you may manipulate them as suggested in step 2.
Best,
Bala
I’m using the postgres 8.1 and found don’t have the tcpip_socket but having other socket like ‘Unix_socket’
So should I add in that line or by default this 8.1 version already enable the the service?
I ran into some issues installing Postgres 8.1.4 on my FC4 machine so made some changes with the assistance of my office mate David Smiley. I hope these are useful to others:
#install postgres
sudo yum -y install postgresql-server
#the install creates a postgres user which may be access via root
#the ‘-’ is important!
sudo su - postgres
initdb -E UTF8
#these steps are only needed if you need remote access to your db
#they should be taylored to you individual needs
#this setup enables all ip addresses password restricted access to your machine
#PGDATA is set to /var/lib/pgsql/data for user postgres
#change listen_addresses to listen to any client host
sed -e “s@#listen_addresses = ‘localhost’@listen_addresses = ‘*’@” $PGDATA/postgresql.conf > /tmp/postgresql.conf
cp !$ $PGDATA/
#edit $PGDATA/pg_hba.conf
echo ‘host all all 0.0.0.0 0.0.0.0 password’ >> $PGDATA/pg_hba.conf
exit
#ensure db runs accross restart
sudo /sbin/chkconfig –level 345 postgresql on
sudo /sbin/service postgresql start
#create your db, change db/user name as appropriate
sudo su - postgres
createdb db_name
createuser -P -U postgres db_username
exit
sudo /sbin/service postgresql restart
I’m unable to get Postgres to start on reboot on Fedora C5; it does start manually, however, after I log in (as root). The start script is in rc5.d (based on start script included in the distribution). Any ideas?
>I’m using the postgres 8.1 and found don’t have the tcpip_socket but having other socket like ‘Unix_socket’
>So should I add in that line or by default this 8.1 version already enable the the service?
In 8.1 version you have to set the listen_addresses variable to permit remote connections
good work
Thank you, Bala Iyer, for your FC4 notes. That made everything happy on my system.
Thank you, was looking for this info all day…
Thank you, thank you. Do you think I could get Sql Legder going. Your info helped me. Great stuff. You could be a PVP (Postgres Valued Professional ;o)
hello
how can i install postgresql in Fedora core 7 from Fedora core 7 DVD
how i m instaal postgre sq; in my computer
im using fedora operatin system i have 3 user account
one of them is root please send me set of command fo above pupose and what are difference in pl/sql and postgre sql
HAI I DOWNLOADED FROM INTERNET FEDORALINUX-8 AND INSTALLED IN OUR SERVER BUT IN THIS FEDORA-8 POSTGRESQL NOTWORKING.
SO PLS GIVE SOME INFORMATION ABOUT POSTGRESQL
HOW TO CONFIGIRE POSTGRESQL IN FEDORA-8
BYE
TATAYYA NAIDU.CH
Thanks. The post was useful to me.
I also had to do:
passwd postgres
because I had messed up something during all my frustration trying to get pgadmin to do something/anything.
The createuser routine asked only
“Shall the new role be a superuser? (y/n)”
and concluded with
CREATE ROLE
–
this is on Fedora 7
Thank you, Bala Iyer, for your FC4 notes. That made everything happy on my system.
Hi I am trying to start postgresql but unable to start it either root user or postgres user. Kindly suggest
[root@localhost(OASIS) init.d]# ./postgresql restart
Stopping postgresql service: [FAILED]
Starting postgresql service: [FAILED]
[root@localhost(OASIS) data]# service postgresql restart
Stopping postgresql service: [FAILED]
Starting postgresql service: [FAILED]
ok thanks for your tips. i also enjoy the wordpress-stuff. the themes are great. keep workin
greets from germany
I noticed you forgot a step in your installation.
Before your second step you must initialise the database otherwise you could not access to /var/lib/pgsql/data/postgresql.conf
For initailise the database:
service postgresql initdb
After that all is OK.
But thanks for your tutorial, it’s well done.