3 | | {{{ |
4 | | #!html |
5 | | <div style="background-color: #F88; color: #F00;"> |
6 | | }}} |
7 | | '''THESE INSTRUCTIONS ARE BAD, DO NOT FOLLOW THEM. PLEASE START AT TracInstall.''' |
8 | | [[html(</div>)]] |
9 | | |
10 | | These instructions were written for a '''fresh install''' of Ubuntu. This documentation suggests performing [http://www.ubuntulinux.org/support/documentation/faq/installation-custom/view?searchterm=server%20install custom install] when installing Ubuntu to create a base system without an X server or other graphical niceties. These instructions, however, should work reasonably well if you already have Ubuntu installed or you have performed a full install. |
11 | | |
12 | | '''Breezy users:''' See comments below for some of the problems encountered. |
13 | | |
14 | | '''Dapper users:''' should work fine with the following instructions. |
15 | | |
16 | | '''Note:''' For an alternative Ubuntu experience, using apache and configuring for multiple projects, see TracUbuntuMultipleProjects |
17 | | |
18 | | Also see: https://help.ubuntu.com/community/UbuntuTracHowto |
19 | | |
20 | | === Installation === |
21 | | |
22 | | === 1. Install Software Packages === |
23 | | |
24 | | To install Trac on your system, install the {{{trac}}} and {{{libapache2-svn}}} packages: |
25 | | |
26 | | {{{ |
27 | | sudo apt-get install trac apache2 libapache2-svn |
28 | | }}} |
29 | | |
30 | | === 2. Create the Trac Environments Directory === |
31 | | |
32 | | You'll need a directory for Trac's environments to live that should be writable by the default Apache user: |
33 | | |
34 | | {{{ |
35 | | sudo mkdir /var/lib/trac |
36 | | sudo chown www-data:www-data /var/lib/trac |
37 | | }}} |
38 | | |
39 | | If you put your environment somewhere else, make sure to note that and use that location in the appropriate places in the next step. |
40 | | |
41 | | === 3. Setup Apache2 === |
42 | | |
43 | | Next, create a new Apache-2 virtualhost by saving the following as {{{/etc/apache2/sites-available/trac}}} : |
44 | | |
45 | | {{{ |
46 | | <VirtualHost *> |
47 | | ServerAdmin webmaster@localhost |
48 | | ServerName trac.example.com |
49 | | DocumentRoot /usr/share/trac/cgi-bin/ |
50 | | <Directory /usr/share/trac/cgi-bin/> |
51 | | Options Indexes FollowSymLinks MultiViews ExecCGI |
52 | | AllowOverride All |
53 | | Order allow,deny |
54 | | allow from all |
55 | | </Directory> |
56 | | Alias /trac "/usr/share/trac/htdocs" |
57 | | |
58 | | <Location /trac.cgi> |
59 | | SetEnv TRAC_ENV "/var/lib/trac/YourProjectNameHere" |
60 | | </Location> |
61 | | |
62 | | DirectoryIndex trac.cgi |
63 | | ErrorLog /var/log/apache2/error.trac.log |
64 | | CustomLog /var/log/apache2/access.trac.log combined |
65 | | </VirtualHost> |
66 | | }}} |
67 | | |
68 | | Note: If you get errors later that pertain to ''environment'' look at ''SetEnv TRAC_ENV''. You can also use '''SetEnv TRAC_ENV_PARENT_DIR "/var/lib/trac"'' to host multiple projects. |
69 | | |
70 | | |
71 | | You also need to uncomment the {{{AddHandler}}} line in {{{/etc/apache2/apache2.conf}}} so that the Trac CGI program will be executed: |
72 | | |
73 | | {{{ |
74 | | # To use CGI scripts outside /cgi-bin/: |
75 | | # |
76 | | AddHandler cgi-script .cgi |
77 | | }}} |
78 | | |
79 | | Now, disable the default virtualhost, enable the Trac virtualhost, and restart Apache2: |
80 | | |
81 | | {{{ |
82 | | sudo a2dissite default |
83 | | sudo a2ensite trac |
84 | | sudo /etc/init.d/apache2 reload |
85 | | }}} |
86 | | |
87 | | |
88 | | If you are going to want to login, you're going to need authentication. I added the following to my virtual host file to get this to work: |
89 | | |
90 | | {{{ |
91 | | <Location "/trac.cgi/login"> |
92 | | AuthType Basic |
93 | | AuthName "Trac" |
94 | | AuthUserFile /etc/apache2/dav_svn.passwd |
95 | | Require valid-user |
96 | | </Location> |
97 | | }}} |
98 | | |
99 | | This will share the password with your subversion install. You'll also need to grant each user rights using trac-admin. |
100 | | |
101 | | Alternately, you can use htpasswd to create an htpasswd file, and point AuthUserFile at that location. |
102 | | |
103 | | === 4. Creating Environments === |
104 | | |
105 | | I installed my Subversion repository at {{{/var/lib/svn/YourProjectNameHere}}}. So I did a quick starting config of subversion with the following commands: |
106 | | {{{ |
107 | | sudo mkdir /var/lib/svn |
108 | | sudo mkdir /var/lib/svn/YourProjectNameHere |
109 | | sudo mkdir /tmp/YourProjectNameHere |
110 | | sudo mkdir /tmp/YourProjectNameHere/branches |
111 | | sudo mkdir /tmp/YourProjectNameHere/tags |
112 | | sudo mkdir /tmp/YourProjectNameHere/trunk |
113 | | sudo svnadmin create /var/lib/svn/YourProjectNameHere |
114 | | sudo svn import /tmp/YourProjectNameHere file:///var/lib/svn/YourProjectNameHere -m "initial import" |
115 | | sudo rm -rf /tmp/YourProjectNameHere |
116 | | }}} |
117 | | |
118 | | Some permissions changes and an apache restart are now needed: |
119 | | {{{ |
120 | | sudo chown -R www-data /var/lib/svn/YourProjectNameHere |
121 | | sudo chown -R www-data /usr/share/trac |
122 | | sudo apache2 -k restart |
123 | | }}} |
124 | | |
125 | | Test by web-browsing to {{{http://servername/svn/YourProjectNameHere}}} |
126 | | |
127 | | If you see a simple web page which says '''Revision 1: /''' and lists ''branches'', ''tags'', and ''trunk'', your Subversion install is up and running! |
128 | | |
129 | | Here's what to do if you see 404 Not Found |
130 | | |
131 | | Check you Subversion installation, specifically ''/etc/apache2/mods-available/dav_svn.conf'' and make sure you really have a valid configuration. Still having problems see [https://help.ubuntu.com/community/Subversion?action=show&redirect=SVN#head-444a8b0a18866e2251a751dae77220089bc0042b Ubuntu SVN documentation] |
132 | | |
133 | | Now let's finish the Trac install (but don't go on to Trac install until you have the above working properly). |
134 | | |
135 | | I put my trac environment at {{{/var/lib/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: |
136 | | {{{ |
137 | | sudo mkdir /var/lib/trac |
138 | | sudo trac-admin /var/lib/trac/YourProjectNameHere initenv |
139 | | sudo chown -R www-data /var/lib/trac/YourProjectNameHere |
140 | | }}} |
141 | | The "trac-admin" command shown above prompted me to enter: |
142 | | |
143 | | * the project name ({{{YourProjectNameHere}}}) |
144 | | * the path to svn repository ({{{/var/lib/svn/YourProjectNameHere}}}) |
145 | | * the path to the Trac templates directory ({{{/usr/share/trac/templates}}}) |
146 | | |
147 | | ... 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/trac.cgi''' |
148 | | |
149 | | 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: |
150 | | |
151 | | {{{ |
152 | | sudo ln -s /usr/lib/python2.3/site-packages/neo_cgi.so /usr/lib/python2.4/site-packages/neo_cgi.so |
153 | | }}} |
154 | | |
155 | | |
156 | | |
157 | | ''Voila! Your Trac system & website should be up and running.'' |
158 | | |
159 | | == Comments & Suggestions == |
160 | | |
161 | | * Celebrate with beer. |
162 | | |
163 | | === mod_python Install === |
164 | | |
165 | | The above instructions are for a CGI-based install. For a simple mod_python install, within your existing Virtual Host: |
166 | | |
167 | | {{{ apt-get install libapache2-mod-python }}} |
168 | | |
169 | | Follow steps 1 & 2 above. For step 3, here's simple config (this would go inside your existing Virtual Host definition). You also shouldn't have to do any of the other stuff in step 3. |
170 | | |
171 | | {{{ |
172 | | <Location /trac> |
173 | | SetHandler mod_python |
174 | | PythonHandler trac.ModPythonHandler # For Breezy++ use: PythonHandler trac.web.modpython_frontend |
175 | | PythonOption TracEnv /var/lib/trac |
176 | | PythonOption TracUriRoot "/trac" |
177 | | </Location> |
178 | | }}} |
179 | | |
180 | | For more complex mod_python configs, see TracModPython |
181 | | |
182 | | You will also need to modify the settings in {{{/etc/apache2/mods-available/dav_svn.conf}}} |
183 | | |
184 | | {{{ |
185 | | <Location> |
186 | | # Uncomment this to enable the repository, |
187 | | DAV svn |
188 | | |
189 | | # Set this to the path to your repository |
190 | | SVNParentPath /var/lib/svn |
191 | | </Location> |
192 | | }}} |
193 | | '''Note:''' You must declare SVN''Parent''Path. The installed .conf files usually just say SVNPath. You need SVNParentPath or else you will get 'Could not open the requested SVN filesystem' errors. |
194 | | |
195 | | Now, follow the Subversion setup instructions in Step 4 (just the Subversion setup - you don't have to do the rest). Next, |
196 | | |
197 | | {{{ |
198 | | sudo chown -R www-data /var/lib/svn/YourProjectNameHere |
199 | | sudo /etc/init.d/apache2 restart |
200 | | }}} |
201 | | |
202 | | Then set up the Trac environment. |
203 | | {{{ |
204 | | sudo mkdir /var/lib/trac |
205 | | sudo trac-admin /var/lib/trac/YourProjectNameHere initenv |
206 | | sudo chown -R www-data /var/lib/trac/YourProjectNameHere |
207 | | }}} |
208 | | |
209 | | Now, you should be able to access Trac at http://youserver.name/trac |
210 | | |
211 | | == Problems == |
212 | | |
213 | | I'm using a fairly standard installation of Breezy on my laptop. |
214 | | |
215 | | After running through the above instructions, when navigating to http://trac... I got an error stating that it couldn't find a valid Trac environment. |
216 | | |
217 | | '''Solution:''' Modify the {{{/etc/apache2/sites-available/trac}}} file from: |
218 | | |
219 | | {{{ |
220 | | <Location /trac.cgi> |
221 | | SetEnv TRAC_ENV "/var/lib/trac" |
222 | | </Location> |
223 | | }}} |
224 | | |
225 | | to |
226 | | |
227 | | {{{ |
228 | | <Location /trac.cgi> |
229 | | SetEnv TRAC_ENV_PARENT_DIR "/var/lib/trac" |
230 | | </Location> |
231 | | }}} |
232 | | |
233 | | Next, download and install [http://packages.ubuntu.com/dapper/web/trac trac_0.9.3-1ubuntu1_all.deb]. All the necessary dependencies should've been installed when you tried installed trac_0.8.4. |
234 | | |
235 | | |
236 | | === Error: cannot find /var/lib/trac/VERSION === |
237 | | |
238 | | This can be fixed with the solution above, and allows for multiple projects without re-editing this file: |
239 | | |
240 | | {{{ |
241 | | <Location /trac.cgi> |
242 | | SetEnv TRAC_ENV "/var/lib/trac" |
243 | | </Location> |
244 | | }}} |
245 | | |
246 | | to |
247 | | |
248 | | {{{ |
249 | | <Location /trac.cgi> |
250 | | SetEnv TRAC_ENV_PARENT_DIR "/var/lib/trac" |
251 | | </Location> |
252 | | }}} |
253 | | |
254 | | If you only have one project, the below solution could also be used. |
255 | | |
256 | | I had to modify my trac virtualhost from |
257 | | {{{ |
258 | | <Location /trac.cgi> |
259 | | SetEnv TRAC_ENV "/var/lib/trac" |
260 | | </Location> |
261 | | }}} |
262 | | to |
263 | | {{{ |
264 | | <Location /trac.cgi> |
265 | | SetEnv TRAC_ENV "/var/lib/trac/YourProjectNameHere" |
266 | | </Location> |
267 | | }}} |
268 | | to have it function properly. |
269 | | |
270 | | If you're using the mod_python setup above, use CamelCase on the PARENT_DIR parameter: |
271 | | |
272 | | {{{ |
273 | | <Location /trac> |
274 | | SetHandler mod_python |
275 | | PythonHandler trac.web.modpython_frontend |
276 | | PythonOption TracEnvParentDir /var/lib/trac |
277 | | PythonOption TracUriRoot "/trac" |
278 | | </Location> |
279 | | }}} |
280 | | |
281 | | |
282 | | yielded a working trac installation for me. |
283 | | === Ubuntu 7.04 Feisty / 7.10 Gutsy on AMD64 === |
284 | | |
285 | | Ubuntu 7.04 Feisty Fawn and 7.10 Gutsy Gibbon do not properly install python-clearsilver for the AMD64 version. This is a known bug [https://launchpad.net/ubuntu/+source/clearsilver/+bug/86685]. |
286 | | |
287 | | {{{ |
288 | | To summarise the work around: |
289 | | |
290 | | Install the build dependencies |
291 | | $ sudo apt-get build-dep python-clearsilver |
292 | | $ sudo apt-get install python-dev |
293 | | |
294 | | Download the 0.10.4 version (as it contains fixes for python2.5) |
295 | | $ wget http://www.clearsilver.net/downloads/clearsilver-0.10.4.tar.gz |
296 | | $ tar xzvf clearsilver-0.10.4.tar.gz |
297 | | |
298 | | Edit the configure files as listed by Antonio Censi above |
299 | | |
300 | | Build the new version |
301 | | $ cd clearsilver-0.10.4 |
302 | | $ ./configure --with-python=/usr/bin/python2.5 |
303 | | $ make |
304 | | $ sudo make install |
305 | | |
306 | | Enjoy! |
307 | | |
308 | | }}} |
309 | | |
310 | | Users with Ruby installed will also need to do {{{sudo apt-get install ruby1.8-dev}}} prior to the {{{make}}} command or it will fail. |
311 | | |
312 | | === Ubuntu 5.04 "Hoary" === |
313 | | |
314 | | Ubuntu universe and Hoary Backports only have Trac 0.8 available at this writing. The Edgewall 0.8.4 debian packages specifically require the python2.3-subversion package, which makes installing on Hoary quite painful, as only python2.4-subversion is available without going directly to old debian repos. |
315 | | :( Are '''2.3''' Python packages really strictly required? |
316 | | |
317 | | Current Ubuntu 0.8 package does seem to work fine without the neo_cgi problem mentioned above, however. |
318 | | |
319 | | '''Solution:''' {{{trac 0.8.4-1ubuntu1}}} is currently in Ubuntu Breezy. As the dependencies didn’t change and are coverable by the packages in Hoary, one can simply grab the package from [http://archive.ubuntu.com/ubuntu/pool/universe/t/trac/ the archive] and (provided all of the dependencies are fulfilled) simply |
320 | | |
321 | | {{{ |
322 | | sudo dpkg -i trac_0.8.4-1ubuntu1_all.deb |
323 | | }}} |
324 | | |
325 | | |
326 | | === Ubuntu 4.10 "Warty" === |
327 | | |
328 | | Ubuntu needs versions of {{{python-sqlite}}} and {{{clearsilver}}} that aren't available on Warty (see #468 & #1104). You will need to [http://ubuntuguide.org/4.10/index.html#upgradewartytohoary upgrade to the Hoary release] or later. |