<rdf:RDF
    xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
    xmlns:s='http://snipsnap.org/rdf/snip-schema#'
    xml:base='http://bliki.rimuhosting.com/rdf'>
    <s:Snip rdf:about='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/miscapplications/postgresql+notes'
         s:cUser='retep'
         s:oUser=''
         s:mUser='kron'>
        <s:name>knowledgebase/linux/miscapplications/postgresql notes</s:name>
        <s:content>1 Installing Postgresql&#xD;&#xA;&#xD;&#xA;The following code will install postgresql on an rhel4 server (it would work with a tweak or two for WBEL3/RHEL3).&#xD;&#xA;&#xD;&#xA;{code}&#xD;&#xA;function installpostgresql() {&#xD;&#xA;&#xD;&#xA;apt-get update&#xD;&#xA;&#xD;&#xA;# needed for postgresql-contrib&#xD;&#xA;&#xD;&#xA;apt-get -y install libxslt&#xD;&#xA;apt-get -y remove postgresql&#xD;&#xA;&#xD;&#xA;VERSION=8.2.3&#xD;&#xA;&#xD;&#xA;PV=1PGDG&#xD;&#xA;&#xD;&#xA;# change rhel-as-4 to rhel-es-3 for rhel3/whitebox3&#xD;&#xA;&#xD;&#xA;URL=ftp://ftp5.us.postgresql.org/pub/PostgreSQL/binary/v$VERSION/linux/rpms/redhat/rhel-as-4&#xD;&#xA;PACKAGES=&quot;postgresql-plpython postgresql-plperl postgresql-libs postgresql-contrib postgresql postgresql-server&quot;&#xD;&#xA;&#xD;&#xA;for PACKAGE in $PACKAGES; do&#xD;&#xA;&#xD;&#xA;FILE=$PACKAGE-$VERSION-$PV.i686.rpm&#xD;&#xA;&#xD;&#xA;if [ -e &quot;$FILE&quot; ] ; then&#xD;&#xA;&#xD;&#xA;echo &quot;Skipping $FILE, already have it&quot;&#xD;&#xA;&#xD;&#xA;continue&#xD;&#xA;&#xD;&#xA;fi&#xD;&#xA;&#xD;&#xA;echo &quot;Fetching $URL/$FILE&quot;&#xD;&#xA;&#xD;&#xA;wget --no-verbose &quot;$URL/$FILE&quot;&#xD;&#xA;&#xD;&#xA;if [ $? -ne 0 ] ; then&#xD;&#xA;&#xD;&#xA;echo &quot;Failed getting $URL/$FILE&quot;&#xD;&#xA;&#xD;&#xA;return 1&#xD;&#xA;&#xD;&#xA;fi&#xD;&#xA;&#xD;&#xA;done&#xD;&#xA;&#xD;&#xA;# need -i - i.e. keep the old one - on this one to avoid dependency issues with dovecot and php-pgsql&#xD;&#xA;&#xD;&#xA;rpm -i postgresql-libs-$VERSION*i686.rpm&#xD;&#xA;&#xD;&#xA;# the rest can just be -U - i.e. upgrade any other packages&#xD;&#xA;&#xD;&#xA;rpm -Uvfh postgresql-plpython-$VERSION-$PV.i686.rpm postgresql-plperl-$VERSION-$PV.i686.rpm  postgresql-contrib-$VERSION-$PV.i686.rpm postgresql-$VERSION-$PV.i686.rpm postgresql-server-$VERSION-$PV.i686.rpm&#xD;&#xA;&#xD;&#xA;if [ $? -ne 0 ] ; then&#xD;&#xA;&#xD;&#xA;echo &quot;Failed installing rpms&quot;&#xD;&#xA;&#xD;&#xA;return 1&#xD;&#xA;&#xD;&#xA;fi&#xD;&#xA;&#xD;&#xA;chkconfig --level 35 postgresql on&#xD;&#xA;&#xD;&#xA;/etc/init.d/postgresql start&#xD;&#xA;&#xD;&#xA;psql --version&#xD;&#xA;&#xD;&#xA;}&#xD;&#xA;&#xD;&#xA;installpostgresql&#xD;&#xA;&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;1  Backups&#xD;&#xA;&#xD;&#xA;The following file will backup a given database to /var/log/.  It will create a different file for each day of the week - the %u option in the date command.  After that it will overwrite files.&#xD;&#xA;&#xD;&#xA;{code:none}&#xD;&#xA;&#xD;&#xA;cat /etc/cron.d/backupfsn.sh&#xD;&#xA;#!/bin/bash&#xD;&#xA;backup_dir=&quot;/var/log/&quot;&#xD;&#xA;timeslot=`date +%u`&#xD;&#xA;i=dbnametobackup&#xD;&#xA;/usr/bin/pg_dump -U postgres $i | gzip &gt; &quot;$backup_dir/postgresql-$i-$timeslot-database.gz&quot;&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;1 Getting a List of Databases&#xD;&#xA;&#xD;&#xA;{code:none}&#xD;&#xA;psql  -U postgres -q -c &quot;\l&quot; dbname | sed -n 4,/\eof/p | grep -v rows\) | awk {&apos;print $1&apos;}&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;Not sure how to bootstrap this.  You need to provide a dbname, but what to use by default?  I think dbname could be postgres by default?  Not sure.&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;1 RHEL4, PostgreSQL 8.1 and Dovecot&#xD;&#xA;&#xD;&#xA;The default Dovecot is built against the older PostgreSQL 7.4.x RPMs, and needs to be removed to install 8.1. If you still need Dovecot, use this RPM which is compiled against the PostgreSQL 8.1.x -devel packages.&#xD;&#xA;&#xD;&#xA;{code:none}rpm -Uvh &quot;http://downloads.rimuhosting.com/dovecot-0.99.11-4-pg81.EL4.i386.rpm&quot;{code}</s:content>
        <s:mTime>2007-03-20 20:50:12.0</s:mTime>
        <s:cTime>2005-12-25 21:50:13.0</s:cTime>
        <s:comments
             rdf:type='http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag'/>
        <s:snipLinks>
            <rdf:Bag>
                <rdf:li rdf:resource='#snipsnap-search'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux'/>
                <rdf:li rdf:resource='#knowledgebase'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/miscapplications/ruby on rails'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/miscapplications'/>
                <rdf:li rdf:resource='#snipsnap-index'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/misc/ajax autocomplete'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/mail/postfixadmin on debian sarge'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/java/-Xmx settings'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/mail/postfixadmin+on+debian+sarge'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/java/tomcat on plesk'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/java/liferay install on tomcat 5.5'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/auto-restart'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/mail/postfix with amavis and mysql'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/Setup eRuby'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/rimuhosting/moving servers'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/mail/mass emailing best practices'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/webserver/apache'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/rimuhosting/changing vps ownership'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/webserver/noexec tmp'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/webserver/plesk notes'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/miscapplications/sugarcrm'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/mail/postfix notes'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/rimuhosting/rimuhosting ssh access'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/rimuhosting/vps backups'/>
            </rdf:Bag>
        </s:snipLinks>
        <s:attachments
             rdf:type='http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag'/>
    </s:Snip>
</rdf:RDF>
