Installing PostgreSQL Database Server

 

1. Installation check

The PostgreSQL database server is shipped with all major Linux distributions. You might have PostgreSQL already installed. One possible procedure to check if the database is installed is as follows:

bash# postmaster --version

postmaster (PostgreSQL) 7.x.x

If the command is executed properly (displaying name and version), then the PostgreSQL software is already installed. If not, install the PostgreSQL database server from your Linux distribution (it is included).

Note: We have tested extensively with version 7.1, 7.2, 7.3 and to some extent 7.4. Using older versions is not recommended!

2. Enabling “postgres” account

As “root” user enable the “postgres” account. PostgreSQL prevents you from running the server as the “root” user for the reason of system security, so you must complete most of the configuration steps as “postgres” user. On most Linux distributions the “postgres” user is already created, you simply need to setup the password:

bash# passwd postgres

Changing password for user postgres
New password:
Retype new password:
passwd: all authentication tokens updated successfully

3. Initializing the database and starting the server

Login as “postgres” user and create the database cluster. Issue this command:

bash# initdb –E UNICODE

After the database cluster is created, you can run the database server and check if you are able to access it. The sequence should look as follows:

bash# pg_ctl start

[1] 23407
DEBUG:  database system was shut down at 2002-04-01 15:15:12 AST
DEBUG:  CheckPoint record at (0, 1522208)
DEBUG:  Redo record at (0, 1522208); Undo record at (0, 0); Shutdown TRUE
DEBUG:  NextTransactionId: 621; NextOid: 18720
DEBUG:  database system is in production state

bash# psql -l

        List of databases

 Database  |  Owner   | Encoding
-------------+-----------+------------
 template0 | postgres | UNICODE
 template1 | postgres | UNICODE

(2 rows)

From this point your database server is up and running and you can proceed with the Intra.Net preparation.

4. Creating database, username and password for Intra.Net

In this step, you will need to create a database user and a database owned by this user. In this example, the username “intranet” is created and the database created (owned by the user “intranet”) is called “intradb”, but you can choose your own username and database name. Steps to create and verify the user and database are:

bash# createuser -P

Enter name of user to add: intranet
Enter password for user "intranet": <type password>
Enter it again: <type password>
Shall the new user be allowed to create databases? (y/n) y
Shall the new user be allowed to create more new users? (y/n) n

CREATE USER

bash# createdb -U intranet intradb

CREATE DATABASE

bash# psql -l

        List of databases

 Database  |  Owner   | Encoding
-------------+-----------+------------
 intradb     | intranet  | UNICODE
 template0 | postgres | UNICODE
 template1 | postgres | UNICODE

(3 rows)

After these steps are performed the database “intradb” owned by user “intranet” with UNICODE encoding should appear on the list.

5. Setting network and security configuration

Go to the “data” directory (from the “postgres” user home directory) and change two configuration files:
1.
postgresql.conf

Uncomment the line "tcpip_socket = false" and change the line to "tcpip_socket = true". This will allow PostgreSQL to accept TCP/IP connections from the JDBC driver.
2.
pg_hba.conf

If other users are using this computer, go to the end of the file and change the authorization checks from “trust” to “password”. It is highly recommended to install Linux on a server dedicated to run only a PostgreSQL server with only “root” and “postgres” users enabled. In this case, you do not need to change these settings for local access.

If you are planning to run the application server with INTRA.NET on a separate computer (recommended), you will need to allow network access to your PostgreSQL server. Suppose your application server has the IP address 192.168.7.45. To allow this computer to access the database server add a third line as follows (all three lines are shown, the last line is new):

local   all                                                        trust

host    all      127.0.0.1         255.255.255.255    trust
host    all      192.168.7.45    255.255.255.255    password

Again, “trust” for local access is acceptable only if you are not planning to allow other users to use the server in addition to “root” and “postgres”. For other possible options (especially network masks) please refer to the extensive documentation provided within the “pg_hba.conf” file in the form of comments.

The final step is to restart the server in order to accept changes made to “postgresql.conf” file (changing “pg_hba.conf” does not require the database server to be restarted - changes are accepted immediately):

bash# pg_ctl restart

6. Starting the database server on a system boot

You can use the “chkconfig” command (or “ntsysv” utility on some Linux systems) in order to turn on or off the database startup at the time of system boot. To enable PostgreSQL to be started on the system startup you must login as the “root” user. When logged in as “root” type:

bash# chkconfig postgresql on

Noodle Corporate Social Networking

What can you do with Noodle?

Build a powerful Intranet
Start an enterprise Wiki
Develop a social network
Create team blogs
Manage company forms
Update project calendars
Share office documents
Micro Blog your status
Monitor employee wisdom

 

About | Why Noodle | Support | Investors | News | Contact


Noodle is a product of Vialect Inc