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 DBfrom 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
No comments:
Post a Comment