# Extract the tarball and clean up older versions
mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "postgresql-*" -exec rm -r {} \;
tar xjvf ~/postgresql-8.4.2.tar.bz2
cd postgresql-8.4.2
test $UID = 0 && chown -R root:root .
# If you want PAM support pass --with-pam to configure
# If you want LDAP support pass --with-ldap to configure
# If you want OpenSSL support pass --with-openssl to configure
#
# For other info, see './configure --help' and read ./INSTALL
# Configure and build it
./configure
make
# Become root to install it
su
# Install it
make install
# Add /usr/local/pgsql/lib to /etc/ld.so.conf, if it's not already in there:
egrep -q "^/usr/local/pgsql/lib$" /etc/ld.so.conf > /dev/null 2>&1 ||
( echo "/usr/local/pgsql/lib" >> /etc/ld.so.conf ; ldconfig )
# Add a 'postgres' user and group
getent group | grep "^postgres:" > /dev/null 2>&1 || groupadd postgres
id postgres > /dev/null 2>&1 || useradd -g postgres postgres
usermod -d /usr/local/pgsql/data -s /bin/bash postgres
# Create a data directory
mkdir -p /usr/local/pgsql/data
chown postgres /usr/local/pgsql/data
# As the 'postgres' user, create the initial database data, start
# postgres, create a 'test' database
# (see ./logfile after it's done)
su - postgres
/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
# Become root again
exit
# If you have a recent version of Slackware that supports Sysv-init style
# init scripts, install the sample init-script
cp contrib/start-scripts/linux /etc/rc.d/init.d/postgresql
chmod 700 /etc/rc.d/init.d/postgresql
( cd /etc/rc.d/rc0.d ; ln -sf ../init.d/postgresql K02postgresql
cd /etc/rc.d/rc6.d ; ln -sf ../init.d/postgresql K02postgresql
cd /etc/rc.d/rc2.d ; ln -sf ../init.d/postgresql S98postgresql
cd /etc/rc.d/rc3.d ; ln -sf ../init.d/postgresql S98postgresql
cd /etc/rc.d/rc4.d ; ln -sf ../init.d/postgresql S98postgresql
cd /etc/rc.d/rc5.d ; ln -sf ../init.d/postgresql S98postgresql )
#
# and then start it
/etc/rc.d/init.d/postgresql start
## If you don't/can't do it the SysV-init way, add something like this:
# /usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data >logfile 2>&1 &
## or this
# /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start
## to /etc/rc.d/rc.local
# The 'postmaster' daemon will log to /usr/local/pgsql/data/serverlog
# Now as the 'postgres' user again, create a test database, check out
# the shell, then quit (leaving you as root). While in the shell,
# 'help' for help, to list all databases try '\l', to quit '\q'.
su - postgres
/usr/local/pgsql/bin/createdb test
/usr/local/pgsql/bin/psql test
exit