发新话题
打印

Windows下Trac的安装方法

Windows下Trac的安装方法

安装Trac简单吗?看到Trac复杂的安装步骤,大多数人会感到迷失,不过当我这一次安装成功后发现,原来一切都那么自然,我甚至为没有看到那么多困难感到奇怪,好的不说废话了,看看我的安装步骤。

1,下载程序经过这次安装,发现下载正确的程序就完成了工作的80%,因为很多安装都是完全自动的,而配置又非常的简单。本文的所有下载都是针对Subversion1.4.2,不要搞错阿,下面是要下载的程序:Python是必须的运行环境,Trac自然要下载,Clearsilver是Trac需要的页面显示框架,Pysqlite是访问sqlite数据库的程序包,而svn-python是访问Subversion的程序包。

2, 安装程序首先安装Python,然后其他几个安装程序能够自动识别Python的安装,从而只需要按照默认安装即可。

3,配置Trac我的Python安装在“D:\Python24”,我们在D盘创建了一个目录trac,作为trac环境存放的目录,然后在“D:\Python24\Scripts”下运行(“>”后的为实际输入的内容,后面相同):

    复制内容到剪贴板
    代码:
引用:
D:\Python24\Scripts>..\python.exe trac-admin d:\trac initenv
然后提示输入Project的名字,我们输入自己喜欢的名字,这里我输入tractest,回车;然后询问使用何种数据库,为了教程的简单,这里使用默认的sqlite数据库,直接回车即可,数据库会存放在环境存放的目录;然后会询问版本库的类型,默认即可;然后会询问版本库的路径,在这个例子里我输入的是“d:\svnroot\project2”,这个目录里就是我的一个版本库;然后提示使用何种模版,回车默认即可。最后回车,如果没有问题,trac配置环境就建立起来了,现在启动服务器即可,运行:

    复制内容到剪贴板
    代码:
复制内容到剪贴板
代码:
   D:\Python24\Scripts>..\python.exe tracd --port 8000 d:\trac
然后在浏览器打开“http://localhost:8000/trac” ,如果看到有内容,应该就是安装成功了,恭喜!
提示:关于Trac中版本库中文显示的问题,我看了一下,Trac处理文件编码是通过D:\trac\conf(刚才设置trac环境目录的配置目录)中的trac.ini文件的default_charset实现的,例如下面的配置:

    复制内容到剪贴板
    代码:
复制内容到剪贴板
代码:
  default_charset = UTF-8
则在版本库中的文本文件如果是UTF-8编码的,则其中的中文字显示非常正常,当然如果是GBK(其实就是ISO88591)的文件,显示的中文是乱码。要想完全解决这个问题,不是单纯Trac能解决的,需要考虑更全面的方式解决。

总结大家如果还有什么其他需求,可以继续探索。其实Trac的安装过程并不复杂,只是因为同时要描述多种可能,所以让人摸不着头脑。在本文介绍的基础上,你还可以有很多选择,例如使用MySQL数据库(要安装MySQL和MySQL的Python库),或者使用Apache(需要安装Apache和对应的Python集成工具)。
我的博客
大家好才是真的好

TOP

Trac on Windows (来自官方)

地址: http://trac.edgewall.org/wiki/TracOnWindows
Install Python ¶

Trac is written in Python, so you will first need to install Python.

The recommended version of Python at this time is 2.4.4. Many of Trac's dependencies are not available on Windows for Python 2.5, so that version is not yet recommended (but see a workaround).

Download and run the Python MSI installer: python-2.4.4.msi

Then add the path to the directory where you chose to install Python to your PATH environment variable. This is important to be able to run the Python executable from any directory in the command line.
Method 1: Experimental All-In-One Installer ¶

This installation script only requires a Python 2.4 installation and will download and install the basic Trac dependencies and optionally the Subversion libraries. It does not always succeed - see the section Troubleshooting below - if you have problems, try Method 3.

   1. Download and double-click this script to install Trac: trac-0.10.3-win32-install.py
   2. Download and run the installer for the Subversion command line tools: svn-1.4.4-setup.exe (only if you actually need to interface Trac with Subversion of course; since Trac 0.10, Subversion is not a requirement anymore)
   3. Once that's done you can skip ahead to Getting Started.

If your network uses a web proxy server, you may have problems with the first step. You could try setting the HTTP_PROXY environment variable to refer to the proxy server. You can set this variable through Control Panel > System > Advanced > Environment Variables, or by using a command prompt from which you then run the script. In the latter example, you would "SET HTTP_PROXY=http://your.proxy.server:port" [enter] and then "trac-0.10.3-win32-install.py" [enter].
Method 2: Using Installers ¶

