Denbun POP version Manual
User's Manual | Administrator's Manual | Installation Guide | Initial Settings Guide
Back to Menu
 

Installing and configuring Database (PostgreSQL) and the full text search extension

PostgreSQL is an open source RDBMS (Relational Database Management System). Please refer the official web site (http://www.postgresql.jp/) for more information about PostgreSQL

Please refer the system requirements for the version that Denbun supports.
1. Expanding the package
Use su command to switch to the root user.

su
Password:


Expand the file you transferred by FTP. In this example, it assumes that the file exists in "/home/guest" directory.

cd /usr/local/src
tar zxvf /home/guest/postgresql-8.2.4.tar.gz


After the expansion, a directory named "postgresql-8.2.4" is created in "/usr/local/src" directory.
2. Install the package
To configure the package, use configure scripts.
In this example, use the default with no command line options.
Move to the directory you expand the package and run the configure script.

cd /usr/local/src/postgresql-8.2.4/
./configure

.
.
.
.
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/dynaloader/linux.h to src/include/dynaloader.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


Next, use GNU make to make the package. It takes 5 to 30 minutes for the making (it depends on hardware).

gmake
.
.
.
.
gmake[1]: Leaving directory '/usr/local/src/postgresql-8.2.4/config'
All of PostgreSQL successfully made. Ready to install.

After the making, it is ready to perform regression tests to test for the SQL implementation.
The regression tests cannot be run with the super user (root). You should use any non administrative user. In this example, the user "neo" is used.

su neo
gmake check
.
.
.
.
=======================
All 103 tests passed.
=======================

gmake[2]: Leaving directory '/usr/local/src/postgresql-8.2.4/src/test/regress'
gmake[1]: Leaving directory '/usr/local/src/postgresql-8.2.4/src/test'

Now, it is ready to install the package. This step requires the super user (root).


After the installation, normally use gmake clean command. However we are going to install TSearch2 too, use gmake clean after the installation of TSearch2.
3. Create an administrative user
After the installation of PostgreSQL, create an administrative user.

 


Use passwd command to set the password.

The administrative user will use administrative commands of PostgreSQL, set the PATH in the environment variable of the user "postgres".
Normally, edit the file ".bash_profile" in the home directory of the user by using an editor such as vi.

4. Create database
Create a PostgreSQL database
Create a directory for the database files and change the owner to the administrative user ("postgres").
In this example, the directory is "/var/pgsql/data".

 



Create a database with the administrative user.
Use -D option to specify the directory for the database files.



It is ready to run PostgreSQL. Use the administrative command to run PostgreSQL.
If PostgreSQL runs normally, create a test database and connect.


If you see like that, the database runs normally.
5. Automatic start database setting
To run PostgreSQL automatically when the server is started, you can configure "/etc/rc.d/rc.local" file. However this version supposes using Red Hat Enterprise Linux, we use the scripts and the chkconfig command in the PostgreSQL package.
This step requires the super user (root).

Copy "contrib/start-scripts/linux" in the source code of PostgreSQL to "/etc/rc.d/init.d" and name it "postgresql".

 



In the "postgresql", the path can be specified.
Change PGDATA that meets your operating environment.



User chkconfig command to set.


Now, the database is started automatically when the server is started.
Restart the server and confirm the database runs.
6. Install TSearch2
TSearch2 is a one of contrib module for PostgreSQL. It is a full text search module for European languages and find the document quickly.
You can install TSearch2 from "contrib/tsearch2" directory of PostgreSQL.
To install TSearch2, PostgreSQL should run.
Move to tsearch2 directory and make the package. Use GNU make to make the package.

 


Next, install package. Use the super user (root) for this step.


After installation, check the installation.
User the administrative user (postgres) of PostgreSQL for the checking.



After the checking the installation, use gmake clean command to cleaning. This command deletes unnecessary files and makes free space.
This step requires the super user (root).


And also clean for PostgreSQL now.


 
Copyright (C) 2008-2011 NEOJAPAN,Inc. All Rights Reserved.