Chinaunix首页 | 论坛 | 博客
  • 博客访问: 405150
  • 博文数量: 59
  • 博客积分: 1510
  • 博客等级: 上尉
  • 技术积分: 857
  • 用 户 组: 普通用户
  • 注册时间: 2009-06-03 11:50
文章分类

全部博文(59)

文章存档

2011年(1)

2010年(36)

2009年(22)

我的朋友

分类: LINUX

2010-06-23 22:52:39

摘自:http://blog.chinaunix.net/u/18818/showart_2216303.html

A. 前期准备:

Step 1: 安装Subversion及其他相关组件
        #yum install subversion*
Step 2: 安装Trac及其相关组件
        #yum install trac-*
Step 3: 安装Sqlite及其相关组件
        #yum install sqlite*
Step 4: 安装mod_dav_svn及其相关组件
        #yum install mod_dav_svn
Step 5: 安装mod_ssl及其相关组件
        #yum install mod_ssl


B. 建立SVN仓库以及配置Trac环境
Step 6: #mkdir -p /scm/trac /scm/svn /scm/auth
Step 7: #svnadmin create --fs-type fsfs /scm/svn/proA
Step 8: #svnadmin create --fs-type fsfs /scm/svn/proB
Step 9: #trac-admin /scm/trac/proA initenv
Step10: #trac-admin /scm/trac/proB initenv
Step11: #chown -R apache.apache /scm/svn
Step12: #chown -R apache.apache /scm/trac
Step13: #chown -R apache.apache /scm/auth
Step14: #chown apache.apache /scm
Step15: #chmod 0700 /scm /scm/auth
Step16: #chown -R apache.apache /scm/auth


C. 配置apache的SSL
Step17: 制作服务器证书和密钥
        #cd /etc/pki/tls/
        #openssl req -new -x509 -extensions v3_ca -keyout private/trac.key -out certs/trac.crt -days 1825
        #openssl rsa -in private/trac.key -out private/trac.key
Step18: 修改/etc/httpd/conf.d/ssl.conf
    SSLCertificateFile /etc/pki/tls/certs/localhost.crt
    -->SSLCertificateFile /etc/pki/tls/certs/trac.crt

    SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
    -->SSLCertificateKeyFile /etc/pki/tls/private/trac.key


D. 制作apache用户及其密码
Step19: #htpasswd -c -m /scm/auth/trac_svn.passwd username1
Step20: #htpasswd -m /scm/auth/trac_svn.passwd username2
Step21: #chown apache.apache /scm/auth/trac_svn.passwd


E. 修改WebDAV和SVN配置(我把我的配置文件贴在下面)
Step22: 修改/etc/httpd/conf.d/subversion.conf
================================================================================================
LoadModule dav_svn_module     modules/mod_dav_svn.so
LoadModule authz_svn_module   modules/mod_authz_svn.so

#
# Example configuration to enable HTTP access for a directory
# containing Subversion repositories, "/var/www/svn".  Each repository
# must be both:
#
#   a) readable and writable by the 'apache' user, and
#
#   b) labelled with the 'http_sys_content_rw_t' context if using
#   SELinux
#

#
# To create a new repository "" using
# this configuration, run as root:
#
#   # cd /var/www/svn
#   # svnadmin create stuff   
#   # chown -R apache.apache stuff
#   # chcon -R -t -t http_sys_content_rw_t stuff
#


   DAV svn
   SVNParentPath /scm/svn/

   # Limit write permission to list of valid users.
  
      # Require SSL connection for password protection.
      SSLRequireSSL

      AuthType Basic
      AuthName "Please enter your name and password"
      AuthUserFile /scm/auth/trac_svn.passwd
      Require valid-user
  


================================================================================================

Step23: 修改/etc/httpd/conf.d/trac.conf
================================================================================================


    SetHandler mod_python
    PythonHandler trac.web.modpython_frontend

    # "/svn/trac/foobar" is the folder you gave to trac-admin initenv earlier
    #PythonOption TracEnv /srv/trac/foobar
    PythonOption TracEnvParentDir /scm/trac/

    # "/trac" is the same as the Location above
    PythonOption TracUriRoot /trac


    # "/tmp" should be some writable temporary directory
    SetEnv PYTHON_EGG_CACHE /tmp
    #SetEnv TRAC_ENV "/scm/trac/sgec"

    # "trac" can be any string, but must be the same for all
    # Trac instances on the same Apache install
    PythonInterpreter trac

    # Authentification when get the home page
    AuthType Basic
    AuthName "LinkTronix SCM"
    AuthUserFile /scm/auth/trac_svn.passwd
    Require valid-user
    SSLRequireSSL


