Solved

Setting up postgresql to talk to Trac

Posted on 2013-11-05
2
525 Views
Last Modified: 2013-11-05
Hi all,

I'm installing Trac 1.0 on a new CentOS 6.4 server. I'm planning on using postgresql as the database backend.

General Trac Instructions are here:
http://trac.edgewall.org/wiki/TracInstall

Postgresql installation details for Trac are here:
http://trac.edgewall.org/wiki/DatabaseBackend#Postgresql

I've successfully installed postgresql, and I've done the initialization:

   service postgresql initdb
   chkconfig postgresql on
   service postgresql start

Now... I'm plenty experienced with MySQL but not postgresql. I need to create a database and a username/password which trac can use to connect. Trac is a python-based web application, it runs on Apache and will probably run under the "nobody" user.

Trac's instructions say
If you're using user trac without a password to connect through unix sockets to database trac and have only one project (hence no need for different schemas), your connections string would be postgres://trac:@/trac

That sounds pretty good, I want to set that up.

But I don't know how to administer a postgresql server, what the various commands are etc.

Can somebody give me the easy way out and tell me how to do this?
0
Comment
Question by:Frosty555
  • 2
2 Comments
 
LVL 31

Accepted Solution

by:
Frosty555 earned 0 total points
ID: 39625564
Solution ended up being this:

First, as the root user, sudo to the postgres user and run the "psql" command to get to the psql CLI:

su - postgres
psql

Open in new window

Once inside the psql CLI, set up the database and user:

CREATE USER trac PASSWORD 'thepassword';
CREATE DATABASE trac OWNER trac;
GRANT ALL ON DATABASE trac TO trac;
\q

Open in new window

Now edit the /var/lib/pgsql/data/pg_hba.conf file,  and change the authentication type for local connections from "ident" to "trust" by modifying the lines to read as follows:

local   all         all                               trust
host    all         all         127.0.0.1/32          trust

Open in new window


Now you can create the trac environment like this:

trac-admin /usr/share/trac/mytracproject initenv

Open in new window


And finally, when prompted for the database connection string:

postgres://trac:thepassword@/trac

Open in new window

0
 
LVL 31

Author Closing Comment

by:Frosty555
ID: 39625567
see above
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Shadow IT is coming out of the shadows as more businesses are choosing cloud-based applications. It is now a multi-cloud world for most organizations. Simultaneously, most businesses have yet to consolidate with one cloud provider or define an offic…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Steps to create a PostgreSQL RDS instance in the Amazon cloud. We will cover some of the default settings and show how to connect to the instance once it is up and running.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question