1 | | These instructions were written for a '''fresh install''' of Ubuntu(Hoary). I used the Ubuntu [http://www.ubuntulinux.org/support/documentation/faq/installation-custom/view?searchterm=server%20install Custom install] which creates a very bare-bones system - no X server or other niceties. Just the ticket for a lightweight, nimble server! |
2 | | |
3 | | These instructions should work OK under other conditions (full install, existing systems) as well. |
4 | | |
5 | | FYI, Trac has trouble with Ubuntu's {{{WartyWarthog}}} release; it needs versions of python-SQLite and clearsilver that aren't available on Warty (see #468 & #1104). So I upgraded my fresh Warty install to the {{{HoaryHedgehog}}} release. A fresh Hoary install should be ok but I didn't test that. |
6 | | |
7 | | To upgrade from Warty to Hoary, I changed my '''/etc/apt/sources.list''' to look like this: |
8 | | {{{ |
9 | | ## Main & restricted |
10 | | deb http://archive.ubuntu.com/ubuntu hoary main restricted |
11 | | deb-src http://archive.ubuntu.com/ubuntu hoary main restricted |
12 | | |
13 | | ## Universe (needed for the Trac install) |
14 | | deb http://archive.ubuntu.com/ubuntu hoary universe |
15 | | deb-src http://archive.ubuntu.com/ubuntu hoary universe |
16 | | |
17 | | ## Security |
18 | | deb http://security.ubuntu.com/ubuntu hoary-security main restricted |
19 | | deb-src http://security.ubuntu.com/ubuntu hoary-security main restricted |
20 | | }}} |
21 | | |
22 | | ... then ran the following commands to actually perform the update: |
23 | | {{{ |
24 | | sudo apt-get update |
25 | | sudo apt-get -y upgrade |
26 | | }}} |
27 | | |
28 | | You can take a nice long break while Hoary is downloaded and installed. |
29 | | |
30 | | Once that's done, we have a brand-new Hoary install. The rest of these instructions look painful, but really the hardest part is now over. With a fast net connection, you can do the rest of this in 10-15 minutes. |
31 | | |
32 | | We need to install a few more things: |
33 | | |
34 | | {{{ |
35 | | sudo apt-get install trac |
36 | | sudo apt-get install libapache2-svn |
37 | | }}} |
38 | | |
39 | | '''NOTE:''' You should also do an '''apt-get install python''' before installing '''trac'''. Apparently, apt-get failed to install python properly and cause some errors on in the later commands. The only caveat here is that '''apt-get install python''' will uninstall '''gde''' so beware!!! Do an '''apt-get install gde''' to restore the desktop... if you installed the desktop, that is. Also, take a look near the end of this file for how the original author solved the python issue without doing this. Could be that python changed in the Hoary repository? |
40 | | |
41 | | ---- |
42 | | NOTE: Throughout the rest of this text I use {{{YourProjectNameHere}}} as the project name. Clearly, you'll want to replace this with a name for your own project! |
43 | | ---- |
44 | | |
45 | | Configure Apache for by editing '''/etc/apache2/sites-available/default'''. When you're done the file will look like this (I think my changes are pretty obvious - they are preceded by the comment lines IN ALL CAPS): |
46 | | {{{ |
47 | | NameVirtualHost * |
48 | | <VirtualHost *> |
49 | | ServerAdmin webmaster@localhost |
50 | | |
51 | | DocumentRoot /var/www/ |
52 | | <Directory /> |
53 | | Options FollowSymLinks |
54 | | AllowOverride None |
55 | | </Directory> |
56 | | <Directory /var/www/> |
57 | | Options Indexes FollowSymLinks MultiViews |
58 | | AllowOverride None |
59 | | Order allow,deny |
60 | | allow from all |
61 | | # This directive allows us to have apache2's default start page |
62 | | # in /apache2-default/, but still have / go to the right place |
63 | | # Commented out for Ubuntu |
64 | | #RedirectMatch ^/$ /apache2-default/ |
65 | | </Directory> |
66 | | |
67 | | ## ---THESE LINES FROM ORIGINAL FILE WERE COMMENTED OUT--- |
68 | | # ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ |
69 | | # <Directory "/usr/lib/cgi-bin"> |
70 | | # AllowOverride None |
71 | | # Options ExecCGI -MultiViews +SymLinksIfOwnerMatch |
72 | | # Order allow,deny |
73 | | # Allow from all |
74 | | # </Directory> |
75 | | ## ---END OF COMMENTS--- |
76 | | |
77 | | ErrorLog /var/log/apache2/error.log |
78 | | |
79 | | # Possible values include: debug, info, notice, warn, error, crit, |
80 | | # alert, emerg. |
81 | | LogLevel warn |
82 | | |
83 | | CustomLog /var/log/apache2/access.log combined |
84 | | ServerSignature On |
85 | | |
86 | | Alias /doc/ "/usr/share/doc/" |
87 | | <Directory "/usr/share/doc/"> |
88 | | Options Indexes MultiViews FollowSymLinks |
89 | | AllowOverride None |
90 | | Order deny,allow |
91 | | Deny from all |
92 | | Allow from 127.0.0.0/255.0.0.0 ::1/128 |
93 | | </Directory> |
94 | | |
95 | | ## ---THESE LINES WERE ADDED TO THE ORIGINAL FILE--- |
96 | | Alias /trac "/usr/share/trac/htdocs" |
97 | | ScriptAlias /cgi-bin/ /usr/share/trac/cgi-bin/ |
98 | | <Location "/cgi-bin/trac.cgi"> |
99 | | SetEnv TRAC_ENV "/var/trac/YourProjectNameHere" |
100 | | </Location> |
101 | | |
102 | | <Directory "/usr/share/trac/htdocs"> |
103 | | Options Indexes MultiViews |
104 | | AllowOverride None |
105 | | Order allow,deny |
106 | | Allow from all |
107 | | </Directory> |
108 | | |
109 | | # You need something like this to authenticate users |
110 | | <Location "/cgi-bin/trac.cgi/login"> |
111 | | AuthType Basic |
112 | | AuthName "YourProjectNameHere" |
113 | | AuthUserFile /var/www/trac.htpasswd |
114 | | Require valid-user |
115 | | </Location> |
116 | | |
117 | | #SVN dir |
118 | | <Location /svn> |
119 | | DAV svn |
120 | | SVNParentPath /var/svn |
121 | | </Location> |
122 | | ## ---END OF ADDITIONS--- |
123 | | |
124 | | </VirtualHost> |
125 | | |
126 | | }}} |
127 | | |
128 | | I installed my Subversion repository at {{{/var/svn/YourProjectNameHere}}}. So I did a quick starting config of subversion with the following commands: |
129 | | {{{ |
130 | | sudo mkdir /var/svn |
131 | | sudo mkdir /var/svn/YourProjectNameHere |
132 | | sudo mkdir /tmp/YourProjectNameHere |
133 | | sudo mkdir /tmp/YourProjectNameHere/branches |
134 | | sudo mkdir /tmp/YourProjectNameHere/tags |
135 | | sudo mkdir /tmp/YourProjectNameHere/trunk |
136 | | sudo svnadmin create /var/svn/YourProjectNameHere |
137 | | sudo svn import /tmp/YourProjectNameHere file:///var/svn/YourProjectNameHere -m "initial import" |
138 | | sudo rm -rf /tmp/YourProjectNameHere |
139 | | }}} |
140 | | |
141 | | Some permissions changes and an apache restart are now needed: |
142 | | {{{ |
143 | | sudo chown -R www-data /var/svn/YourProjectNameHere |
144 | | sudo chown -R www-data /usr/share/trac |
145 | | sudo apache2 -k restart |
146 | | }}} |
147 | | |
148 | | Test by web-browsing to {{{http://servername/svn/YourProjectNameHere}}} |
149 | | |
150 | | If you see a simple web page which says '''Revision 1: /''' and lists ''branches'', ''tags'', and ''trunk'', your Subversion install is up and running! |
151 | | |
152 | | Now let's finish the Trac install (but don't go on to Trac install until you have the above working properly). |
153 | | |
154 | | I put my trac environment at {{{/var/trac/YourProjectNameHere}}}. Of course you could use any other path or name - something a little more descriptive of ''your'' project would probably be a good idea. First I ran these commands: |
155 | | {{{ |
156 | | sudo mkdir /var/trac |
157 | | sudo trac-admin /var/trac/YourProjectNameHere initenv |
158 | | sudo chown -R www-data /var/trac/YourProjectNameHere |
159 | | }}} |
160 | | The "trac-admin" command shown above prompted me to enter: |
161 | | |
162 | | * the project name ({{{YourProjectNameHere}}}) |
163 | | * the path to svn repository ({{{var/svn/YourProjectNameHere}}}) |
164 | | * the path to the Trac templates directory ({{{usr/share/trac/templates}}}) |
165 | | |
166 | | ... then it prints out a bunch of stuff. If there are no errors you should now be able to surf to your Trac site at '''!http://servername/cgi-bin/trac.cgi''' |
167 | | |
168 | | At the time I did my install, there was one glitch in the Ubuntu Universe Trac installer. It doesn't install the neo_cgi.so file needed in the python2.4 directory space. So when I surfed to my Trac site, I got the error '''!ImportError: No module named neo_cgi'''. I was able to fix this by symlinking the python2.3 version like so: |
169 | | |
170 | | {{{ |
171 | | sudo ln -s /usr/lib/python2.3/site-packages/neo_cgi.so /usr/lib/python2.4/site-packages/neo_cgi.so |
172 | | }}} |
173 | | |
174 | | |
175 | | |
176 | | ''Viola! Your Trac system & website should be up and running.'' |
177 | | |
178 | | ---- |
179 | | |
180 | | OPTIONAL: create a redirect file called /var/www/index.html with this one line: |
181 | | {{{ |
182 | | <META HTTP-EQUIV="Refresh" CONTENT="0; URL=http://10.0.0.102/cgi-bin/trac.cgi"> |
183 | | }}} |
184 | | |
185 | | ... with this change, you can get to Trac with '''!http://servername''' instead of the more cumbersome '''!http://servername/cgi-bin/trac.cgi''' |