PostgreSQL is an advanced object-relational database management system (ORDBMS) based on POSTGRES. With more than 15 years of development history, it is quickly becoming the de facto database for enterprise level open source solutions. This build includes full text search support (tsearch2).
Home: http://www.postgresql.org.Repository: SlackersDownload size: 4,26 MBInstalled size: 22,48 MBPackage filename: postgresql-9.0.4-i686-1cf.txz
#installpkg postgresql-9.0.4-i686-1cf.txz
Step 2: Create postgreSQL user account
# adduser postgres# passwd postgresChanging password for user postgres.New UNIX password:Retype new UNIX password:passwd: all authentication tokens updated successfully.
Step 3: Create postgreSQL data directory (if not exist). Create the postgres data directory and make postgres user as the owner.
# mkdir /var/lib/pgsql/data# chown -Rf postgres:wheel /var/lib/pgsql/# ls -ld /var/lib/pgsql/datadrwxr-xr-x 2 postgres whell 4096 Apr 8 23:26 /var/lib/pgsql/data
Step 4: Initialize postgreSQL data directory. Before you can start creating any postgreSQL database, the empty data directory created in the above step should be initialized using the initdb command as shown below.
# su – postgres# /usr/bin/initdb -D /var/lib/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.The default database encoding has accordingly been set to SQL_ASCII.The default text search configuration will be set to "english".
.... cut ...
Success. You can now start the database server using:/usr/bin/postgres -D /var/lib/pgsql/data
or
/usr/bin/pg_ctl -D /var/lib/pgsql/data -l logfile start
Step 5: Validate the postgreSQL data directory. Make sure all postgres DB configuration files (For example, postgresql.conf) are created under the data directory as shown below.
#ls -al /var/lib/pgsql/data
total 80drwx------ 12 postgres wheel 4096 Sep 28 15:13 .drwx------ 3 postgres wheel 4096 May 9 09:47 ..-rw------- 1 postgres users 4 Sep 28 15:13 PG_VERSIONdrwx------ 5 postgres users 4096 Sep 28 15:13 basedrwx------ 2 postgres users 4096 Sep 28 15:13 globaldrwx------ 2 postgres users 4096 Sep 28 15:13 pg_clog-rw------- 1 postgres users 3939 Sep 28 15:13 pg_hba.conf-rw------- 1 postgres users 1636 Sep 28 15:13 pg_ident.confdrwx------ 4 postgres users 4096 Sep 28 15:13 pg_multixactdrwx------ 2 postgres users 4096 Sep 28 15:13 pg_notifydrwx------ 2 postgres users 4096 Sep 28 15:13 pg_stat_tmpdrwx------ 2 postgres users 4096 Sep 28 15:13 pg_subtransdrwx------ 2 postgres users 4096 Sep 28 15:13 pg_tblspcdrwx------ 2 postgres users 4096 Sep 28 15:13 pg_twophasedrwx------ 3 postgres users 4096 Sep 28 15:13 pg_xlog-rw------- 1 postgres users 17935 Sep 28 15:13 postgresql.conf
Step 6: Start postgreSQL database. Use the postgres postmaster command to start the postgreSQL server in the background as shown below.
#/usr/bin/postmaster -D /var/lib/pgsql/data >logfile 2>&1 &
[1] 2222
$ cat logfile
LOG: database system was shut down at 2011-09-28 15:13:17 UTC
LOG: database system is ready to accept connections
LOG: autovacuum launcher started
OR
#/usr/bin/postmaster -D /var/lib/pgsql/data
LOG: database system was shut down at 2011-09-28 15:13:17 UTC
LOG: database system is ready to accept connections
LOG: autovacuum launcher started
OR
Using rc.postgresql to start and stop postgresql service
# /etc/rc.d/rc.postgresql startStarting PostgreSQLwaiting for server to start.... doneserver started
# /etc/rc.d/rc.postgresql stopShutting down PostgreSQL...waiting for server to shut down.... doneserver stopped
Step 7: Create postgreSQL DB and test the installation. Create a test database and connect to it to make sure the installation was successful as shown below.
# createdb test#psql testpsql (9.0.3)Type "help" for help.
test=#
Login as user postgres
#psql -U postgres
psql (9.0.3)
Type "help" for help.
postgres=# help
You are using psql, the command-line interface to PostgreSQL.
Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit
Done
No comments:
Post a Comment