Install and configure Posgresql 9.3 in Linux ( Centos ) within VMWare – part II

After postgresql installer has executable access, then we can run it as an installer

Choose installation directory

Choose data directory ( Cluster )

Setup password for root, in this case root/ super user is a super user for database not in OS

Choose port where to listen

select locale

installation processing

just uncheck the stackbuilder installer, we don’t need it at this time. It will be usefull when we need additional tools/ services from Postgresql

Once the installation done, the next step is configuration and make an example to verify that our database has been installed as well. To make operation lighter, i’ll access the Linux(Centos)
through sshclient.

Terminal is on, start configuration

/*Go to installed PostgreSQL directory*/
[root@localhost /]# cd /opt/PostgreSQL/9.3/

/*open configuration file for Postgresql within pg_env.sh using VI editor*/
[root@localhost 9.3]# vi pg_env.sh 

/*copy the all lines that contain export command to setup environment variables*/
#!/bin/sh
# The script sets environment variables helpful for PostgreSQL

export PATH=/opt/PostgreSQL/9.3/bin:$PATH
export PGDATA=/opt/PostgreSQL/9.3/data
export PGDATABASE=postgres
export PGUSER=postgres
export PGPORT=5432
export PGLOCALEDIR=/opt/PostgreSQL/9.3/share/locale
export MANPATH=$MANPATH:/opt/PostgreSQL/9.3/share/man

/*Login as postgres user*/
[root@localhost 9.3]# su - postgres 
Last login: Sat Nov  8 09:45:22 EST 2014 on pts/1
-bash-4.2$ 

/*Open file ~/.bash_profile
paste the command that we've copied before, and this will be environment variables for postgresql within OS/*

[ -f /etc/profile ] && source /etc/profile

export PATH=/opt/PostgreSQL/9.3/bin:$PATH
export PGDATA=/opt/PostgreSQL/9.3/data
export PGDATABASE=postgres
export PGUSER=postgres
export PGPORT=5432
export PGLOCALEDIR=/opt/PostgreSQL/9.3/share/locale
export MANPATH=$MANPATH:/opt/PostgreSQL/9.3/share/man

/*save and logout from the postgres user session
then login again as postgres user/*

[root@localhost 9.3]# su - postgres 

/*let's try to connect to postgresql
-bash-4.2$ psql
Password: 
psql.bin (9.3.5)
Type "help" for help.

postgres=# 
/*postgresql connected already*/

/*show all database using meta data command*/

postgres=# \l
                                  List of databases
   Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges   
-----------+----------+----------+-------------+-------------+-----------------------
 postgres  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 template0 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
 template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
(3 rows)

Tagged: , , , , , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: