Edgewall Software

Changes between Version 22 and Version 23 of Ubuntu-11.04-Subversion


Ignore:
Timestamp:
Oct 8, 2014, 6:47:44 AM (5 years ago)
Author:
icedwater@…
Comment:

Updated while following instructions for Ubuntu 14.04 64-bit. Apache portion still untested.

Legend:

Unmodified
Added
Removed
Modified
  • Ubuntu-11.04-Subversion

    v22 v23  
    11= Installing Trac with Subversion on Ubuntu =
    22
    3 The goal of this tutorial is to demostrate how to setup a Subversion <-> Trac enviroment on Ubuntu 10.04. A MySQL database and Subversion Python bindings are going to be used.
    4 Please note that only general instructions are provided, and it's asummed that you have basic knowledge on Linux administration.
     3The goal of this tutorial is to demonstrate how to setup a Subversion <-> Trac environment on Ubuntu 14.04. The original version of this document was written for 10.04, please see the History link for more details.
     4
     5A MySQL database and Subversion Python bindings are going to be used. Please note that only general instructions are provided, and it's assumed that you have basic knowledge on Linux administration.
    56
    67'''Note''': for a full installation tutorial on Trac, please read TracInstall
     
    3637== Configuring ==
    3738
    38 This part is maybe the most important section on this tutorial. You'll learn how to syncronize Trac and Subversion in order to be able to see on your Trac Project website what's going on in your repository and also how to automate some tasks.
    39 
    40 === Subversion ===
    41 
    42 ==== Creating the project ====
     39This part is maybe the most important section on this tutorial. You'll learn how to synchronize Trac and Subversion in order to be able to see on your Trac Project website what's going on in your repository and also how to automate some tasks.
     40
     41=== Creating the Subversion repository for the project ===
    4342
    4443You may already know how to do this, but let's make a review just in case.
     
    6968}}}
    7069
     70If you used the command above, you may choose to test that the process is running by issuing:
     71{{{
     72sudo lsof -i | grep svnserve
     73}}}
     74
     75This should show something like:
     76{{{
     77svnserve  13418     root    3u  IPv4 675323469      0t0  TCP *:svn (LISTEN)
     78}}}
     79
     80which means the process `svnserve` with PID `13418` was run by `root` and is listening on the `svn` port, which is by default 3690.
     81
     82Also, checking out revision 0 should be possible:
     83{{{
     84svn co svn://localhost/var/lib/svn/YourProject
     85}}}
     86The above command will create a directory with the name `YourProject` within your current directory.
     87
     88'''Note''': until users and authentication have been set up, committing will not be allowed.
     89
    7190=== Setup the MySQL database ===
    7291
     
    90109You can now exit the MySQL command line.
    91110
    92 === Trac ===
    93 
    94 ==== Initiate the enviroment
     111=== Initialise the Trac environment ===
    95112
    96113Let's create a directory to contain all the Trac project (just like we did for SVN projects).
     
    104121}}}
    105122
    106 As you did for Subversion, change the ownership of the project files to Apache's user www-data:
    107 {{{
    108 sudo chown -R www-data:www-data /var/lib/trac/YourProject
    109 }}}
    110 
    111 Use trac-admin to create the new project:
     123As you did for Subversion, change the ownership of the project files to Apache's user `www-data`:
     124{{{
     125sudo chown -R www-data /var/lib/trac/YourProject
     126}}}
     127
     128Use `trac-admin` to create the new project:
    112129{{{
    113130sudo trac-admin /var/lib/trac/YourProject initenv
    114131}}}
    115132
    116 Also you will need to fill in some information, like the project name. It will ask you for the MySQL connection string. Input the following (according to the way we did setup the MySQL database in the step 2.2).
     133This command starts a script that requests some information, like the project name and the MySQL connection string.
     134
     135The MySQL connection string should look like the following (according to the way we set up the MySQL database in step 2.2).
    117136{{{
    118137mysql://trac:yourpassword@localhost/trac
    119138}}}
    120139
    121 Pay attention to the question about the location of the Subversion project. Enter the path as discussed before:
     140Once this is done, you may check the setup by running `tracd`:
     141{{{
     142tracd --port=12345 /var/lib/trac/Apollo
     143}}}
     144
     145Your browser should show a basic trac install on `http://localhost:12345/Apollo`.
     146
     147==== Notes ====
     148You might run into an error when running `trac-admin initenv`, ending in:
     149{{{
     150AttributeError: 'NullTranslations' object has no attribute 'add'
     151}}}
     152
     153For me, making [http://trac.edgewall.org/ticket/10903#comment:5 this patch] in the listed file solved it.
     154
     155Pay attention to the question about the location of the Subversion project. This fills the variable `repository_dir` in `trac.ini`. Enter the path as discussed before:
    122156{{{
    123157/var/lib/svn/YourProject
    124158}}}
    125159
    126 If the MySQL default engine wasn't InnoDB, you might need to convert the tables tha trac-admin has just created. Issue the following within your MySQL client:
     160If the MySQL default engine wasn't InnoDB, you might need to convert the tables that `trac-admin` has just created. Issue the following within your MySQL client:
    127161{{{
    128162USE trac; \
     
    148182}}}
    149183
    150 ==== Explicit syncronization ====
    151 
    152 '''Note''': For more information about the Explicit Syncronization method, please read TracRepositoryAdmin#ExplicitSync
    153 
    154 First, edit the '''trac.ini''' file, located in ''/var/lib/trac/YourProject/conf/''. Modify the "repository_sync_per_request" directive and set it to an empty value.
    155 
    156 Now you need to create the Subversion hooks. First, create the post-commit hook the in ''/var/lib/svn/YourProject/hooks/'' directory, with the following content:
     184=== Explicit synchronization of trac and svn ===
     185
     186'''Note''': For more information about the Explicit Synchronization method, please read TracRepositoryAdmin#ExplicitSync
     187
     188First, edit the `trac.ini` file, located in `/var/lib/trac/YourProject/conf/`. Modify the `repository_sync_per_request` directive and set it to an empty value.
     189
     190Now you need to create the Subversion hooks. First, create the ''post-commit'' hook in the `/var/lib/svn/YourProject/hooks/` directory, with the following content:
    157191{{{
    158192#!/bin/sh
     
    161195}}}
    162196
    163 Make sure you give the script execution perms:
     197Make sure you give the script execution permissions:
    164198{{{
    165199sudo chmod +x /var/lib/svn/YourProject/hooks/post-commit
    166200}}}
    167201
    168 Another important hook script to have is post-revprop-change. The procedures are similiar as above, but the script is slightly different:
     202Another important hook script to have is ''post-revprop-change''. The procedures are similar, but the script is slightly different:
    169203{{{
    170204#!/bin/sh
     
    173207}}}
    174208
    175 Again, make sure you give exec perms to the script.
    176 
    177 Now Trac will be notified about changes you make to your repository and will make them availables in the timeline.
    178 
    179 
    180 === Apache ===
    181 
    182 ==== Set up Trac handling ====
     209Again, make sure you give exec permissions to the script.
     210
     211Now Trac will be notified about changes you make to your repository and will make them available in the timeline.
     212
     213=== Instructing Apache to handle Trac ===
     214
     215Create a new site for your Trac setup.
     216{{{
     217sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/trac.conf
     218}}}
    183219
    184220Apache needs to know how to handle Trac. Use the following block to set up Trac handling:
     
    192228}}}
    193229
    194 Note that it's pointing to the main Trac directory. It means it will expose all of your Trac projects. You may need to apply this configuration to Apache:
     230Note that it's pointing to the main Trac directory. It means it will expose all of your Trac projects. You may need to apply this configuration to Apache, then reload the server:
    195231{{{
    196232sudo a2ensite trac
     233sudo service apache2 reload
    197234}}}
    198235
    199236==== Authentication ====
    200237
    201 In order to allow users to log in Trac, you will need the following section in your Apache configuration:
     238Make sure that the `apache2-utils` package is installed to use `htpasswd`.
     239
     240In order to allow users to log in to Trac, you will need the following section in your Apache configuration:
    202241{{{
    203242<LocationMatch "/projects/[^/]+/login">
     
    209248}}}
    210249
    211 You should now create the .htpasswd file, with an admin user:
     250You should now create the `.htpasswd` file, with an admin user:
    212251{{{
    213252sudo htpasswd -c .htpasswd admin
     
    216255Go ahead and restart Apache:
    217256{{{
    218 sudo /etc/init.d/apache2 restart
     257sudo service apache2 restart
    219258}}}
    220259
     
    224263}}}
    225264
    226 == Automatic reference to the SVN changesets in Trac tickets ==
    227 
    228 Something useful is to reference tickets on your commits. That way you can keep a better track of them and also easly access them from the timeline.
    229 
    230 Make sure you have the following line in your trac.ini configuration file:
     265=== Automatic reference to the SVN changesets in Trac tickets ===
     266
     267Something useful is to reference tickets on your commits. That way you can keep a better track of them and also easily access them from the timeline.
     268
     269Make sure you have the following lines in your `trac.ini` configuration file:
    231270{{{
    232271[components]