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.



(Benjamin Pearson) #2

It should be virtually the same as Nic's guide on Debian: 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: 

(Clementoke) #4

Thanks guys,

That's Sunday night sorted.


(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.” (

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”. (

(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:

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

(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



You need to rename the script to

(Clementoke) #15

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


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

if [ “x$CVS” = “x” ]; then

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

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
exit 1


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

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.”
exit 1

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

Turn checkout_dir relative (to checkoutBase).


echo "Checking out squiz matrix core … "

Remember which directory we are in


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

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)”

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)”

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

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 “ tion-guide/”
echo “”

(Nic Hubbard) #16

You just use the mv command:


(Clementoke) #17

Hi Nic,

Just tried the curl again and got this

<title>302 Found</title>
<p>The document has moved <a href="">here</a>.</p>
<address>Apache Server at Port 80</address>

(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

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