<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Arash Hemmat &#187; tutorial</title>
	<atom:link href="http://hemmat.net/blog/tag/tutorial/feed/" rel="self" type="application/rss+xml" />
	<link>http://hemmat.net/blog</link>
	<description>A web programmer</description>
	<lastBuildDate>Tue, 24 Jan 2012 20:36:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Installing Trac and Git on Debian lenny</title>
		<link>http://hemmat.net/blog/installing-trac-git-debian-lenny/</link>
		<comments>http://hemmat.net/blog/installing-trac-git-debian-lenny/#comments</comments>
		<pubDate>Mon, 23 Nov 2009 12:15:05 +0000</pubDate>
		<dc:creator>Arash Hemmat</dc:creator>
				<category><![CDATA[Tutorials for myself]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[lenny]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[squeeze]]></category>
		<category><![CDATA[trac]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[web server]]></category>

		<guid isPermaLink="false">http://hemmat.net/blog/?p=12</guid>
		<description><![CDATA[I couldn't find a good article so I decided to write one, this is a very quick howto for installing Trac with Git on Debian Lenny for myself!]]></description>
			<content:encoded><![CDATA[<p>I couldn&#8217;t find a good article so I decided to write one, this is a very quick howto for installing Trac with Git on Debian Lenny for myself!</p>
<p><strong>First things first</strong></p>
<p>First we should decide where to put our Trac files and Git repository, this is my fashion to put everything in /home directory so when i need a backup of my system all i have to do is to copy my /home directory.</p>
<p>Git repository files for the project test go here:</p>
<blockquote><p>/home/repositories/test/</p></blockquote>
<p>Trac files for project test go here:</p>
<blockquote><p>/home/tracs/test</p></blockquote>
<p><strong>Installing Trac and Git</strong></p>
<p>Thanks to apt magic installing Trac and Git is superb easy:</p>
<blockquote><p>apt-get install trac-git</p></blockquote>
<p><strong>Initialize Git repository</strong></p>
<p>We need  to initialize out  git repository first:</p>
<blockquote><p>cd /home/repositories/test</p>
<p>git init</p>
<p>git commit</p></blockquote>
<p>and it would be a good idea to add some files and folders before going to next step because trac-git plugin is not handling empty repositories very well.</p>
<p><strong>Initializing Trac enviroment</strong></p>
<blockquote><p>trac-admin /home/tracs/test initenv</p></blockquote>
<p>When asked for &#8220;Database connection string&#8221; just press Enter to use the default sqlite and when asked for &#8220;Repository type&#8221; type git and when asked for &#8220;Path to repository&#8221; enter the path like this &#8220;/home/repositories/test/.git&#8221; (Don&#8217;t forget to put the .git after the path)</p>
<p>Now we need to set the permissions:</p>
<blockquote><p>find /home/tracs/test -type f -exec chmod 660 {} \;</p>
<p>find /home/tracs/test -type d -exec chmod 2770 {} \;</p>
<p>chown -R root.www-data /home/repositories</p>
<p>chown -R root.www-data /home/tracs</p></blockquote>
<p><strong>Adding Users to Trac</strong></p>
<p>Let&#8217;s add an admin user to the Trac enviroment:</p>
<blockquote><p>htpasswd -c /home/tracs/test/.htpasswd admin</p></blockquote>
<p>You can add as many user as you want using this method.</p>
<p><strong>Setting the Virtual Host</strong></p>
<p>Now we will setup<strong> </strong>a virtual host like to be able to access trac from a sub domain like http://trac.example.com :</p>
<p>You&#8217;ll probably need to install and activate the apache python module if you don&#8217;t have it already:</p>
<blockquote><p>apt-get install libapache2-mod-python</p>
<p>a2enmod python</p></blockquote>
<p>Then we need to add the virtual host:</p>
<blockquote><p>vim /etc/apache2/sites-available/trac.example.com</p></blockquote>
<p>Now replace the example.com with your own domain name and paste the below lines into the newly created file:</p>
<blockquote><p>&lt;VirtualHost *:80&gt;<br />
ServerName  trac.example.com<br />
ServerAdmin webmaster@example.com</p>
<p># Note: This folder should exist, but will generally be empty<br />
DocumentRoot /home/tracs/test/htdocs<br />
&lt;Directory /home/tracs/test/htdocs&gt;<br />
Order allow,deny<br />
Allow from all<br />
&lt;/Directory&gt;</p>
<p># Host the main Trac instance at /<br />
&lt;Location /&gt;<br />
SetHandler mod_python<br />
PythonHandler trac.web.modpython_frontend<br />
PythonInterpreter main<br />
PythonOption TracEnv /home/tracs/test<br />
PythonOption TracUriRoot /<br />
SetEnv PYTHON_EGG_CACHE /tmp<br />
&lt;/Location&gt;</p>
<p># Host all others at /projects/$PROJECT<br />
&lt;Location /projects&gt;<br />
PythonOption TracEnv &#8220;&#8221;<br />
PythonOption TracEnvParentDir /home/tracs/<br />
&lt;/Location&gt;</p>
<p>&lt;Location /login&gt;<br />
AuthType Basic<br />
AuthName &#8220;Test&#8221;<br />
AuthUserFile /home/tracs/test/.htpasswd<br />
Require valid-user<br />
&lt;/Location&gt;</p>
<p>&lt;/VirtualHost&gt;</p></blockquote>
<p>It is time to restart the apache:</p>
<blockquote><p>/etc/init.d/apache2 restart</p></blockquote>
<p>That&#8217;s it! Point your browser to http://trac.example.com and you&#8217;ll see Trac and Git running painless.</p>
<p><strong>Troubleshooting</strong></p>
<p>If you get an error message like below or something like that you will need to make some changes to the trac.ini file.</p>
<blockquote><p>Warning: <em>Can&#8217;t synchronize with the repository (GIT backend not available</em>)</p></blockquote>
<p>Let&#8217;s open trac.ini and take a look:</p>
<blockquote><p>vim /home/tracs/example/conf/trac.ini</p></blockquote>
<p>First find these lines:</p>
<blockquote><p>[git]<br />
cached_repository = false<br />
git_bin = /usr/bin/git<br />
persistent_cache = false<br />
shortrev_len = 7</p></blockquote>
<p>Now replace &#8220;git_bin = git&#8221; with &#8220;git_bin = /usr/bin/git&#8221;</p>
<p>This should solve the problem, if it is not then continue reading!</p>
<p>Ok, if you are still getting error about git these are the posibilities:</p>
<ul>
<li>Make sure you did put the &#8220;/.git&#8221; after your repository path while initializing the trac enviroment, if not find &#8220;repository_dir&#8221; in trac.ini and fix it.</li>
<li>You may not set the permissions for your repository as described above, make sure www-data has permission to the repository</li>
<li>You may be working with an empty repository, if so add some files and commit.</li>
</ul>
<p>UPDATE 10-02-2010: If you still have problems you may read the comments you may find the solution there!</p>
]]></content:encoded>
			<wfw:commentRss>http://hemmat.net/blog/installing-trac-git-debian-lenny/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>

