Edgewall Software

Changes between Initial Version and Version 1 of TracOnRhel4WithoutYum


Ignore:
Timestamp:
Sep 28, 2006, 2:27:53 PM (18 years ago)
Author:
jon@…
Comment:

My personal experiences with installing Trac on Redhat Enterprise Linux (version 4) without Yum.

Legend:

Unmodified
Added
Removed
Modified
  • TracOnRhel4WithoutYum

    v1 v1  
     1= Trac on Red Hat Enterprise Linux 4 WITHOUT using YUM=
     2
     3Because of the environment I'm setting up my Trac, I had no external internet access, barring an SFTP pipe.
     4
     5Here's what I did.
     6
     7== Installing Files ==
     8
     9 * Install the standard RHEL 4 system, with the Web Server functionality. I needed it for the rest of the sites I was putting together.
     10 * Install Subversion, mod_dav_svn and Python (if you've not already installed them - I wasn't making notes at this point!)
     11 * Install the following packages (and I know it's overkill, but I wanted to be sure I had everything I needed). These were all on the RH disks.
     12   * libdbi-dbd-pgsql
     13   * perl-DBD-Pg
     14   * php-pgsql
     15   * postgresql
     16   * postgresql-contrib
     17   * postgresql-docs
     18   * postgresql-libs
     19   * postgresql-perl
     20   * postgresql-pl
     21   * postgresql-python
     22   * postgresql-server
     23 * Download and install pyPgSql - I think this was on Sourceforge.
     24 * Download and install ClearSilver - I didn't do this bit, a collegue did.
     25 * Download and install trac from this site
     26
     27== Creating your Paths ==
     28
     29{{{
     30mkdir /var/www/auth
     31mkdir /var/svn
     32mkdir /var/svn/repo
     33mkdir /var/svn/trac
     34}}}
     35
     36== Creating your groups and users ==
     37
     38Obviously, if you already have your users, you don't need to do this part.
     39
     40{{{
     41groupadd MyRepo_Access
     42}}}
     43
     44This is the group to which all users who can access your Repo should belong, for SVN+SSH protocol, or just SVN.`
     45
     46{{{
     47useradd Fred_Bloggs -G MyRepo_Access
     48passwd Fred_Bloggs
     49}}}
     50
     51At this point, create a password for the user Fred_Bloggs - I'll use Fred_Bloggs_Password for the purposes of this document
     52
     53== Creating the Support Files for Subversion ==
     54
     55{{{
     56svnadmin create /var/svn/repo/MyRepo
     57chown -R apache.MyRepo_Access /var/svn/repo/MyRepo
     58chmod -R g+rw /var/svn/repo/MyRepo
     59chmod -R g+s /var/svn/repo/MyRepo
     60# This means all the files will have the effective permissions of "group" as "owner" - I think!
     61}}}
     62
     63== Creating the Support Structure for Postgres ==
     64
     65{{{
     66# At this point - assign a password to the user MyRepo - I'll use MyRepoPassword for this document
     67su - postgres -c 'createuser  -E -P -A -D  MyRepoUser'
     68}}}
     69
     70These switches mean:
     71
     72 * -E = Encrypt password
     73 * -P = Assign a password
     74 * -A = Not an admin (and can't create users)
     75 * -D = Can't create other databases
     76
     77{{{
     78su - postgres -c 'createdb MyRepoDB'
     79}}}
     80
     81By keeping this all the same, it's a security hole, but easier to remember. Adjust according to your local policies!
     82
     83The default install of postgres does not allow you to connect to the server using TCP/IP Sockets. You'll need to adjust the following files:
     84
     85 * /var/lib/pgsql/data/pg_hba.conf
     86
     87{{{
     88host all all 127.0.0.1 255.255.255.255 md5
     89local all all md5
     90}}}
     91
     92 * /etc/init.d/postgres
     93
     94Find the line
     95
     96{{{
     97$SU -l postgres -c "$PGENGINE/postmaster -p ${PGPORT} -D '${PGDATA}' ${PGOPTS} &" >> $PGLOG 2>&1 < /dev/null
     98}}}
     99
     100Replace it with
     101{{{
     102$SU -l postgres -c "$PGENGINE/postmaster -i -p ${PGPORT} -D '${PGDATA}' ${PGOPTS} &" >> $PGLOG 2>&1 < /dev/null
     103}}}
     104
     105(Note the additional -i which allows "Internet" traffic - I think. This was the main blocker for me.)
     106
     107== Create your Trac ==
     108
     109trac-admin will not create a repository if the path already exists (although I have seen a patch which changes this statement), so the first line in the following statements will remove the folder if you've already tried to make something there.
     110
     111{{{
     112rm -Rf /var/svn/trac/MyRepo
     113trac-admin /var/svn/trac/MyRepo initenv "My Trac Project" postgres://MyRepoUser:MyRepoPassword@localhost/MyRepoDB svn /var/svn/repo/MyRepo /usr/share/trac/templates
     114}}}
     115
     116System user accounts are not the same as the user accounts for your site. If you've got users who you want to be able to use only specific functions on trac, then use this command
     117
     118{{{
     119htpasswd -nb Site_Username Site_Password >> /var/www/auth/MyRepo.htpasswd
     120}}}
     121
     122== Setup Apache ==
     123
     124The default install path for the trac CGI files are in /usr/share/trac/cgi-bin. These need to be copied to the relevant path for your Trac install, and renamed (if you've got multiple Trac installations.)
     125
     126{{{
     127cp /usr/share/trac/cgi-bin/trac.*cgi /var/www/cgi-bin
     128mv /var/www/cgi-bin/trac.fcgi /var/www/cgi-bin/MyRepo.fcgi
     129mv /var/www/cgi-bin/trac.cgi /var/www/cgi-bin/MyRepo.cgi
     130}}}
     131
     132I don't actually know what the benefits of FCGI over CGI are, so I've made configs for them both. Create a file in /etc/httpd.d/conf.d/Trac_MyRepo.conf
     133
     134{{{
     135<LocationMatch /cgi-bin/MyRepo\.f?cgi>
     136    SetEnv TRAC_ENV /var/svn/trac/MyRepo
     137</LocationMatch>
     138<LocationMatch /cgi-bin/MyRepo\.f?cgi/login>
     139    # Remove the # sign below to require SSL.
     140    # SSLRequireSSL
     141
     142    AuthType Basic
     143    AuthName "MyRepo Trac Login"
     144    AuthUserFile /var/www/auth/MyRepo.htpasswd
     145    Require valid-user
     146</LocationMatch>
     147<IfModule mod_python.c>
     148        <Location /cgi-bin/MyRepo.cgi>
     149            SetHandler mod_python
     150            PythonHandler trac.web.modpython_frontend
     151            PythonOption TracEnv /var/svn/trac/MyRepo
     152        </Location>
     153        <Location /cgi-bin/MyRepo.cgi/login>
     154          # Remove the # sign below to require SSL.
     155          # SSLRequireSSL
     156
     157          AuthType Basic
     158          AuthName "MyRepo Trac Login"
     159          AuthUserFile /var/www/auth/MyRepo.htpasswd
     160          Require valid-user
     161        </Location>
     162</IfModule>
     163}}}
     164
     165Finally, restart your HTTPD service with
     166
     167{{{
     168service httpd restart
     169}}}