Installing PostgreSQL on CentOS 6


(Clementoke) #1

Hi there,

Does anyone have a post or tutorial on installing Postgres on CentOS6 64bit using SSH?

I'm jumping into my first 'ground up' Squiz installation.

Cheers,

Clement


(Benjamin Pearson) #2

It should be virtually the same as Nic's guide on Debian: http://www.zedsaid.com/blog/install-squiz-matrix-in-10-minutes-on-debian-7.0-using-digital-ocean but the paths might be different (I think the configs are under /var/lib/pgsql instead of /etc)


(Bart Banda) #3

I found this guide very helpful: http://opensourcedbms.com/dbms/installing-postgresql-9-2-on-cent-os-6-3-redhat-el6-fedora/ 


(Clementoke) #4

Thanks guys,

That's Sunday night sorted.

Clement


(Clementoke) #5

I'm having problems assigning squiz as the owner of the database using phpPGAdmin but it only shows up as roles instead of user. Any ideas how I can fix this?


(Marcus Fong) #6

In PostgreSQL, a user actually is a role:

“PostgreSQL manages database access permissions using the concept of roles. A role can be thought of as either a database user, or a group of database users, depending on how the role is set up.” (http://www.postgresql.org/docs/current/static/user-manag.html)


I haven’t really used phpPgAdmin that much, but from the command line you’d normally assign the owner when you created the database, e.g:


createdb -U postgres -O matrix -E UTF8 squiz_matrix


would create the database “squiz_matrix” with the owner “matrix”. (http://manuals.matrix.squizsuite.net/evaluate-squiz-matrix/manual-installation-guide/postgresql-database-setup-guide)


(Clementoke) #7

I was having issues trying it from the command line so now I have two roles but can't assign ownership. I've created the database already so I probably need some commands to make the role a user and assign ownership of the database to it


(Clementoke) #8

OK so I've dropped the database and tried starting again. Now it won't let me create the database saying it still exists. But I've dropped it and it doesn't show up in any list!!!


(Clementoke) #9

Still stuck with the create user bit using Nic's tutorial.


(Benjamin Pearson) #10

You might need to run createuser with sudo if you are running a local account without any DB access. Otherwise, if you can post what error messages you get when creating the user, someone might be able to help you better.


(Clementoke) #11

I get

createuser: could not connect to database postgres: FATAL: Peer authentication failed for user "postgres"

(Marcus Fong) #12

That’d be your pg_hba file, Clement:

http://www.postgresql.org/docs/8.4/static/auth-pg-hba-conf.html


From the error you posted it seems like you’re using “ident” authentication, which means that to do anything as the “postgres” PostgreSQL (super)user you have to be the system user called “postgres”.


You could try editing pg_hba.conf, but for now just try prefixing your PostgreSQL commands (assuming you’re running them as root) with “sudo -u postgres”, e.g.


sudo -u postgres createuser -SRDU postgres matrix


(If you like, you can also drop the -U postgres, since when you’re the system user “postgres” it’s not needed.)


(Clementoke) #13

That's worked but now I have a problem with the CVS repo, can't seem to checkout the package Capture.PNG

If you can't seen the screen capture use https://www.dropbox.com/s/6vba5abs3govr3x/Capture.PNG


(Nic Hubbard) #14

That's worked but now I have a problem with the CVS repo, can't seem to checkout the package Capture.PNG

If you can't seen the screen capture use https://www.dropbox.com/s/6vba5abs3govr3x/Capture.PNG

 

 

You need to rename the script to checkout.sh


(Clementoke) #15

I typed in the curl line and got the following but where do I rename the script?

#!/bin/sh
USER="anonymous"
SERVER="public-cvs.squiz.net"
CVS_PUBLIC_PATH="/home/public"

Allow the path to cvs to be overridden by an env var.

if [ “x$CVS” = “x” ]; then
CVS="/usr/bin/cvs"
fi

if [ ! -x “$CVS” ]; then
echo “No ‘cvs’ binary found at $CVS, aborting.”
exit 1
fi

print_usage()
{
echo “”
echo “This script will check out Squiz Matrix based on a version number you supply.”
echo “It will check out into a directory called ‘squiz_matrix’.”
echo “Version numbers are based on releases. They are named the same way :”
echo “mysource_4-x-y”
echo “For example, if you want 4.0.4, the version number will be mysourc e_4-0-4”
echo “”
echo “So to use this script, it becomes:”
echo “$0 mysource_4-0-4”
echo “”
echo “To install into a new directory, specify that as the second argume nt”
echo “If this isn’t specified, it will default to ‘squiz_matrix’”
echo “To do this, you must specify a version number to check out, eg:”
echo “$0 mysource_4-0-4 squiz_matrix_4-0-4”
exit 1
}

if [ “x$1” = “x” ]; then
print_usage
exit 1
fi

VERSION=$1

CHECKOUT_DIR=“squiz_matrix”
if [ “x$2” != “x” ]; then
CHECKOUT_DIR=$2
fi

What do we need to check out?

PACKAGES=“bulkmail calendar cms data ecommerce filesystem funnelback google_maps import_tools ipb ldap news saml search sharepoint squid squiz_suite trim web_se rvices oauth2”
FUDGE_PACKAGES=“antivirus colour csv datetime_field db_extras dev file_versionin g general image image_editor js_calendar ldap mollom recaptcha rss_feeds standar ds_lists var_serialise wysiwyg”

if [ -d $CHECKOUT_DIR ]; then
echo “Directory $CHECKOUT_DIR already exists, aborting.”
echo “Please specify a directory that doesn’t exist.”
print_usage
exit 1
fi

cvs can’t do checkouts to absolute paths, so we need to turn everything relati ve.

Make sure we can create the path to the checkout dir.

checkoutBase=dirname $CHECKOUT_DIR
if [ ! -d $checkoutBase ]; then
mkdir -p $checkoutBase
if [ $? -gt 0 ]; then
echo “Unable to make directory ${checkoutBase} to check out matrix to.”
echo “Aborting.”
exit 1
fi
fi

Turn checkout_dir relative (to checkoutBase).

CHECKOUT_DIR=basename $CHECKOUT_DIR

echo "Checking out squiz matrix core … "

Remember which directory we are in

mydir=pwd

Need to jump to the base dir to checkout to.

cd $checkoutBase
$CVS -q -d :pserver:$USER:@$SERVER:$CVS_PUBLIC_PATH/core co -P -r $VERSION -d $C HECKOUT_DIR mysource_matrix > /dev/null

if [ $? -gt 0 ]; then
echo “There was a problem checking out the matrix core”
echo “Make sure you have permissions to write to the ${checkoutBase}/${CHECK OUT_DIR}/ directory.”
cd $mydir
exit 1
fi

echo "Checking out squiz matrix packages … "

cd $CHECKOUT_DIR/packages/

these are done one by one because they are actually kept in separate repo’s.

for package in $PACKAGES; do
$CVS -q -d :pserver:$USER:@$SERVER:$CVS_PUBLIC_PATH/packages/$package co -P -r $VERSION $package > /dev/null
if [ $? -gt 0 ]; then
echo “There was a problem checking out the matrix package $packa ge”
echo “(Perhaps this package didn’t exist with $VERSION)”
fi
done

cd …/fudge/

we can check everything out at once here because they are all just directories .

$CVS -q -d :pserver:$USER:@$SERVER:$CVS_PUBLIC_PATH/fudge co -P -r $VERSION $FUD GE_PACKAGES > /dev/null
if [ $? -gt 0 ]; then
echo “There was a problem checking out the matrix ‘fudge’ $FUDGE_PACKAGE S”
echo “(Perhaps this package didn’t exist with $VERSION)”
fi

cd …

Generate a manifest file for automatic_upgrades

to work with.

find . -type f -not -path ./MANIFEST -a -not -path “/CVS/” -print0 | sort -z - k 2 | xargs -0 md5sum > ./MANIFEST
if [ $? -gt 0 ]; then
echo “There was a problem creating the manifest file.”
cd $mydir
exit 1
fi

Jump back to our original location.

cd $mydir

echo “”
echo “Everything has been checked out into the ${checkoutBase}/${CHECKOUT_DIR}/ folder.”
echo “For installation instructions, please visit”
echo “http://manuals.matrix.squizsuite.net/evaluate-squiz-matrix/manual-installa tion-guide/”
echo “”


(Nic Hubbard) #16

You just use the mv command:

mv checkout.sh\?view\=co checkout.sh

(Clementoke) #17

Hi Nic,

Just tried the curl again and got this

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="http://public-cvs.squiz.net/cgi-bin/viewvc.cgi/">here</a>.</p>
<hr>
<address>Apache Server at public-cvs.squiz.net Port 80</address>
</body></html>

(Nic Hubbard) #18

For the checkout script?


(Clementoke) #19

Looks like it. I then tried the new destination and got a long readout of versions etc but the "mv checkout.." didn't work


(Nic Hubbard) #20

I am not sure what you are doing wrong. I just tested grabbing the checkout script again and it works:

curl -O http://public-cvs.squiz.net/cgi-bin/viewvc.cgi/mysource_matrix/scripts/dev/checkout.sh?view=co

Can you explain exactly what step is not working for you?