Securing-Optimizing-RH-Linux-1_2_334
Comments and suggestions concerning this book should be mailed to gmourani@videotron.ca
© Copyright 1999-2000 Gerhard Mourani and Open Network Architecture ®
334
all subdirectories and files related to PostgreSQL under /usr/include and /usr/lib directories to
the /usr/include/pgsql and /usr/lib/pgsql directories respectively with the command mv.
The "chown" command would set the correct files owner and group permission for the
/var/lib/pgsql directory. The strip command would discard all symbols from the object files.
This means that our binary file will be smaller in size. This will improve a bit the performance hit to
the program since they will be fewer lines to read by the system when itll execute the binary.
The rm command will remove the global1.description and local1_template1.description files
that are not needed by our PosgreSQL program.
Create the database installation from your Postgres superuser account
Once PostgreSQL is installed in your Linux server, its important to create now the database
installation before starting your PostgreSQL server.
·
To create the database installation, use the following command:
[root@deep /]# su postgres
[postgres@deep /]$ initdb --pglib=/usr/lib/pgsql --pgdata=/var/lib/pgsql
We are initializing the database system with username postgres (uid=40).
This user will own all the files and must also own the server process.
Creating Postgres database system directory /var/lib/pgsql/base
Creating template database in /var/lib/pgsql/base/template1
Creating global classes in /var/lib/pgsql/base
Adding template1 database to pg_database...
Vacuuming template1
Creating public pg_user view
Creating view pg_rules
Creating view pg_views
Creating view pg_tables
Creating view pg_indexes
Loading pg_description
[postgres@deep /]$ chmod 640 /var/lib/pgsql/pg_pwd
[postgres@deep /]$ exit
exit
[root@deep /]#
NOTE: Do not create the database installation as root! This would be a major security hole.
Cleanup after work
[root@deep /]# cd /var/tmp
[root@deep tmp]# rm -rf postgresql-version/ postgresql-version_tar.gz
Remove the egcs-c++-1.1.2-24.i386.rpm package to make space.
[root@deep /]# rpm -e egcs -c++
The rm command will remove all the source files we have used to compile and install
PostgreSQL. It will also remove the PostgreSQL compressed archive from the /var/tmp
directory.