Edgewall Software

Changes between Version 10 and Version 11 of PostgresqlRecipe


Ignore:
Timestamp:
Feb 22, 2015, 5:17:58 PM (9 years ago)
Author:
figaro
Comment:

Cosmetic changes

Legend:

Unmodified
Added
Removed
Modified
  • PostgresqlRecipe

    v10 v11  
    1 == Recipe Installing Trac with PostgreSQL on CentOS4.2 ==
    2 
    3 
    4 HOWTO:
    5 Install trac-0.9.4 on Centos4.2 (RH-ES4) with PostgreSQL-8.1.3 using psycopg2-2.
    6 
    7 You should refer to the trac documentation wiki for current details respecting installing trac at [wiki:TracInstall]. 
    8 
    9 The instructions that follow are more detailed but the details are likely to date swiftly.
     1= Recipe: Installing Trac with PostgreSQL on CentOS4.2
     2
     3This is a howto on installing Trac-0.9.4 on Centos-4.2 (RH-ES4) with PostgreSQL-8.1.3 using psycopg2-2.
     4
     5You 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.
    106
    117These 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.
     
    1391.  Verify that Python is installed and note the version;
    1410
    15 
    16 {{{
    17 #
     11{{{
    1812# rpm -qa python                # should report something like:
    1913python-2.3.4-14.1.
    20 #
    21 
    2214}}}
    2315
    24162.  You will require the swig-py bindings for trac.  These must be built from the subversion source distribution. Note that as of subversion-1.2 the swig sources themselves are not required to build the python bindings.
    2517
    26 
    27 {{{
    28 #
     18{{{
    2919# cd ~/software
    3020# curl http://subversion.tigris.org/downloads/subversion-1.3.0.tar.gz >  subversion-1.3.0.tar.gz
     
    3525# ./configure
    3626...
    37 
    38 }}}
    39 
    40 At this point, if you have a binary rpm of subversion >= 1.2 already installed then you just need to make the swig bindings for python. Otherwise, you need build and install subversion itself first.  We will
     27}}}
     28
     29At this point, if you have a binary rpm of subversion >= 1.2 already installed then you just need to make the swig bindings for python. Otherwise, you need build and install subversion itself first. We will
    4130not cover this eventuality here.
    4231
    43 
    44 {{{
    45 ...
     32{{{
    4633# <optional build and install of subversion>
    4734...
     
    5138}}}
    5239
    53 
    54403.  Verify that subversion is installed, configured, and running:
    55 
    5641
    5742{{{
     
    6348}}}
    6449
    65 
    66 
    67504.  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.
    6851
    69 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.
    70 
    71 
    72 {{{
    73 #
     525.  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{{{
    7455# cd ./software
    7556# curl curl http://initd.org/pub/software/psycopg/psycopg2-2.0b8.tar.gz > psycopg2-2.0b8.tar.gz
     
    7960# more INSTALL
    8061# python setup.py install
    81 #
    82 }}}
    83 
     62}}}
    8463
    85646.  Now get trac from [wiki:TracDownload]. Move to your working directory (cd ~/software) and download the trac distribution that you wish to use.
    8665
    87 
    88 {{{
    89 #
     66{{{
    9067# cd ~/software
    9168# curl http://ftp.edgewall.com/pub/trac/trac-0.9.4.tar.gz > trac-0.9.4.tar.gz
     
    9673}}}
    9774
    98 
    9975You will note in the INSTALL notes the requirements for the subversion swig-py bindings and clearsilver. As detailed above, the former must be built locally from the subversion source distribution while the second can be obtained as an rpm for Red Hat EL-4 from [http://dag.wieers.com/packages/clearsilver/]. If all of the prerequisites are met then install trac:
    10076 
    101 
    102 {{{
    103 ...
     77{{{
    10478# python ./setup.py install
    105 #
    106 
    10779}}}
    10880
    109817.  The utiltiy trac-admin is used to setup trac environments and to configure the environment thereafter.  On Centos4 the trac bindings are installed by default beneath "/usr/local/lib/svn-python" which must be added to the python load path.  This can be done through the environment variable PYTHONPATH:
    11082
    111 
    112 {{{
    113 #
     83{{{
    11484# export PYTHONPATH=/usr/local/lib/svn-python
    115 #
    116 }}}
    117 
    118 
    119 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:
    120 
    121 /usr/local/lib/svn-python
    122 
    123 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:
    124 
    125 
    126 {{{
    127 #
     85}}}
     86
     87and 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
     91and 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{{{
    12894# python
    12995Python 2.3.4 (#1, Feb 22 2005, 04:09:37)
     
    138104'/usr/lib/python2.3/site-packages/gtk-2.0']
    139105>>><ctrl>D
    140 #
    141 }}}
    142 
     106}}}
    143107
    144108Placing 'trac_svn.pth' in '/usr/lib/python2.3/site-packages' seems to me the best solution.
    145109
    146 
    147 {{{
    148 #
     110{{{
    149111# echo /usr/local/lib/svn-python > /usr/lib/python2.3/site-packages/trac_svn.pth
    150 #
    151112# cat /usr/lib/python2.3/site-packages/trac_svn.pth
    152113/usr/local/lib/svn-python
     
    164125'/usr/lib/python2.3/site-packages/gtk-2.0', '/usr/local/lib/svn-python']
    165126>>><ctrl>D
    166 #
    167 }}}
    168 
    169 
    170 We can see that /usr/local/lib/svn-python has been added to python's search path. The only thing to note is that a version upgrade of python will require that we move trac_svn.pth to the new site-packages directory.  Now trac-admin, apache and tracd should all find the necessary bindings and run without any further ado.
    171 
    172 8.  At this point everything is wired up and ready to go with tracd as the server and SQLite3 as the backend database.  You can create your first trac environment by issuing the following command:
    173 
    174 
    175 {{{
    176 #
     127}}}
     128
     129We can see that /usr/local/lib/svn-python has been added to python's search path. The only thing to note is that a version upgrade of python will require that we move trac_svn.pth to the new site-packages directory. Now trac-admin, apache and tracd should all find the necessary bindings and run without any further ado.
     130
     1318.  At this point everything is wired up and ready to go with tracd as the server and SQLite3 as the backend database. You can create your first trac environment by issuing the following command:
     132
     133{{{
    177134# trac-admin /path/to/trac_project_env initenv
    178 #
    179 }}}
    180 
     135}}}
    181136
    182137You must answer the questions regarding the database connection and subversion repository. To use a different DB backend you must first initialize the alternative database environment before runing "trac-admin /path/to/trac_project_env initenv". 
    183138
    184 9.  To use postgresql as the backend one must first setup a target database user and a database instance to pass to trac-admin when it asks for a connection string.  The postgresql command line utilities for this are createuser(1) and createdb(1).
    185 
    186 
    187 {{{
    188 #
     1399.  To use postgresql as the backend one must first setup a target database user and a database instance to pass to trac-admin when it asks for a connection string. The postgresql command line utilities for this are createuser(1) and createdb(1).
     140
     141{{{
    189142# createuser --username <postgres user with CREATEROLE permission> \
    190143#   --password --pwprompt --createdb --createrole --echo \
    191144#   <trac_DB_admin_user_name>
    192 #
    193 }}}
    194 
     145}}}
    195146
    196147Example:
    197148
    198 
    199 {{{
    200 #
     149{{{
    201150# createuser --username superuser --password --pwprompt --createdb --createrole --echo trac_db_admin
    202151Enter password for new role:
     
    207156CREATEROLE INHERIT LOGIN;
    208157CREATE ROLE
    209 #
    210 }}}
    211 
    212 
    213 The first set of password prompts are used to set the password for the new
    214 role being created. The second set is to authenticate the database connection.  Read the man(1) page for createuser for further information and options.
     158}}}
     159
     160The 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.
    215161
    216162''Debian Note''
     
    220166Next, create the database you wish to use using the new role just established:
    221167
    222 
    223 {{{
    224 #
     168{{{
    225169# createdb [--host localhost] --username <trac_DB_admin_user_name> --password \
    226170#   --owner <trac_DB_admin_user_name> --echo -E UTF8 <trac_DB_name>
    227 #
    228 }}}
    229 
     171}}}
    230172
    231173Example:
    232174
    233 
    234 {{{
    235 #
     175{{{
    236176# createdb --host localhost --username trac_db_admin --password --owner trac_db_admin --echo -E UTF8 trac_db
    237177Password:
    238178CREATE DATABASE trac_db OWNER trac_db_admin;
    239179CREATE DATABASE
    240 #
    241 }}}
    242 
     180}}}
    243181
    244182You 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.
     
    25219011.  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.
    253191
    254 
    255 {{{
    256 #
     192{{{
    257193# trac-admin /var/data/trac initenv
    258194Creating a new Trac environment at /var/data/trac
     
    356292  /var/data/trac/conf/trac.ini
    357293
    358 If you'd like to take this new project environment for a test drive,
    359 try running the Trac standalone web server `tracd`:
     294If you'd like to take this new project environment for a test drive, try running the Trac standalone web server `tracd`:
    360295
    361296# tracd --port 8000 /var/data/trac
    362297
    363 Then point your browser to http://localhost:8000/trac.
    364 There you can also browse the documentation for your installed
    365 version of Trac, including information on further setup (such as
    366 deploying Trac to a real web server).
    367 
    368 The latest documentation can also always be found on the project
    369 website:
     298Then point your browser to `http://localhost:8000/trac`. There you can also browse the documentation for your installed version of Trac, including information on further setup (such as deploying Trac to a real web server).
     299
     300The latest documentation can also always be found on the project website:
    370301
    371302  http://projects.edgewall.com/trac/
     
    375306}}}
    376307
    377 
    378 Trac is now installed and available.  You can test it out using tracd.
    379 
    380 #
     308Trac is now installed and available. You can test it out using tracd.
     309
     310{{{
    381311# tracd --port <port-number> /var/data/trac
    382 #
     312}}}
    383313
    384314Example:
    385315
    386 
    387 
    388 {{{
    389 #
     316{{{
    390317# tracd --port 3000 /var/data/trac
    391318brms-02.brockley.harte-lyne.ca - - [06/Mar/2006 14:13:10] "GET / HTTP/1.1"
     
    415342brms-02.brockley.harte-lyne.ca - - [06/Mar/2006 14:13:12] "GET
    416343/trac/chrome/common/extlink.gif HTTP/1.1" 200 -
    417 
    418 }}}
    419 
    420 Well, everything seems to work.
    421 
    422 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]
     344}}}
     345
     346Everything seems to work.
     347
     34812.  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]
    423349
    424350To find out more about trac-admin just run it:
    425351
    426 
    427 {{{
    428 #
     352{{{
    429353# trac-admin /var/data/trac
    430354Trac [/var/data/trac]> help
     
    432356}}}
    433357
    434 
    435358Or visit [wiki:TracAdmin]
    436359
    437360More advanced customization is accomplished by modifying or replacing the stylesheets in .trac/templates.
    438361
    439 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].
    440 
    441 This completes our broadcast day.  For information on configuring Apache to run trac see [wiki:TracModPython] or for my specific [wiki:TracApacheRecipe]. For alternative methods for installing on Red Hat type systems, particularly Fedora Core see [wiki:TracOnFedoraCore].
     36213.  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
     364This completes our broadcast day. For information on configuring Apache to run trac see [wiki:TracModPython] or for my specific [wiki:TracApacheRecipe]. For alternative methods for installing on Red Hat type systems, particularly Fedora Core see [wiki:TracOnFedoraCore].
    442365
    443366Regards,