================================================================================================

Step24: 更改SELinux规则
        #chcon -R -t httpd_sys_content_t /usr/share/trac/
        #chcon -R -t httpd_sys_content_t /scm/
Step25: 安装Trac-webadmin插件于WebAdmin
        #yum install trac-webadmin
Step26: 建立软链接/etc/trac
        #ln -s /etc/trac/trac.ini /usr/share/trac/conf/trac.ini
Step27: 修改Trac.ini(以下是我修改后的配置文件)

================================================================================================
# -*- coding: utf-8 -*-
[inherit]

plugins_dir = /etc/trac/plugins.d/
templates_dir = /etc/trac/templates.d/

[logging]

## log_format =
log_level = WARN
log_type = syslog
## log_file = /var/log/trac.log

[ticket-workflow]

accept = new -> assigned
accept.operations = set_owner_to_self
accept.permissions = TICKET_MODIFY
leave = * -> *
leave.default = 1
leave.operations = leave_status
reassign = new,assigned,reopened -> new
reassign.operations = set_owner
reassign.permissions = TICKET_MODIFY
reopen = closed -> reopened
reopen.operations = del_resolution
reopen.permissions = TICKET_CREATE
resolve = new,assigned,reopened -> closed
resolve.operations = set_resolution
resolve.permissions = TICKET_MODIFY

[trac]

authz_file = /etc/httpd/conf.d/AUTH.policy
auto_reload = true
base_url = ##URL_OF_WEB_SERVER_ROOT##
check_auth_ip = true
database = sqlite:db/trac.db
default_charset = iso-8859-15
default_handler = WikiModule
## default_timezone =
## htdocs_location =
ignore_auth_case = false
mainnav = wiki,timeline,roadmap,browser,tickets,newticket,search
metanav = login,logout,settings,help,about
permission_policies = AuthzPolicy, DefaultPermissionPolicy, LegacyAttachmentPolicy
permission_store = DefaultPermissionStore
repository_type = svn
## request_filters =
timeout = 5


[search]

min_query_length = 3


[attachment]

max_size = 262144
render_unsafe_content = false

[components]

webadmin.* = enabled


[ticket]

default_component =
default_milestone =
default_priority = major
default_type = defect
default_version =
restrict_owner = false


[wiki]

ignore_missing_pages = false
render_unsafe_content = true
split_page_names = false


[timeline]

changeset_long_messages = false
changeset_show_files = 0
default_daysback = 30
ticket_show_details = false


[browser]

downloadable_paths = /trunk, /branches/*, /tags/*
hide_properties = svk:merge
render_unsafe_content = true


[changeset]

max_diff_bytes = 10000000
max_diff_files = 0
wiki_format_messages = true


[doxygen]

default_documentation =
encoding = iso-8859-1
ext = htm html png
## html_output =
index = main.html
path = /var/lib/trac/doxygen
source_ext = idl odl java cs py php php4 inc phtml m cpp cxx c hpp hxx h
title = Doxygen
## wiki_index =


[mimeviewer]

enscript_modes = text/x-dylan:dylan:4
enscript_path = enscript
max_preview_size = 262144
mime_map = text/x-dylan:dylan,text/x-idl:ice,text/x-ada:ads:adb
php_path = php
silvercity_modes =
tab_width = 8


[mtn]

cachespec = localmem
mtn_binary = /usr/bin/mtn
## xtracerts =


[notification]

## always_notify_owner = true
## always_notify_reporter = true
## always_notify_updater = true
## mime_encoding = base64
## smtp_always_bcc =
## smtp_always_cc =
## smtp_default_domain =
## smtp_enabled = false
## smtp_from =
## smtp_password =
## smtp_port = 25
## smtp_replyto =
## smtp_server =
## smtp_subject_prefix = __default__
## smtp_user = trac
## use_public_cc = false
## use_short_addr = false
## use_tls = true
================================================================================================
Step28: 给Trac设置管理员帐号
        #trac-admin /scm/trac/proA permission add yourname TRAC_ADMIN
Step29: 重新启动apache
        #service httpd restart
Step30: 测试subversion---
Step31: 测试trac---

************************************************************************************************
ISSUES:
关于在客户端安装证书,以及如何正常的在Internet Explorer运行,请参阅其他文章。
阅读(1415) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~