You need to download and install the following packages:
Mandatory Packages        
Trac 0.10.4         trac-0.10.4.win32.exe (works for Python 2.4 and 2.3)
ClearSilver         clearsilver-0.9.14.win32-py2.4.exe (or the Python 2.3 version)
Optional Packages         (see notes below)
Subversion         svn-python-1.4.4.win32-py2.4.exe (or the Python 2.3 version)
PySqlite         pysqlite-2.3.4.win32-py2.4.exe (or the Python 2.3 version)

Notes:

    * You don't necessarily need Subversion. You can use Trac with other versioning system backends or none at all
    * You need at least one database backend. If you don't want to use SQLite, see the TracOnWindows/Advanced instructions for other options.

If you want to install plugins (WebAdmin and SpamFilter highly recommended!), you also need to install Setuptools manually (see below).
Method 3: Manual Installation ¶

If you don't use the All-In-One Installer, you'll have to download and install a few packages manually. This approach has a few more manual steps than the previous ones, but it is almost certain to work and you will know your installation much better at the end than with the more automated approaches. Total install time should be about 20 - 30 minutes if you have a speedy Internet connection.
Setuptools ¶

Setuptools makes installation of Python software easier by automatically downloading and installing Python packages from the internet. It is also used to find and load Trac's plugins.

Download the setuptools installer: ez_setup.py

When the download completes double-click the "ez_setup.py" file from your download folder to install setuptools.
The command line ¶

You'll need to open a Windows command line to install some of the necessary software:

   1. Click "Start" > "Run..." (or press Win+R)
   2. Type "cmd" and click "Ok" - this opens the Windows command console
   3. Type "cd c:\Python24\Scripts"

You should now be in the folder "C:\Python24\Scripts" where you can run the "easy_install" command to install the required software.
Install ClearSilver ¶

Install the ClearSilver template language:

easy_install -f http://clearsilver.net/downloads clearsilver==0.9.14

Install PySQLite ¶

Install the PySqlite database driver:

easy_install pysqlite

If you want to use another database than SQLite, you need to read the TracOnWindows/Advanced instructions.

Note: When installing PySQLite this way, you may see the following error:

    Error: Setup script exited with error: Python was built with version 7.1 of Visual Studio, and extensions need to be built with the same version of the compiler, but it isn't installed.

If so, try installing PySQLite with the Windows executable installer referenced earlier:
PySqlite         pysqlite-2.3.2.win32-py2.4.exe (or the Python 2.3 version)

Download the installer pysqlite-2.3.2.win32-py2.4.exe to your usual download directory.

When it has finished downloading, double-click on it to run the installer. The installer window will appear, labeled Setup pysqlite-2.3.2.

On the first window of the installation dialog, click Next to begin the installation process.

On the second window, confirm the Python install directory. If you have followed the instructions above, it will be "c:\python24\". The default install directory will show as "c:\python24\Lib\site-packages\". Accept the defaults or change them to match your own directory structure. Click Next to proceed.

The next window in the dialog gives you a chance to cancel or continue. To continue, click Next.

On the next window, the installer shows you installation progress as files are written to the target locations. When the processing is complete, click Finish. If you check the contents of c:\python24\Lib\site-packages\ directory, you should see the directory pysqlite2, which contains the database scripts.
Install Subversion (optional) ¶


Trac can integrate with the Subversion version control software. Follow these steps if you'd like to use Trac with Subversion. You can learn more about how they can integrate from the wiki: TracSubversion.

This document covers using the Subversion command line tools, but you can also use the TortoiseSVN Windows GUI.

Download and run the installer for the Subversion command line tools: svn-1.4.2-setup.exe

The installation begins by displaying a small dialog titled Setup. It asks you whether you wish to continue. Click Yes.

A larger window appears, titled Setup - Subversion. The first window of the dialog says "Welcome to the Subversion Setup Wizard". Click Next. Click "I accept the agreement" and then click Next. On the next window, read the important information and click Next.

Select your destination directory for the Subversion installation. Click Next. You will then have the option of installing a Subversion menu item on the Start Menu, and a selection of places to put Subversion icons. Click Next. Finally you are ready to install. Click Next and the files will be copied to your selected destination. A couple more windows follow the install process, and then you're done.


Go back to your command line to install the Subversion Python library:

easy_install -Z http://subversion.tigris.org/dow ... 4.2.win32-py2.4.exe

Note: the "-Z" option is necessary when installing Subversion so that it is "unzipped". Trac will not be able to access Subversion if it is zipped.

