Difference between revisions of "PostgreSQL"
(Added 'Configuring' and 'Bootscript' Section) |
|||
(3 intermediate revisions by 2 users not shown) | |||
Line 2: | Line 2: | ||
|-valign="top" | |-valign="top" | ||
!Download Source: | !Download Source: | ||
− | | http:// | + | | http://wwwmaster.postgresql.org/redir/326/f/source/v{{PostgreSQL-Version}}/postgresql-{{PostgreSQL-Version}}.tar.bz2 |
|} | |} | ||
Line 19: | Line 19: | ||
* [[MIT krb5]] or [[Heimdal]] | * [[MIT krb5]] or [[Heimdal]] | ||
* [[Bonjour]] | * [[Bonjour]] | ||
+ | * [[OpenLDAP]] | ||
+ | |||
=== Optional (To Regenerate The Documentation) === | === Optional (To Regenerate The Documentation) === | ||
* [[DocBook SGML DTD-4.x]] | * [[DocBook SGML DTD-4.x]] | ||
Line 117: | Line 119: | ||
install -v -m644 doc/TODO.detail/* \ | install -v -m644 doc/TODO.detail/* \ | ||
/usr/share/doc/postgresql/TODO.detail | /usr/share/doc/postgresql/TODO.detail | ||
+ | |||
+ | |||
+ | == Configuring == | ||
+ | |||
+ | Create the 'postgres' user. (You can name the user anything.) | ||
+ | |||
+ | useradd -s /bin/bash -d /home/postgres -g users -u 81 postgres | ||
+ | |||
+ | (Check if the uid is being used by other user or not.) | ||
+ | |||
+ | Choose a directory to store the database cluster. The two most popular are | ||
+ | /usr/local/pgsql/data and /var/lib/pgsql/data. I have chosen /var/lib/pgsql/data. | ||
+ | Modify the commands if you have chosen anything else accordingly. | ||
+ | |||
+ | As root: | ||
+ | |||
+ | mkdir -pv /var/lib/pgsql/data | ||
+ | chown postgres.users /var/lib/pgsql/data | ||
+ | su postgres | ||
+ | initdb -D /var/lib/pgsql/data | ||
+ | |||
+ | Start the server | ||
+ | |||
+ | pg_ctl -D /var/lib/pgsql/data -l <logfile> start | ||
+ | |||
+ | |||
+ | === Bootscript === | ||
+ | |||
+ | This is a sample bootscript. Modify it to suit your own need. | ||
+ | |||
+ | #!/bin/sh | ||
+ | # Begin $rc_base/init.d/postgresql | ||
+ | |||
+ | # Based on sysklogd script from LFS-3.1 and earlier. | ||
+ | # Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org | ||
+ | |||
+ | #$LastChangedBy: dnicholson $ | ||
+ | #$Date: 2008-03-12 21:45:44 +0000 (Wed, 12 Mar 2008) $ | ||
+ | |||
+ | . /etc/sysconfig/rc | ||
+ | . $rc_functions | ||
+ | |||
+ | PGUSER=postgres | ||
+ | PGDATADIR="/var/lib/pgsql/data" | ||
+ | |||
+ | pidfile="$PGDATADIR/postmaster.pid" | ||
+ | |||
+ | case "$1" in | ||
+ | start) | ||
+ | boot_mesg "Starting PostgreSQL database..." | ||
+ | su $PGUSER -c "pg_ctl -D $PGDATADIR start" | ||
+ | sleep 1 | ||
+ | echo "-17" >/proc/`cat $pidfile | head -1`/oom_adj | ||
+ | ;; | ||
+ | |||
+ | stop) | ||
+ | boot_mesg "Stopping PostgreSQL database..." | ||
+ | su $PGUSER -c "pg_ctl -D $PGDATADIR stop" | ||
+ | ;; | ||
+ | |||
+ | restart) | ||
+ | $0 stop | ||
+ | sleep 1 | ||
+ | $0 start | ||
+ | ;; | ||
+ | |||
+ | status) | ||
+ | statusproc -p $pidfile /usr/bin/postgres | ||
+ | ;; | ||
+ | |||
+ | *) | ||
+ | echo "Usage: $0 {start|stop|restart|status}" | ||
+ | exit 1 | ||
+ | ;; | ||
+ | esac | ||
+ | |||
+ | # End $rc_base/init.d/postgresql | ||
+ | |||
+ | |||
+ | |||
+ | [[Category:Servers]] |
Latest revision as of 02:33, 9 September 2010
Download Source: | http://wwwmaster.postgresql.org/redir/326/f/source/v8.4.2/postgresql-8.4.2.tar.bz2 |
---|
Contents
Introduction to PostgreSQL
PostgreSQL is an advanced object-relational database management system (ORDBMS), derived from the Berkeley Postgres database management system.
Project Homepage: http://www.postgresql.org
Dependencies
Optional
Optional (To Regenerate The Documentation)
Additional Configuration Options
--enable-integer-datetimes: Use 64-bit integer storage for datetimes and intervals, rather than the default floating-point storage. This reduces the range of representable values but guarantees microsecond precision across the full range (see Section 8.5 of the PostgreSQL documentation for more information). Note also that the integer datetimes code is newer than the floating-point code, and the postgreSQL team still finds bugs in it from time to time.
--enable-nls[=LANGUAGES]: Enables native language support for the given languages. For instance --enable-nls='de fr' will give you language support in PostgreSQL for German and French.
--with-openssl: Enable OpenSSL support.
--with-pam: Enables Linux-PAM support.
--with-perl: Build the PL/Perl server-side language.
--with-python: Build the PL/Python server-side language.
--with-tcl: Build the PL/TCLserver-side language.
--with-tclconfig=DIRECTORY: Tells configure where to find tclConfig.sh. Normally configure is able to find tclConfig.sh on its own, but if you put it in a non-standard place, then you'll probably have to use this flag.
Non-Multilib
Compile the package:
sed -i "s|dsssl-stylesheets|& \\\\\n sgml/docbook/&-1.79|" \ configure && ./configure --prefix=/usr --enable-thread-safety --sysconfdir=/etc && make
Install the package
make install && chown -v root:root /usr/share/doc/postgresql/html/* && install -v -m755 -d /usr/share/doc/postgresql/{FAQ/html,TODO.detail} && install -v -m644 doc/TODO /usr/share/doc/postgresql && install -v -m644 doc/FAQ* /usr/share/doc/postgresql/FAQ && install -v -m644 doc/src/FAQ/* /usr/share/doc/postgresql/FAQ/html && install -v -m644 doc/TODO.detail/* \ /usr/share/doc/postgresql/TODO.detail
Multilib
32Bit
Compile the package:
sed -i "s|dsssl-stylesheets|& \\\\\n sgml/docbook/&-1.79|" \ configure && USE_ARCH=32 CC="gcc ${BUILD32}" ./configure --prefix=/usr --enable-thread-safety \ --sysconfdir=/etc && make LD="ld ${LD_BUILD32}"
Install the package
make install && mv -v /usr/bin/pg_config{,-32}
N32
Compile the package:
sed -i "s|dsssl-stylesheets|& \\\\\n sgml/docbook/&-1.79|" \ configure && CC="gcc ${BUILDN32}" ./configure --prefix=/usr --libdir=/usr/lib32 \ --enable-thread-safety --sysconfdir==/etc && make LD="ld ${LD_BUILDN32}"
Install the package
make install && mv -v /usr/bin/pg_config{,-n32}
64Bit
Compile the package:
sed -i "s|dsssl-stylesheets|& \\\\\n sgml/docbook/&-1.79|" \ configure && USE_ARCH=64 CC="gcc ${BUILD64}" ./configure --prefix=/usr --libdir=/usr/lib64 \ --enable-thread-safety --sysconfdir=/etc && make
Install the package
make install && mv -v /usr/bin/pg_config{,-64} && ln -sfv multiarch_wrapper /usr/bin/pg_config && chown -v root:root /usr/share/doc/postgresql/html/* && install -v -m755 -d /usr/share/doc/postgresql/{FAQ/html,TODO.detail} && install -v -m644 doc/TODO /usr/share/doc/postgresql && install -v -m644 doc/FAQ* /usr/share/doc/postgresql/FAQ && install -v -m644 doc/src/FAQ/* /usr/share/doc/postgresql/FAQ/html && install -v -m644 doc/TODO.detail/* \ /usr/share/doc/postgresql/TODO.detail
Configuring
Create the 'postgres' user. (You can name the user anything.)
useradd -s /bin/bash -d /home/postgres -g users -u 81 postgres
(Check if the uid is being used by other user or not.)
Choose a directory to store the database cluster. The two most popular are /usr/local/pgsql/data and /var/lib/pgsql/data. I have chosen /var/lib/pgsql/data. Modify the commands if you have chosen anything else accordingly.
As root:
mkdir -pv /var/lib/pgsql/data chown postgres.users /var/lib/pgsql/data su postgres initdb -D /var/lib/pgsql/data
Start the server
pg_ctl -D /var/lib/pgsql/data -l <logfile> start
Bootscript
This is a sample bootscript. Modify it to suit your own need.
#!/bin/sh # Begin $rc_base/init.d/postgresql # Based on sysklogd script from LFS-3.1 and earlier. # Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org #$LastChangedBy: dnicholson $ #$Date: 2008-03-12 21:45:44 +0000 (Wed, 12 Mar 2008) $ . /etc/sysconfig/rc . $rc_functions PGUSER=postgres PGDATADIR="/var/lib/pgsql/data" pidfile="$PGDATADIR/postmaster.pid" case "$1" in start) boot_mesg "Starting PostgreSQL database..." su $PGUSER -c "pg_ctl -D $PGDATADIR start" sleep 1 echo "-17" >/proc/`cat $pidfile | head -1`/oom_adj ;; stop) boot_mesg "Stopping PostgreSQL database..." su $PGUSER -c "pg_ctl -D $PGDATADIR stop" ;; restart) $0 stop sleep 1 $0 start ;; status) statusproc -p $pidfile /usr/bin/postgres ;; *) echo "Usage: $0 {start|stop|restart|status}" exit 1 ;; esac # End $rc_base/init.d/postgresql