作者:辛亚平
日期:2006年12月18日
# groupadd postgresql
# useradd -g postgresql postgres
# passwd postgres
Changing password for user postgres.
New UNIX password:
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
# cp postgresql-8.2.0.tar.gz /tmp/
# cd /tmp/
# chmod +x postgresql-8.2.0.tar.gz
# tar zxvf postgresql-8.2.0.tar.gz
# cd postgresql-8.2.0
# ./configure --prefix=/usr/local/pgsql
# gmake
# gmake install
# mkdir /var/database/pgsql/data
# chown -R postgres /var/database/pgsql/data
# su postgres
$ initdb -D /var/database/pgsql/data
ksh: initdb: not found
$ ./initdb -D /var/database/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 C.
fixing permissions on existing directory /var/database/pgsql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 40
selecting default shared_buffers/max_fsm_pages ... 28MB/179200
creating configuration files ... ok
creating template1 database in /var/database/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:
./postgres -D /var/database/pgsql/data
or
./pg_ctl -D /var/database/pgsql/data -l logfile start
$ exit
#
# su postgres
$ /usr/local/pgsql/bin/postmaster -D /var/database/pgsql/data &
[1] 29454
$ LOG: database system was shut down at 2006-12-16 17:57:32 CST
LOG: checkpoint record is at 0/42C210
LOG: redo record is at 0/42C210; undo record is at 0/0; shutdown TRUE
LOG: next transaction ID: 0/593; next OID: 10820
LOG: next MultiXactId: 1; next MultiXactOffset: 0
LOG: database system is ready
$ /usr/local/pgsql/bin/createdb XoopsDB1
CREATE DATABASE
$ exit
#