The installation process will begin with "Downloading http://subversion.tigris.org/dow ... 4.2.win32-py2.4.exe" and -- if successful -- ends with "Processing dependencies for svn-python==1.4.2".
Install Trac ¶

Download and run the latest stable Trac Windows installer: trac-0.10.3.win32.exe

Note: do not run easy_install on the Trac installer. This is not currently supported and Trac will not work correctly when installed this way.

When you run the installer, it displays a window titled Setup Trac 0.10. On the first window of the installation dialog, click Next to get started. Confirm your Python directory and your intended installation directory. Click Next. Click Next again to start the installation. When the process is over, click Finish to complete the installation.
Method 4: All-In-One Step-by-Step Installation Guide ¶

This points to an external guide including setup of Subversion, Apache and other dependencies with detailed steps from scratch. It also contains some recommended installation paths and the corresponding brief but sufficent configurations in various configuration files covered (eg httpd.conf of Apache).
Getting Started ¶

Ok, now that Trac and all its requirements have been installed you can create your first project and try it out.

This example will create the projects in "C:\projects". This is a good default location, but you can put them in another drive or folder if you prefer.

Back to the command line:

md c:\projects
cd c:\projects

Optional: if you're using Trac with Subversion you can create a new repository for your source code:

md c:\projects\svn
svnadmin create c:\projects\svn\my-project

This step causes Subversion to create a subdirectory (c:\projects\svn\my-project) containing the basics of a Subversion project.
Initialize a new Trac project environment: ¶

First go to the 'Scripts' folder in your Python install directory (e.g. "\Python24\Scripts"), and add the '.py' extension onto the files 'tracd' and 'trac-admin'. Then, from the same folder, type the following at the command line:

md trac
\Python24\Scripts\trac-admin.py trac\my-project initenv

Follow the interactive prompts to input information about your project. If you are unsure what to put you can simply press "Enter" to accept the default value.

Project Name [My Project]>

Database connecting string [sqlite:db/trac.db]>

Repository type [svn]>

Path to repository [/path/to/repos]>

Template directory [C:\Python24\share\trac\templates]>

After this response, the script will say "Creating and Initializing Project". A large number of messages will scroll, finishing with "Congratulations!".

Note for Subversion users: when asked for the "Path to repository" input the folder of the repository you just created:

Path to repository [/path/to/repos]> c:/projects/svn/my-project

Note: be sure to include the full path, including the drive letter.
Try it out ¶

Trac includes a standalone webserver called tracd. You can also use Trac with other webservers, but you should first try tracd to make sure everything's set up and working correctly:

From the command line, and in the [Python Install]\Scripts directory:

tracd.py -p 8000 C:\Python24\Scripts\trac\my-project

Open your browser to http://localhost:8000 to test out your new Trac project. You should see the title "Welcome to Trac 0.10" in your browser, and in the command window from which you just launched tracd there will be a series of status log messages. These messages will continue to update as you move around the Trac site. When you are done, return to the command window from which you launched tracd and press Ctrl+Break to stop tracd.
Troubleshooting ¶
Unsupported version control system "svn" ¶

The Subversion library is not installed properly. Be sure you used the "-Z" option with easy_install when installing the Subversion bindings.
Error: Setup script exited with error: Python was built with version 7.1 of Visual Studio, and extensions need to be built with the same version of the compiler, but it isn't installed. ¶

From http://www.mail-archive.com/trac ... s.com/msg00997.html

    The problem is that the pre-built Windows binaries for PySQLite are currently not detected by setuptools, so it is trying to download and compile the sources which requires a build environment. Unfortunately this is not particularly common or easy on Windows. I have reported the problem to the PySQLite developers, so hopefully they will addresss this soon: http://initd.org/tracker/pysqlite/ticket/191

It appears you can successfully install Trac by following a combination of Method 3: Manual Installation and Method 2: Using Installers, above. The critical step for installing PySQLite is to use the self-installing EXE version, which does not trigger the bogus compile step. As noted above, download and execute the appropriate file:
PySqlite         pysqlite-2.3.2.win32-py2.4.exe (or the Python 2.3 version)

See also: the TracOnWindows/Advanced instructions, TracOnWindows/Rewrite for discussing improvements to this page and Trac0.9/TracOnWindows for the previous version of this document.
Attachments

    * trac-0.10.3-win32-install.py (11.7 kB) -All-in-one installer (not a graphical installer), added by cboos on 12/14/2006 12:25:10 PM.
我的博客
大家好才是真的好

TOP