Sucess: svn + apache2 + SSL + ubuntu 7.10/8.04 + users + part 2: trac
Posted by linuxhappy on January 21, 2008
—————-
UPDATE: 6/22/08
I tried using these instructions on Ubuntu 8.04 and everything still works. I’m not sure why someone commented saying that the instructions don’t work.. I’m curious.
———————
Wow, This was super easy to get going:
The link over on the trac website is pretty spot on, but I had to modify it a little bit.. Credits:
http://trac.edgewall.org/wiki/TracOnUbuntu
This is a continuation of my previous post. This post definitely depends on the last one, so if you haven’t checked it out, go for it.
Install trac
sudo apt-get install trac
Make a directory for trac to live in
sudo mkdir /var/lib/trac sudo chown www-data:www-data /var/lib/trac
Setup Apache2:
cd /etc/apache2/sites-available/ sudo touch trac sudo gedit trac
Enter, or copy the following stuff in (be careful with the ServerName): (modified on march 2nd to make sure the ssl is enabled)
<VirtualHost *:443>
ServerAdmin webmaster@localhost
ServerName monkfish
DocumentRoot /usr/share/trac/cgi-bin/
<Directory /usr/share/trac/cgi-bin/>
Options Indexes FollowSymLinks MultiViews ExecCGI
AllowOverride All
Order allow,deny
allow from all
</Directory>
Alias /trac "/usr/share/trac/htdocs"
<Location /trac.cgi>
SetEnv TRAC_ENV "/var/lib/trac"
</Location>
<Location "/">
AuthType Basic
AuthName "Trac"
AuthUserFile /etc/apache2/dav_svn.passwd
Require valid-user
</Location>
DirectoryIndex trac.cgi
ErrorLog /var/log/apache2/error.trac.log
CustomLog /var/log/apache2/access.trac.log combined
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.pem
SSLProtocol all
SSLCipherSuite HIGH:MEDIUM
</VirtualHost>
Modify /etc/apache2/apache2.conf to have the following line(s):
# To use CGI scripts outside /cgi-bin/: # AddHandler cgi-script .cgi
Disable the default virtual host, enable trac and restart apache2
sudo a2dissite default sudo a2ensite trac sudo /etc/init.d/apache2 restart
Since we have already setup a svn repository in /var/lib/svn, we can just go ahead and continue to use trac-admin
sudo trac-admin /var/lib/trac initenv This will basically ask you a bunch of questions... here's how I filled mine out: jwoo@monkfish:/var/lib/trac$ sudo trac-admin /var/lib/trac initenv Creating a new Trac environment at /var/lib/trac Trac will first ask a few questions about your environment in order to initalize and prepare the project database. Please enter the name of your project. This name will be used in page titles and descriptions. Project Name [My Project]> linuxhappy Please specify the connection string for the database to use. By default, a local SQLite database is created in the environment directory. It is also possible to use an already existing PostgreSQL database (check the Trac documentation for the exact connection string syntax). Database connection string [sqlite:db/trac.db]> Please specify the type of version control system, By default, it will be svn. If you don't want to use Trac with version control integration, choose the default here and don't specify a repository directory. in the next question. Repository type [svn]> Please specify the absolute path to the version control repository, or leave it blank to use Trac without a repository. You can also set the repository location later. Path to repository [/path/to/repos]> /var/lib/svn Please enter location of Trac page templates. Default is the location of the site-wide templates installed with Trac. Templates directory [/usr/share/trac/templates]> Creating and Initializing Project Installing default wiki pages /usr/share/trac/wiki-default/TracChangeset => TracChangeset /usr/share/trac/wiki-default/TracStandalone => TracStandalone /usr/share/trac/wiki-default/TracSearch => TracSearch /usr/share/trac/wiki-default/CamelCase => CamelCase /usr/share/trac/wiki-default/TracPlugins => TracPlugins /usr/share/trac/wiki-default/RecentChanges => RecentChanges /usr/share/trac/wiki-default/WikiRestructuredText => WikiRestructuredText /usr/share/trac/wiki-default/TracTickets => TracTickets /usr/share/trac/wiki-default/InterWiki => InterWiki /usr/share/trac/wiki-default/WikiPageNames => WikiPageNames /usr/share/trac/wiki-default/TracUnicode => TracUnicode /usr/share/trac/wiki-default/WikiNewPage => WikiNewPage /usr/share/trac/wiki-default/WikiProcessors => WikiProcessors /usr/share/trac/wiki-default/TracLinks => TracLinks /usr/share/trac/wiki-default/WikiMacros => WikiMacros /usr/share/trac/wiki-default/TracUpgrade => TracUpgrade /usr/share/trac/wiki-default/TracQuery => TracQuery /usr/share/trac/wiki-default/WikiStart => WikiStart /usr/share/trac/wiki-default/TracRoadmap => TracRoadmap /usr/share/trac/wiki-default/TracLogging => TracLogging /usr/share/trac/wiki-default/TracAdmin => TracAdmin /usr/share/trac/wiki-default/TracBackup => TracBackup /usr/share/trac/wiki-default/TracFastCgi => TracFastCgi /usr/share/trac/wiki-default/WikiHtml => WikiHtml /usr/share/trac/wiki-default/TracRss => TracRss /usr/share/trac/wiki-default/TracAccessibility => TracAccessibility /usr/share/trac/wiki-default/InterMapTxt => InterMapTxt /usr/share/trac/wiki-default/WikiRestructuredTextLinks => WikiRestructuredTextLinks /usr/share/trac/wiki-default/TracInterfaceCustomization => TracInterfaceCustomization /usr/share/trac/wiki-default/TracTimeline => TracTimeline /usr/share/trac/wiki-default/TracPermissions => TracPermissions /usr/share/trac/wiki-default/TracEnvironment => TracEnvironment /usr/share/trac/wiki-default/TracReports => TracReports /usr/share/trac/wiki-default/TracRevisionLog => TracRevisionLog /usr/share/trac/wiki-default/TracTicketsCustomFields => TracTicketsCustomFields /usr/share/trac/wiki-default/WikiFormatting => WikiFormatting /usr/share/trac/wiki-default/TracGuide => TracGuide /usr/share/trac/wiki-default/TracIni => TracIni /usr/share/trac/wiki-default/TracModPython => TracModPython /usr/share/trac/wiki-default/TracSyntaxColoring => TracSyntaxColoring /usr/share/trac/wiki-default/TracCgi => TracCgi /usr/share/trac/wiki-default/TracBrowser => TracBrowser /usr/share/trac/wiki-default/SandBox => SandBox /usr/share/trac/wiki-default/TracSupport => TracSupport /usr/share/trac/wiki-default/InterTrac => InterTrac /usr/share/trac/wiki-default/TitleIndex => TitleIndex /usr/share/trac/wiki-default/TracWiki => TracWiki /usr/share/trac/wiki-default/TracInstall => TracInstall /usr/share/trac/wiki-default/TracImport => TracImport /usr/share/trac/wiki-default/WikiDeletePage => WikiDeletePage /usr/share/trac/wiki-default/TracNotification => TracNotification Indexing repository --------------------------------------------------------------------- Project environment for 'linuxhappy' created. You may now configure the environment by editing the file: /var/lib/trac/conf/trac.ini If you'd like to take this new project environment for a test drive, try running the Trac standalone web server `tracd`: tracd --port 8000 /var/lib/trac Then 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). The latest documentation can also always be found on the project website: http://trac.edgewall.org/ Congratulations!
Since we ran that as sudo, we’ll need to change some permissions:
cd /var/lib sudo chown www-data:www-data trac/ -Rf sudo /etc/init.d/apache2 restart
At this point you should be home free and be able to visit https://yoursite/ and login with the same users as were setup with the svn (setup in the previous post).
Once logging in, you should see the trac homepage.
This worked fine and dandy for me!
Noah said
As with the page these came from, these instructions are dated and incorrect. DO NOT FOLLOW THIS GUIDE. Please read the official Trac installation guide starting at trac.edgewall.org.
Tanha said
Hi.
Thanks for the nice howto …
I did everything you mentioned step by step, and everything works well,
BUT
I am not able to use anymore localhost, to view my PHP files on apache2 server.
What should I do?
Regards,
linuxhappy said
Tanha–
In the tutorial above, I use the command “sudo a2dissite default” to disable to the default website. You were probably using the “default” website for hosting your PHP webpages over http (not https).
There’s a good chance you want this functionality back — in that you DON’T want your php files under a secure website (https), and you just want to do http://127.0.0.1/mypage.php.
So assuming everything I have said so far is exactly right, you could try enabling this site again:
sudo a2ensite default
sudo /etc/init.d/apache2 restart
Hope this helps, let me know if it doesn’t.
Senthil said
Hi,
My Trac environment is not installing on the default templete as you mentioned.
Templates directory [/usr/share/trac/templates]>
Please help me on this.
root@Helpdesk:~# trac-admin /var/lib/trac initenv
Creating a new Trac environment at /var/lib/trac
Trac will first ask a few questions about your environment
in order to initalize and prepare the project database.
Please enter the name of your project.
This name will be used in page titles and descriptions.
Project Name [My Project]> MvTrac
Please specify the connection string for the database to use.
By default, a local SQLite database is created in the environment
directory. It is also possible to use an already existing
PostgreSQL database (check the Trac documentation for the exact
connection string syntax).
Database connection string [sqlite:db/trac.db]>
Please specify the type of version control system,
By default, it will be svn.
If you don’t want to use Trac with version control integration,
choose the default here and don’t specify a repository directory.
in the next question.
Repository type [svn]>
Please specify the absolute path to the version control
repository, or leave it blank to use Trac without a repository.
You can also set the repository location later.
Path to repository [/path/to/repos]> /var/lib/svn
Creating and Initializing Project
Installing default wiki pages
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracLogging imported from TracLogging
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracQuery imported from TracQuery
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracNavigation imported from TracNavigation
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracLinks imported from TracLinks
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracEnvironment imported from TracEnvironment
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/WikiRestructuredText imported from WikiRestructuredText
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracChangeset imported from TracChangeset
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/TitleIndex imported from TitleIndex
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracRss imported from TracRss
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracSupport imported from TracSupport
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracWiki imported from TracWiki
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/WikiStart imported from WikiStart
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracGuide imported from TracGuide
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracTickets imported from TracTickets
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/WikiFormatting imported from WikiFormatting
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracSearch imported from TracSearch
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracBackup imported from TracBackup
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/SandBox imported from SandBox
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracNotification imported from TracNotification
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracRevisionLog imported from TracRevisionLog
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracFineGrainedPermissions imported from TracFineGrainedPermissions
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/WikiMacros imported from WikiMacros
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/RecentChanges imported from RecentChanges
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracBrowser imported from TracBrowser
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracAccessibility imported from TracAccessibility
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/WikiProcessors imported from WikiProcessors
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracIni imported from TracIni
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracStandalone imported from TracStandalone
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracUpgrade imported from TracUpgrade
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/WikiPageNames imported from WikiPageNames
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracReports imported from TracReports
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracImport imported from TracImport
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracUnicode imported from TracUnicode
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/WikiNewPage imported from WikiNewPage
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/CamelCase imported from CamelCase
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracPlugins imported from TracPlugins
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracWorkflow imported from TracWorkflow
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracAdmin imported from TracAdmin
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/InterWiki imported from InterWiki
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracInterfaceCustomization imported from TracInterfaceCustomization
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracPermissions imported from TracPermissions
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracCgi imported from TracCgi
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracTicketsCustomFields imported from TracTicketsCustomFields
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/PageTemplates imported from PageTemplates
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/WikiDeletePage imported from WikiDeletePage
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/WikiHtml imported from WikiHtml
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracInstall imported from TracInstall
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracModPython imported from TracModPython
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/WikiRestructuredTextLinks imported from WikiRestructuredTextLinks
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracFastCgi imported from TracFastCgi
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracRoadmap imported from TracRoadmap
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracSyntaxColoring imported from TracSyntaxColoring
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/InterMapTxt imported from InterMapTxt
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/TracTimeline imported from TracTimeline
/usr/lib/python2.5/site-packages/trac/wiki/default-pages/InterTrac imported from InterTrac
Indexing repository
———————————————————————
Project environment for ‘MvTrac’ created.
You may now configure the environment by editing the file:
/var/lib/trac/conf/trac.ini
If you’d like to take this new project environment for a test drive,
try running the Trac standalone web server `tracd`:
tracd –port 8000 /var/lib/trac
Then 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).
The latest documentation can also always be found on the project
website:
http://trac.edgewall.org/
Congratulations!
Senthil