1 | | = Recipe: Installing Trac with PostgreSQL on CentOS4.2 |
2 | | |
3 | | This is a howto on installing Trac-0.9.4 on Centos-4.2 (RH-ES4) with PostgreSQL-8.1.3 using psycopg2-2. |
4 | | |
5 | | You should refer to the Trac documentation wiki at [wiki:TracInstall]. The instructions that follow are more detailed but the details are likely to date swiftly. |
6 | | |
7 | | These instructions assume that you have superuser access to both the operating system and postgresql as required. If this is not the case then some of these activities must be performed on your behalf by a user with those privileges. I do not attempt to systematically identify those tasks that require superuser capability. |
8 | | |
9 | | 1. Verify that Python is installed and note the version; |
10 | | |
11 | | {{{ |
| 1 | = Recipe: Installing Trac with PostgreSQL on CentOS-4.2 |
| 2 | |
| 3 | This is a how-to on installing Trac-0.9.4 on Centos-4.2 (RH-ES4) with PostgreSQL-8.1.3 using psycopg2-2. |
| 4 | |
| 5 | You should refer to the Trac documentation wiki at [wiki:TracInstall]. The instructions that follow are more specific to the given setup. |
| 6 | |
| 7 | These instructions assume that you have superuser access to both the operating system and Postgresql as required. If this is not the case, then some of these activities must be performed on your behalf by a user with those privileges. |
| 8 | |
| 9 | 1. Verify that Python is installed and note the version: |
| 10 | |
| 11 | {{{ |
50 | | 4. Obtain a postgresql adaptor for python. This HOWTO employs psycopg2 which is obtained from [http://initd.org/pub/software/psycopg]/. Other possibilites are psycopg1 and pyPgSQL. Google is your friend here. |
51 | | |
52 | | 5. Using curl, ftp or wget from the command line, or http from your web-browser, download the adaptor source into a working directory on the target machine, expand the archives, build and install the adaptor. |
53 | | |
54 | | {{{ |
| 49 | 4. Obtain a Postgresql adaptor for Python. This how-to employs psycopg2 which is obtained from [http://initd.org/pub/software/psycopg]/. Other possibilities are psycopg1 and pyPgSQL. |
| 50 | |
| 51 | 5. Using curl, ftp or wget from the command line, or http from your web-browser, download the adaptor source into a working directory on the target machine, expand the archives, build and install the adaptor: |
| 52 | |
| 53 | {{{ |
87 | | and adding a similar Apache httpd.conf `SetEnv` directive inside the relevent location. Alternatively, one can create a file called trac_svn.pth containing a single line: |
88 | | |
89 | | `/usr/local/lib/svn-python` |
90 | | |
91 | | and place this somewhere in python's default load path. The file name is not important, but the .pth extension is. You can determine the default path thus: |
92 | | |
93 | | {{{ |
| 86 | and adding a similar Apache httpd.conf `SetEnv` directive inside the relevant location. Alternatively, one can create a file called trac_svn.pth containing a single line: |
| 87 | |
| 88 | `/usr/local/lib/svn-python` |
| 89 | |
| 90 | and place this somewhere in Python's default load path. The file name is not important, but the .pth extension is. You can determine the default path thus: |
| 91 | |
| 92 | {{{ |
160 | | The first set of password prompts are used to set the password for the new role being created. The second set is to authenticate the database connection. Read the man(1) page for createuser for further information and options. |
161 | | |
162 | | ''Debian Note'' |
163 | | |
164 | | Please, note that a typical postgres authentication setup assumes that you connect to postgres database via the 'postgres' system user account for the first time using UNIX domain socket (the default) - see /etc/postgresql/8.x/main/pg_hba.conf |
165 | | |
166 | | Next, create the database you wish to use using the new role just established: |
167 | | |
168 | | {{{ |
| 159 | The first set of password prompts are used to set the password for the new role being created. The second set is to authenticate the database connection. Read the man(1) page for createuser for further information and options. |
| 160 | |
| 161 | '''Debian note''': A typical postgresql authentication setup assumes that you connect to the postgresql database via the 'postgres' system user account for the first time using UNIX domain socket (the default) - see /etc/postgresql/8.x/main/pg_hba.conf |
| 162 | |
| 163 | Next, create the database you wish to use using the new role just established: |
| 164 | |
| 165 | {{{ |
182 | | You have to provide the connection password again as above, but this time you use the password for trac_db_admin since this was used to establish the connection. You can of course use any established postgresql user/role that has CREATEDB priviliges instead. |
183 | | |
184 | | ''Debian Note'' |
185 | | |
186 | | Note the ''--host'' option - since 'trac_db_admin' is only a postgres database role it doesn't have a real system user counter part. Thus, you may not be able to connect via a Unix domain socket and have to use IPv4/6 socket (specified via --host). See the ''pga_hba.conf'' of your postgres configuration for details. |
187 | | |
188 | | 10. With trac and postgresql all set up you must now determine the absolute path to the subversion repostor(y/ies) that you wish to use with trac. This is a manual task. A typical repository path might look like "/var/data/svn" or "/var/svn". |
189 | | |
190 | | 11. With the information obtained above, the postgresql database name, the path to the trac directory, and the path to the subversion repository, we now invoke trac-admin to create the environment. |
191 | | |
192 | | {{{ |
| 179 | You have to provide the connection password again as above, but this time you use the password for trac_db_admin, since this was used to establish the connection. You can of course use any established postgresql user/role that has CREATEDB privileges instead. |
| 180 | |
| 181 | '''Debian note''' : Note the ''--host'' option - since 'trac_db_admin' is only a postgresql database role it doesn't have a real system user counter part. Thus, you may not be able to connect via a Unix domain socket and have to use IPv4/6 socket (specified via --host). See the ''pga_hba.conf'' of your postgres configuration for details. |
| 182 | |
| 183 | 10. With Trac and Postgresql all set up you must now determine the absolute path to the subversion repostor(y/ies) that you wish to use with Trac. This is a manual task. A typical repository path might look like "/var/data/svn" or "/var/svn". |
| 184 | |
| 185 | 11. With the information obtained above, the postgresql database name, the path to the Trac directory, and the path to the subversion repository, we now invoke trac-admin to create the environment. |
| 186 | |
| 187 | {{{ |
346 | | Everything seems to work. |
347 | | |
348 | | 12. You will now need to customize your trac installation to suite your project needs. Configuration is carried out through both the trac-admin command line interface (adding and removing trac users, adding, changing or removing priority and severity codes, adding and removing milestones, etc.) and by directly editing the .trac/conf/trac.ini file (setting email and default values for the web interface). See [wiki:TracIni] |
349 | | |
350 | | To find out more about trac-admin just run it: |
351 | | |
352 | | {{{ |
| 341 | Everything seems to work. |
| 342 | |
| 343 | 12. You will now need to customize your Trac installation to suit your project needs. Configuration is carried out through both the trac-admin command line interface (adding and removing trac users, adding, changing or removing priority and severity codes, adding and removing milestones, etc.) and by directly editing the .trac/conf/trac.ini file (setting email and default values for the web interface). See [wiki:TracIni]. |
| 344 | |
| 345 | To find out more about trac-admin just run it: |
| 346 | |
| 347 | {{{ |
358 | | Or visit [wiki:TracAdmin] |
359 | | |
360 | | More advanced customization is accomplished by modifying or replacing the stylesheets in .trac/templates. |
361 | | |
362 | | 13. You WILL, at some point, wish to use trac plugins. To employ plugins you must install or upgrade setuptools for python. The easiest way to do this is to obtain ez_setup.py from [http://peak.telecommunity.com/DevCenter/setuptools] and run it as root "#python ez_setup.py". You can get more information about plugins for trac at [wiki:TracPlugins]. |
363 | | |
364 | | This completes our broadcast day. For information on configuring Apache to run trac see TracModPython. For alternative methods for installing on Red Hat type systems, particularly Fedora Core see [wiki:TracOnFedoraCore]. |
365 | | |
366 | | Regards, |
367 | | Jim |
368 | | |
369 | | *** e-mail is NOT a secure channel *** |
370 | | James B. Byrne mailto:ByrneJB.<token>@Harte-Lyne.ca |
371 | | Harte & Lyne Limited http://www.harte-lyne.ca |
372 | | 9 Brockley Drive vox: +1 905 561 1241 |
373 | | Hamilton, Ontario fax: +1 905 561 0757 |
374 | | Canada L8E 3CE |
| 353 | Or visit [wiki:TracAdmin]. |
| 354 | |
| 355 | More advanced customization is accomplished by modifying or replacing the stylesheets in .trac/templates. |
| 356 | |
| 357 | 13. You will at some point wish to use Trac plugins. To employ plugins you must install or upgrade setuptools for Python. The easiest way to do this is to obtain ez_setup.py from [http://peak.telecommunity.com/DevCenter/setuptools] and run it as root "#python ez_setup.py". You can get more information about plugins for Trac at [wiki:TracPlugins]. |
| 358 | |
| 359 | For information on configuring Apache to run Trac see TracModPython. For alternative methods for installing on Red Hat type systems, particularly Fedora Core see [wiki:TracOnFedoraCore]. |
| 360 | |
| 361 | |
| 362 | * James B. Byrne mailto:ByrneJB.<token>@Harte-Lyne.ca |
| 363 | * Harte & Lyne Limited http://www.harte-lyne.ca |
| 364 | * 9 Brockley Drive vox: +1 905 561 1241 |
| 365 | * Hamilton, Ontario fax: +1 905 561 0757 |
| 366 | * Canada L8E 3CE |