[ritesh@chennai ~]$
cd ritesh_cdm/ |
change directory |
[ritesh@chennai ~]$
tar -zxvf postgresql-8.2.9.tar.gz |
untar postgresql |
[ritesh@chennai ~]$
cd postgresql-8.2.9 |
get inside unpacked postgresql folder |
[ritesh@chennai
postgresql-8.2.9]$ su root
Password: |
become root |
[root@chennai
postgresql-8.2.9]# ./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
[root@chennai postgresql-8.2.9]# |
Keep your eyes open while configure is
working because now its the time for errors, if certain pre-requisites
are not found while PostgreSql installation. |
If you haven't got any errors
during config then move on to next step, else refer end of this page for possible solutions ! |
[root@chennai
postgresql-8.2.9]# make |
Go ahead type make and press Enter key. Go
for a tea break because it is going to take a while to complete. |
[root@chennai
postgresql-8.2.9]# make install
..............................
make[1]: Leaving directory `/root/OpenClinica-2.5.6/postgresql-8.2.9/src'
make -C config install
make[1]: Entering directory
`/root/OpenClinica-2.5.6/postgresql-8.2.9/config'
/bin/sh ../config/install-sh -c -m 755 ./install-sh '/usr/local/pgsql/lib/pgxs/c
onfig/install-sh'
/bin/sh ../config/install-sh -c -m 755 ./mkinstalldirs '/usr/local/pgsql/lib/pgx
s/config/mkinstalldirs'
make[1]: Leaving directory
`/root/OpenClinica-2.5.6/postgresql-8.2.9/config'
PostgreSQL installation complete. |
make install |
[root@chennai
postgresql-8.2.9]# adduser postgres |
create user postgres [don't use another
name] |
[root@chennai
postgresql-8.2.9]# passwd postgres
Changing password for user
postgres.
New password:
Retype new password:
passwd: all authentication tokens updated successfully. |
change password |
[root@chennai
postgresql-8.2.9]# mkdir /usr/local/pgsql/data |
create data folder for DB |
[root@chennai
postgresql-8.2.9]# chown postgres:postgres
/usr/local/pgsql/data |
Provide ownership of folder to the new
postgres user |
[root@chennai
postgresql-8.2.9]# echo "export PGDATA=/usr/local/pgsql/data"
>> /etc/profile |
Setting environment variables for PGDATA |
[root@chennai
postgresql-8.2.9]# su postgres |
change user to postgres |
[postgres@chennai
postgresql-8.2.9]$ cd $PGHOME |
navigate to postgres users home directory |
[postgres@chennai
~]$ /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.
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 ... 24MB/153600
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
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
|
Initialize Database |
[postgres@chennai
~]$ ls -l /usr/local/pgsql/data
drwx------ 5 postgres postgres
4096 2009-07-31 21:23 base
drwx------ 2 postgres postgres 4096 2009-07-31 21:23 global
drwx------ 2 postgres postgres 4096 2009-07-31 21:23 pg_clog
-rw------- 1 postgres postgres 3414 2009-07-31 21:23 pg_hba.conf
-rw------- 1 postgres postgres 1460 2009-07-31 21:23 pg_ident.conf
drwx------ 4 postgres postgres 4096 2009-07-31 21:23 pg_multixact
drwx------ 2 postgres postgres 4096 2009-07-31 21:23 pg_subtrans
drwx------ 2 postgres postgres 4096 2009-07-31 21:23 pg_tblspc
drwx------ 2 postgres postgres 4096 2009-07-31 21:23 pg_twophase
-rw------- 1 postgres postgres 4 2009-07-31 21:23 PG_VERSION
drwx------ 3 postgres postgres 4096 2009-07-31 21:23 pg_xlog
-rw------- 1 postgres postgres 15353 2009-07-31 21:23 postgresql.conf
[postgres@chennai
~]$ |
Verify if the files are
present especially pg_hba.conf and postgresql.conf |
Well PostgreSQL installation is complete but not yet running. To start
up - as postgres user type:
[postgres@chennai ~]$
/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start
server starting |
If you want to configure PostgreSql to start
automatically at startup then do the following |
[postgres@chennai
~]$ exit |
become root again |
[root@chennai
postgresql-8.2.9]# cp contrib/start-scripts/linux
/etc/init.d/postgresql |
copy postgresql daemon script
to init.d folder - to make the postgresql run with computer startup (the
startup scripts |
[root@chennai
postgresql-8.2.9]# chmod 755 /etc/init.d/postgresql |
navigate to init.d folder |
Try
chkconfig --add postgresql
which may not work (For me it failed in Fedora 11) , in such
cases add symbolic links from the correct /etc/rc*.d/
directories to /etc/init.d/postgres |
[root@chennai
postgresql-8.2.9]# ls -s /etc/init.d/postgresql
/etc/rc2.d/S98postgresql
[root@chennai
postgresql-8.2.9]# ls -s /etc/init.d/postgresql
/etc/rc3.d/S98postgresql |
/sbin/chkconfig --add
tomcatd may not work in Fedora. Add symbolic links to /etc/rc*.d
directories. |
If you are wondering from where
I got the magical 'S98postgresql' to add symbolic link, then browse
through /etc/rc*d folders.
 |
Reboot machine ; as root type :
[root@localhost ~]#
ps -A | grep post
4107 ? 00:00:00 postmaster
4190 ? 00:00:00 postmaster
4191 ? 00:00:00 postmaster |
verify if the process postmaster is
running. |
configure should work but I encountered errors while doing so. Installing
relevant rpms fixed the issues and was able to configure properly.
Consider the following if you get errors when running ./configure:
checking for gcc... no
checking for cc... no
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.
So that means gcc is not found.
Do do a yum install if Fedora or apt-get if PClinuxOS