-
Notifications
You must be signed in to change notification settings - Fork 4
Initialize_PostgreSQL_Server
-
[http://www.postgresql.org/download/ PostgreSQL server] version 7.4 or above must be running either on the local machine or remotely over a TCP/IP port. You should use the --locale=C option when initializing the server with initdb.
-
Create user accounts.
-
Configure access privileges.
-
Restart PostgreSQL server.
- Open a shell as user postgres. E.g. (Linux)
[user@localhost]$ su
[root@localhost]$ su postgres
[postgres@localhost]$
- Create a user (lexdb) who will manage the database:
{{{[postgres@localhost]$ createuser --createdb --no-adduser -P lexdb Enter password for new user: Enter it again: CREATE USER}}}
- (Note: setting the password to lexdb will save bother later.)
- Create a user account for yourself (substitute your shell login for USERNAME below):
{{{[postgres@localhost]$ createuser --no-createdb --no-adduser -P USERNAME Enter password for new user: Enter it again: CREATE USER}}}
- (Note: setting the password to match the username will save bother later.)
- Ensure the [http://www.postgresql.org/docs/7.4/interactive/client-authentication.html#AUTH-PG-HBA-CONF access privilege configuration file] $PGDATA/pg_hba.conf contains the following lines:
{{{# TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD
local all all md5 host all all 127.0.0.1 255.255.255.255 md5}}}
- TCP/IP must be enabled. Uncomment the line for TCP/IP in $PGDATA/postgresql.conf so that it reads:
tcpip_socket = true
- By default the server will run on port 5432. To use another port set the PSQL [http://www.postgresql.org/docs/7.4/interactive/libpq-envars.html environment variable] PGPORT.
- Allow remote access to the server by adding lines of the following form to access privilege configuration file $PGDATA/pg_hba.conf:
host all all IP_ADDRESS 255.255.255.255 md5
-
TCP/IP must be enabled. Uncomment the line for TCP/IP in $PGDATA/postgresql.conf so that it reads:
- tcpip_socket = true
-
By default the server will run on port 5432. To use another port set the environment variable PGPORT.
Home | Forum | Discussions | Events