Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Install And Configure Postgresql-8.3 On Linux

1.Download postgreSQL From Following Link
http://www.postgresql.org/download/
2. Install The Readline-Devel And Libtermcap-Devel Rpm’s:
Becouse You may encounter the error (Ex. configure: error: readline library not found) message while performing ./configure during postgreSQL installation.
# rpm -ivh libtermcap-devel-2.0.8-46.1.i386.rpm readline-devel-5.1-1.1.i386.rpm
warning: libtermcap-devel-2.0.8-46.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing...             ########################################### [100%]
   1:libtermcap-devel    ########################################### [ 50%]
   2:readline-devel      ########################################### [100%] 
3.Install postgreSQL
# tar xvfz postgresql-8.3.7.tar.gz
# cd postgresql-8.3.7
# ./configure
checking for sgmlspl... no
configure: creating ./config.status
config.status: creating GNUmakefile
config.status: creating src/Makefile.global
config.status: creating src/include/pg_config.h
config.status: creating src/interfaces/ecpg/include/ecpg_config.h
config.status: linking ./src/backend/port/tas/dummy.s to src/backend/port/tas.s
config.status: linking ./src/backend/port/dynloader/linux.c to src/backend/port/dynloader.c
config.status: linking ./src/backend/port/sysv_sema.c to src/backend/port/pg_sema.c
config.status: linking ./src/backend/port/sysv_shmem.c to src/backend/port/pg_shmem.c
config.status: linking ./src/backend/port/dynloader/linux.h to src/include/dynloader.h
config.status: linking ./src/include/port/linux.h to src/include/pg_config_os.h
config.status: linking ./src/makefiles/Makefile.linux to src/Makefile.port 
# make
make[3]: Leaving directory `/usr/save/postgresql-8.3.7/contrib/spi'
rm -rf ./testtablespace
mkdir ./testtablespace
make[2]: Leaving directory `/usr/save/postgresql-8.3.7/src/test/regress'
make[1]: Leaving directory `/usr/save/postgresql-8.3.7/src'
make -C config all
make[1]: Entering directory `/usr/save/postgresql-8.3.7/config'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/usr/save/postgresql-8.3.7/config'
All of PostgreSQL successfully made. Ready to install. 
# make install
make -C test/regress install
make[2]: Entering directory `/usr/save/postgresql-8.3.7/src/test/regress'
/bin/sh ../../../config/install-sh -c  pg_regress '/usr/local/pgsql/lib/pgxs/src/test/regress/pg_regress'
make[2]: Leaving directory `/usr/save/postgresql-8.3.7/src/test/regress'
make[1]: Leaving directory `/usr/save/postgresql-8.3.7/src'
make -C config install
make[1]: Entering directory `/usr/save/postgresql-8.3.7/config'
mkdir -p -- /usr/local/pgsql/lib/pgxs/config
/bin/sh ../config/install-sh -c -m 755 ./install-sh '/usr/local/pgsql/lib/pgxs/config/install-sh'
/bin/sh ../config/install-sh -c -m 755 ./mkinstalldirs '/usr/local/pgsql/lib/pgxs/config/mkinstalldirs'
make[1]: Leaving directory `/usr/save/postgresql-8.3.7/config'
PostgreSQL installation complete. 

4.Create the postgreSQL directory structure
After the installation, make sure bin, doc, include, lib, man and share directories are created under the default (/usr/local/pgsql )directory Like Below
# ls -l /usr/local/pgsql/
total 24
drwxr-xr-x 2 root root 4096 Jun  3 18:10 bin
drwxr-xr-x 3 root root 4096 Jun  3 18:10 doc
drwxr-xr-x 6 root root 4096 Jun  3 18:10 include
drwxr-xr-x 3 root root 4096 Jun  3 18:10 lib
drwxr-xr-x 4 root root 4096 Jun  3 18:10 man
drwxr-xr-x 5 root root 4096 Jun  3 18:10 share
5.Create A User Account
# adduser postgres
# passwd postgres123
Changing password for user postgres.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.

6.Create Data Directory For Postgresql
Create the  data directory and make postgres user as the owner.
# mkdir /usr/local/pgsql/data
# chown postgres:postgres /usr/local/pgsql/data
# ls -ld /usr/local/pgsql/data
drwxr-xr-x 2 postgres postgres 4096 Jun  6 18:13 /usr/local/pgsql/data

7.Initialize data directory
Before you can start creating any database, the empty data directory created in the above step should be initialized using the initdb command .
# su - postgres
# /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data/
The files belonging to this database system will be owned by user postgres
This user must also own the server process.
 
The database cluster will be initialized with locale en_US.UTF-8.
The default database encoding has accordingly been set to UTF8.
The default text search configuration will be set to "english".
 
fixing permissions on existing directory /usr/local/pgsql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers/max_fsm_pages ... 32MB/204800
creating configuration files ... ok
creating template1 database in /usr/local/pgsql/data/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok
 
WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the -A option the
next time you run initdb.
 
Success. You can now start the database server using:
 
/usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data
                                    (or)
/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start
8.Validate the data directory
Make sure all postgres DB configuration files are created under the data directory
$ ls -l /usr/local/pgsql/data  
total 64
drwx------ 5 postgres postgres  4096 Jun  6 18:13 base
drwx------ 2 postgres postgres  4096 Jun  6 18:13 global
drwx------ 2 postgres postgres  4096 Jun  6 18:13 pg_clog
-rw------- 1 postgres postgres  3429 Jun  6 18:13 pg_hba.conf
-rw------- 1 postgres postgres  1460 Jun  6 18:13 pg_ident.conf
drwx------ 4 postgres postgres  4096 Jun  6 18:13 pg_multixact
drwx------ 2 postgres postgres  4096 Jun  6 18:13 pg_subtrans
drwx------ 2 postgres postgres  4096 Jun  6 18:13 pg_tblspc
drwx------ 2 postgres postgres  4096 Jun  6 18:13 pg_twophase
-rw------- 1 postgres postgres  4 Jun  6 18:13 PG_VERSION
drwx------ 3 postgres postgres  4096 Jun  6 18:13 pg_xlog
-rw------- 1 postgres postgres 16592 Jun  6 18:13 postgresql.conf 
9.Start postgreSQL database
Use the postgres postmaster command to start the postgreSQL server in the background as shown below.
$ /usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data >logfile 2>&1 &
[1] 2222
 
$ cat logfile
LOG:  database system was shut down at 2009-04-06 18:13:50 PDT
LOG:  autovacuum launcher started
LOG:  database system is ready to accept connections
10.Create DB and test the installation
Create a test database and connect to it to make sure the installation was successful as shown below.
$ /usr/local/pgsql/bin/createdb nijam
$ /usr/local/pgsql/bin/psql nijam
Welcome to psql 8.3.7, the PostgreSQL interactive terminal.
nijam=#

Comments

Popular posts from this blog

How to find the server is whether standby (slave) or primary(master) in Postgresql replication ?

7 Steps to configure BDR replication in postgresql

How to Get Table Size, Database Size, Indexes Size, schema Size, Tablespace Size, column Size in PostgreSQL Database

Ora2PG - Oracle/MySQL to Postgres DB migration Version 20.0

PostgreSQL Introduction