Note
I have tried out this setup on Feisty Fawn, Gutsy Gibbon and the new Hardy Heron, all 64 bit versions. On 32 bit Im sure all this works as well, but there is one part to ignore, a bug fix when installing trac.
Well lets start off by installing apache and svn:
sudo apt-get install apache2.2-common libapache2-svn subversion
Now lets create a svn project, I'm going to create a directory in '/usr/local/' to store all svn projects. It's just a personal preference, nothing set in stone :)
sudo mkdir /usr /local/svn
I'm going to create a project called bingBong, so create a sub-directory of this new directory:
sudo mkdir /usr/local/svn/bingBong
Now to create the actually svn project files:
sudo svnadmin create /usr /local/svn/bingBong
Ownership of the directory and files needs to be changed to allow apache to access them:
sudo chown -R www-data /usr/local/svn/bingBong
I'm going to assume here you want all access to this svn repository to be encrypted by ssl, if not ... well just remove all ssl references or ask how. To setup openssl with apache look at my openssl + apache guide, and moving on....
Next we edit the file '/etc/apache2/mods-available/dav_svn.conf' , append to the bottom of the file:
<location /svn/bingBong>
DAV svn
SVNPath /usr/local/svn/bingBong
AuthType Basic
AuthName "Bing Bong Subversion Repository"
AuthUserFile /etc/apache2/conf.d/.bingBong.passwd
Require valid-user
SSLRequireSSL
</location>
Create a file called '.bingBong.passwd' in '/etc/apache2/conf.d/' , then run the command with username USER to create the ht password:
sudo htpasswd /etc/apache2/conf.d/.bingBong.passwd USER
You will be prompted to enter a password and then confirm passowrd. This will create a line in that file containing that username and password for a user to access the bingBong svn repository. There are many other ways to authenticate users for svn, all a quick google search away (hint hint). Running this command a second time with a different user name will just append another username and password to the file.
Restart apache:
sudo apache2ctl restart
Now to populate the svn repository with some base directories:
svn mkdir https://localhost/svn/bingBong/repo -m "new project"
svn mkdir https://localhost/svn/bingBong/repo/trunk -m "trunk"
svn mkdir https://localhost/svn/bingBong/repo/branches -m "branches"
svn mkdir https://localhost/svn/bingBong/repo/tags -m "tags"
And now point your browser to https://localhost/svn/bingBong,and you should be prompted with a login. Using the username and password you set earlier with the htpasswd command, you should see the svn repository.
And now that is svn completed. Start next part with installing trac:
sudo apt-get install trac
Similar as with svn, (and just a personal preference), I created a directory in '/usr/local/' to store all my trac project files:
sudo mkdir /usr/local/trac
And then I created a sub-directory of this new directory for our test project bingBong
sudo mkdir /usr/local/trac/bingBong
To create the trac files for this project run:
sudo trac-admin /usr/local/trac/bingBong initenv
You will be asked for a number of inputs on certain variables:
* Project Name [My Project]> Bing Bong
* Database connection string [sqlite:db/trac.db]>
* Repository type [svn]>
* Path to repository [/path/to/repos]> /usr/local/svn/bingBong
* Templates directory [/usr/share/trac/templates]>
Ownership of the directory and files needs to be changed to allow apache to access them:
sudo chown -Rf www-data:www-data /usr/local/trac/bingBong
It was here I ran into a bug with trac, and after a bit of searching discovered it was 64-bit ubuntu related. Its a little bit tricky but very do-able and I have it documented in the ubuntu-64bit clearsilver python fix post.
After applying the fix you can run:
sudo tracd --port 8000 /usr/local/trac/bingBong
You can use this to view your project in trac on you browser at:http://localhost:8000/bingBong
Now to get on with the apache configuration for trac, create a new file called 'tracSites' in '/etc/apache2/sites-available/' , and give it the following content:
###########################
##General Trac
<Directory /usr/share/trac/cgi-bin/ >
Options Indexes FollowSymLinks MultiViews ExecCGI
AllowOverride All
Order allow,deny
Allow from all
DirectoryIndex trac.cgi
</Directory >
<Directory /usr/share/trac/htdocs >
Order allow,deny
Allow from all
</Directory>
##########################
###Bing Bong trac
Alias /trac/bingBong/trac "/usr/share/trac/htdocs/"
Alias /trac/bingBong "/usr/share/trac/cgi-bin/"
<Location "/trac/bingBong">
SSLRequireSSL
DirectoryIndex trac.cgi
SetEnv TRAC_ENV "/usr/local/trac/bingBong"
</Location>
<Location /trac/bingBong/trac.cgi/login>
AuthType Basic
AuthName "Bing Bong Trac"
AuthUserFile /etc/apache2/conf.d/.bingBong.passwd
Require valid-user
</Location>
AddHandler cgi-script .cgi
Restart apache again, but first make a link for the new file you created (if this confuses you, just accept it, its the way the current apache configuration is setup):
sudo ln -s /etc/apache2/sites-available/tracSites /etc/apache2/sites-enabled/
sudo apache2ctl restart
And now you should be able to view the Bing Bong project in trac in a browser at:https://localhost/trac/bingBong
If you want to checkout this project or start adding code to it, I have examples shown using eclispe and some java code in my post on Eclipse and SVN
Thursday, April 3, 2008
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment