hello,
As of most operating system comes along with their own package repositories with the stable version of each packages. So that we can easily install it either using apt or yum.
Standard installation of PostgreSQL.
1. # apt-get install postgresql* (Debain/Ubuntu)
2. # yum install postgresql* ( RHEL/Fedora/Centos)
Here I am listing manual installation steps of latest PostgreSQL from the Postgresql website.
1. Download the latest source code fro, postgreSQL site (http://www.postgresql.org/ftp/source/)
#wget http://wwwmaster.postgresql.org/download/mirrors-ftp/source/v8.4.1/postgresql-8.4.1.tar.gz
2. tar -zxvf postgresql-8.4.1.tar.gz
./configure
gmake
gmake install
adduser postgres
mkdir /usr/local/pgsql/data
chown postgres /usr/local/pgsql/data
su – postgres
/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
/usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data >logfile 2>&1 &
/usr/local/pgsql/bin/createdb test
/usr/local/pgsql/bin/psql test
installing as service
1. go to /installation/startup-scripts
2. copy linux file to /etc/init.d/postgresql
3. chmod 755 /etc/init.d/postgresql
4, chkconfig –add postgresql
5, chkconfig postgresql on
6. #service postgresql start
Set /usr/local/pgsql/bin in system PATH
7. #PATH=$PATH:/usr/local/pgsql/bin;export PATH
We can’t execute or adminsitrate any command initialy even we have root access to the server. We need to add the the user ‘root’ as a super user in posgressql. For doing this,
#su – postgres
#create user root : Will ask for the role given, Just press yes to execute. Now you can administrate the posgresql from system root console.
8. Creating new database using #createdb
9. Create user using #createuser
10. Listing Databases #psql -l
#####################################
How to create access privileges to other hosts in the network.
Posgresql initially will not permitt any host to access the server remotely.For enabling remote access, we need to modify the certain settings on config. file. A. editing on /etc/postgressql.conf. B. pg_hba.conf
1. edit postgresql.conf which should be look like this
# – Connection Settings -
listen_addresses ='*' # what IP address(es) to listen on;
# comma-separated list of addresses;
# defaults to ‘localhost’, ‘*’ = all
port = 5432
2. edit pg_hba.conf should look like this
# TYPE DATABASE USER CIDR-ADDRESS METHOD
# “local” is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
host all all 192.168.0.1 255.255.255.0 trust
# I assume you have 162.0.0.0/24 network
Note that The last line which gives access permission to all of the given network ranges(192.168.0.x)
# service postgresql restart
How to test whether it is working or not ?
Just login to the other desktop on the same network and telnet to the ostgresql port.
# telnet 192.168.20.254 5432 if you got a window open means that it's listening.
Installing PhpPGadmin for posgres
1. Locate and unzip phpPgAdmin-4.0.1.tar.gz file to Apache web directory
2. Edit the file phpPgAdmin-4.0.1/conf/config.inc.php. find the entry and find the entry on the file and make the true to false
extra_login_security = true to false
which should look like this
$conf['$conf['extra_login_security'] = false;'] = false;
-Njoy