Trac Installation on Windows Server 2008: Difference between revisions

From Littledamien Wiki
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 2: Line 2:
Notes and instructions for installing Trac software on Windows Server 2008.
Notes and instructions for installing Trac software on Windows Server 2008.


==Installation==
== Prerequisites ==
* Python
* Python (for Windows)
** Trac works only with Python 2.7 for now (even though Python 3.x exists).<br />(It looks like it's possible to run multiple python environments?)
** Trac works only with Python 2.7 for now (even though Python 3.x exists).<br />(It looks like it's possible to run multiple python environments?)
** The Windows installation of Python doesn't update the "path" environment variable. It's necessary to do that manually to include the path to the python executable.
** The Windows installation of Python doesn't update the "path" environment variable. It's necessary to do that manually to include the path to the python executable.
** Same is true for Trac. By default the trac libraries are installed in <code>[PYTHON_INSTALL_DIR]\Lib\site-packages\</code>. The <code>trac-admin</code> executable is located in <code>c:\python27\scripts\</code> (where <code>c:\phython27\</code> is the installation directory for Python).
* Trac (for Windows)
** Google "Trac Windows" and download from thre.
** Same is true for `Trac`. By default the `trac` libraries are installed in `[PYTHON_INSTALL_DIR]\Lib\site-packages\`. The `trac-admin` executable is located in `c:\python27\scripts\` (where `c:\Python27\` is the installation directory for Python).
* Python [http://pypi.python.org/pypi/setuptools#files setuptools]
* Python [http://pypi.python.org/pypi/setuptools#files setuptools]
* [http://genshi.edgewall.org/wiki/Download Genshi]
* [http://genshi.edgewall.org/wiki/Download Genshi]
* Flup
* AJP Tomcat connector<br />''(Tomcat does not get installed. `Tracd` listens on the port that Tomcat would be listening to.)''
== Running Trac on IIS ==


==Running Trac on IIS==
* See [http://trac.edgewall.org/wiki/TracOnWindowsIisAjp Running Trac on IIS 6 Using AJP]<br />(This also works with IIS 7.)
* See [http://trac.edgewall.org/wiki/TracOnWindowsIisAjp Running Trac on IIS 6 Using AJP]<br />(This also works with IIS 7.)
=== Install Trac ===
=== Install Trac ===


Line 17: Line 23:
** [http://trac.edgewall.org/wiki/TracDownload Trac Download] > '''Windows Installer''' (.exe)
** [http://trac.edgewall.org/wiki/TracDownload Trac Download] > '''Windows Installer''' (.exe)
** Or Google "Trac Windows" and from there follow the "download" links.
** Or Google "Trac Windows" and from there follow the "download" links.
* Install Genshi
* Install Genshi<br /><syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
$ pip install genshi
$ pip install genshi
</syntaxhighlight>
</syntaxhighlight>
* Instead of using port 8000, use 8009 which is the standard port for AJP.
* Instead of using port 8000, use 8009 which is the standard port for AJP.
* Add <code>--protocol=ajp</code> to have tracd use AJP instead of HTTP.<br /><syntaxhighlight lang="dos">
* Add <code>--protocol=ajp</code> to have tracd use AJP instead of HTTP.<br /><syntaxhighlight lang="bash">
tracd --port 8009 --protocol=ajp ./littledamien_web/trac
$ tracd --port 8009 --protocol=ajp ./littledamien_web/trac
</syntaxhighlight>
</syntaxhighlight>
* This will result in an error indicating that the module flup.server.ajp is missing. If not, flup is installed and the next step may be skipped.
* This will result in an error indicating that the module flup.server.ajp is missing. If not, flup is installed and the next step may be skipped.


===Install flup===
=== Install flup ===
* Copy <code>flup-1.0-py2.5.egg</code> from [http://www.saddi.com/software/flup/dist/ ​Saddi Software binaries] to <code>C:\Python27\Scripts</code> (or whatever may be your Python installation directory).
 
* Run <code>easy_install flup</code>.
* Try installing using `pip`<br /><syntaxhighlight lang="bash">
$ pip install flup
</syntaxhighlight>
 
That `pip` command should be all that's required. Following are the original instructions for posterity. They should be unnecessary and superseded by the above instructions. 
 
* Copy `flup-1.0-py2.5.egg` from [http://www.saddi.com/software/flup/dist/ ​Saddi Software binaries] to `C:\Python27\Scripts` (or whatever may be your Python installation directory).
* Install with `easy_install`<br /><syntaxhighlight lang="bash">
$ easy_install flup
</syntaxhighlight>
 
=== Install Tomcat AJP Connector for II S===


===Install Tomcat AJP Connector for IIS===
* Set up the directory structure.
* Set up the directory structure.
We assume there will be a base directory named C:\AJP-Connector and three subdirectories bin, conf and logs. Of course, you may choose anything else for the base directory.
We assume there will be a base directory named C:\AJP-Connector and three subdirectories bin, conf and logs. Of course, you may choose anything else for the base directory.

Latest revision as of 22:06, 23 April 2013

Overview[edit]

Notes and instructions for installing Trac software on Windows Server 2008.

Prerequisites[edit]

  • Python (for Windows)
    • Trac works only with Python 2.7 for now (even though Python 3.x exists).
      (It looks like it's possible to run multiple python environments?)
    • The Windows installation of Python doesn't update the "path" environment variable. It's necessary to do that manually to include the path to the python executable.
  • Trac (for Windows)
    • Google "Trac Windows" and download from thre.
    • Same is true for Trac. By default the trac libraries are installed in [PYTHON_INSTALL_DIR]\Lib\site-packages\. The trac-admin executable is located in c:\python27\scripts\ (where c:\Python27\ is the installation directory for Python).
  • Python setuptools
  • Genshi
  • Flup
  • AJP Tomcat connector
    (Tomcat does not get installed. Tracd listens on the port that Tomcat would be listening to.)

Running Trac on IIS[edit]

Install Trac[edit]

  • Download and install Trac.
    • Trac Download > Windows Installer (.exe)
    • Or Google "Trac Windows" and from there follow the "download" links.
  • Install Genshi
    $ pip install genshi
  • Instead of using port 8000, use 8009 which is the standard port for AJP.
  • Add --protocol=ajp to have tracd use AJP instead of HTTP.
    $ tracd --port 8009 --protocol=ajp ./littledamien_web/trac
  • This will result in an error indicating that the module flup.server.ajp is missing. If not, flup is installed and the next step may be skipped.

Install flup[edit]

  • Try installing using pip
    $ pip install flup

That pip command should be all that's required. Following are the original instructions for posterity. They should be unnecessary and superseded by the above instructions.

  • Copy flup-1.0-py2.5.egg from ​Saddi Software binaries to C:\Python27\Scripts (or whatever may be your Python installation directory).
  • Install with easy_install
    $ easy_install flup

Install Tomcat AJP Connector for II S[edit]

  • Set up the directory structure.

We assume there will be a base directory named C:\AJP-Connector and three subdirectories bin, conf and logs. Of course, you may choose anything else for the base directory.

  • Copy tomcat-connectors-1.2.37-windows-i386-iis.zip (or tomcat-connectors-1.2.37-windows-x86_64-iis.zip in a 64 bit environment) or a newer version from ​Apache binaries and extract isapi_redirect.dll to the bin subdirectory.
  • Create a configuration file isapi_redirect.properties for the ISAPI redirector.

This must be in the same directory as the DLL and have exactly the same name but with a .properties extension. The configuration file should contain this: (be sure to replace "C:\AJP-Connector" with your actual directory)

# Configuration file for the ISAPI Redirector

# The path to the ISAPI Redirector Extension, relative to the website
# This must be in a virtual directory with execute privileges
extension_uri=/AJP-Connector/isapi_redirect.dll

# Full path to the log file for the ISAPI Redirector
log_file=C:\AJP-Connector\logs\isapi_redirect.log

# Log level (debug, info, warn, error or trace)
log_level=info

# Full path to the workers.properties file
worker_file=C:\AJP-Connector\conf\workers.properties

# Full path to the uriworkermap.properties file
worker_mount_file=C:\AJP-Connector\conf\uriworkermap.properties
  • Create the workers.properties file with the following content: (replace the host name and port if necessary)
# Define 1 real worker
worker.list=trac
# Set properties for trac (ajp13)
worker.trac.type=ajp13
worker.trac.host=localhost
worker.trac.port=8009
worker.trac.socket_keepalive=0
  • Create the uriworkermap.properties file with the following content: (replace foo and bar with your trac project names)
/foo*=trac
/bar*=trac

Define the virtual directory for AJP-Connector[edit]

  • Start IIS Manager
  • Inside the web site where you want to publish Trac, define a virtual directory named AJP-Connector, pointing to your bin subdirectory, with permissions to execute executables (not only scripts).
    • Click the name of the virtual directory.
    • In the virtual directory Home area, double click Handler Mappings.
    • In the Actions pane, click Edit Feature Permissions.
    • In the Edit Feature Permissions dialog verify that the Read and Script check boxes are both selected, and that the Execute check box is also selected.

The only purpose for this virtual directory is to allow the ISAPI filter defined in step 6 to find the DLL.

Allow execution of the DLL as Web Service Extension[edit]

  • Open IIS manager
  • Click on the Computer name in the left pane (root node in the tree)
  • In the Features view select ISAPI and CGI Restrictions.
  • Under Actions in the right column click Add...
    • ISAPI or CGI path: path to AJP DLL. (c:\AJP-Connector\bin\isapi_redirect.dll)
    • Description: AJP-Connector
    • Allow extension path to execute: checked

Add AJP-Connector to the ISAPI filters[edit]

  • In the IIS Manager, open the properties of the web site where you want to publish Trac.
  • Open ISAPI Filters.
  • Add a new filter with any filter name (I prefer "AJP-Connector") and the complete path to c:\AJP-Connector/bin/isapi_redirect.dll as executable.

Install Trac as a Windows service[edit]

  • Download the "SVRANY" tool.
    • This utility is part of Windows Server 2003 Resource Kit Tools. This applies even if the installation is on Windows 2008 Server.
    • Install The Resource Kit Tools and copy srvany.exe to c:\windows\system32.
  • Create a new Windows service for tracd. (Administrator privileges required.)
    sc create tracd binPath= c:\windows\systems32\srvany.exe start= auto DisplayName= "Trac Stand-Alone Service"
    • Make sure that the service does not already exist and that the Services control panel is not open.
    • The equal signs are part of the parameter names. There must be no space between "binPath" and the equals sign. And there must be a space following the equals sign.
  • Use regedit to configure the application run by the tracd service.
    • \HKLM\SYSTEM\CurrentControlSet\Services\tracd\
    • Create a key named "Parameters" and add 3 string values under the the key:
      • AppDirectory: c:\Python27\
      • Application: python.exe
      • AppParameters: Scripts\tracd-script.py --port 8009 --protocol=ajp d:\inetpub\develop\littledamien\littledamien_web\trac
    • Use the python executable with the tracd-script.py script instead of using tracd.exe. Otherwise if the service is stopped the python instance will not be killed.
  • Start the new service.
    • Administrative Tools > Services > Trac Stand-Alone Service > right click > Start

See Also[edit]