trac 설치 과정이 좀 복잡했다. 무려 7가지나 되는것들을 설치해줘야 한다. 그것도 Windows Installer 를 사용하니 그나마
과정이 조금 단순화 된 것이다.

 지금부터는 trac 을 처음 사용하기 위해 관련한 설정을 해보도록 한다.
 여기서는 teamjoon이라는 이름의 테스트 프로젝트를 신규 프로젝트로 한다.


1. 새 Trac 프로젝트 생성

 <python디렉토리>\Scripts\trac-admin.exe 를 통하여 신규 프로젝트를 생성할 수 있다.

 그 전에, trac 환경 디렉토리(projenv)를 생성해야 한다.
 E:\TeamBuild\trac_project 디렉토리를 trac 프로젝트 루트 디렉토리로 사용하겠다.
 그리고, 하위 디렉토리에, 프로젝트 이름으로 teamjoon 이라는 디렉토리를 만든다.

E:\TeamBuild\python2.5.4\Scripts\trac-admin.exe  E:\TeamBuild\trac_project\teamjoon initenv

그럼 이때부터 여러가지를 물어온다.

Project Name [My Project]> teamjoon
...
Database connection string [sqlite:db/trac.db]> (그냥 엔터)
...
Repository type [svn]> (SVN 사용할 것임. 그냥 엔터)
...
Path to repository [/path/to/repos]> E:\TeamBuild\repository\teamjoon
...

모두 끝내면 다음과 같이 메세지 나온다.

---------------------------------------------------------------------
Warning: couldn't index the repository.

This can happen for a variety of reasons: wrong repository type,
no appropriate third party library for this repository type,
no actual repository at the specified repository path...

You can nevertheless start using your Trac environment, but
you'll need to check again your trac.ini file and the [trac]
repository_type and repository_path settings in order to enable
the Trac repository browser.

---------------------------------------------------------------------
Project environment for 'teamjoon' created.

You may now configure the environment by editing the file:

  E:\TeamBuild\trac_project\teamjoon\conf\trac.ini

If you'd like to take this new project environment for a test drive,
try running the Trac standalone web server `tracd`:

  tracd --port 8000 E:\TeamBuild\trac_project\teamjoon

Then point your browser to http://localhost:8000/teamjoon.
There you can also browse the documentation for your installed
version of Trac, including information on further setup (such as
deploying Trac to a real web server).

The latest documentation can also always be found on the project
website:

  http://trac.edgewall.org/

Congratulations!

위 메세지 중, Warning 은 우선 무시하자. SVN Repository 에 아무런 내용이 없어서 그런다.
이는 나중에 SVN 설정하면서 해결한다.

모두 끝나면, E:\TeamBuild\trac_project\teamjoon 디렉토리에 디렉토리와 파일들이 생성되었는지 확인한다.


2. Apache 에 VirtualHost 추가

Apache 에 Virtual Host 를 추가해서, <ContextRoot>/trac 이하의 URI에 대하여, trac 이 핸들링하도록 한다.

아래 예에서는, tractest.mrjoon.com 도메인을 추가해서, 해당 도메인 밑의 /trac 이하의 URI (Location) 은,
trac 이 처리하도록 하고, /trac/<아무거나>/login 에 대해서는, 사용자 인증을 htpasswd 파일을 이용하여 하도록 설정한다.

 <VirtualHost *:80>
  ServerAdmin korean44@empal.com
    ServerName tractest.mrjoon.com
    ErrorLog "logs/dummy-host.mrjoon.com-error.log"
    CustomLog "logs/dummy-host.mrjoon.com-access.log" common

  #--- URL 에 /trac 있으면, mod_python 이 처리하도록 함
  #--- E:\TeamBuild\trac_project 디렉토리가 기본 디렉토리가 됨
  <Location /trac>
   SetHandler mod_python
   PythonHandler trac.web.modpython_frontend
   PythonOption TracEnvParentDir E:\TeamBuild\trac_project
   PythonOption TracUtiRoot /trac
  </Location>
  
  #--- trac/XXX/login 요청 시 인증 필요함
  <LocationMatch "/trac/[^/]+/login">
   AuthType basic
   AuthName "Trac"
   AuthUserFile E:\TeamBuild\repository\teamjoon\htpasswd
   Require valid-user
  </locationmatch>
</VirtualHost>

위 설정 중에, <VirtualHost > 의 속성 중에, DocumentRoot 가 지정되어있지 않는것에 주의하자.
DocumentRoot 를 지정하면, Location 지정한 것들이 동작하지 않는다~!


3. Admin 계정 추가

위에서, E:\TeamBuild\repository\teamjoon\htpasswd 파일 에 사용자 계정이 등록된다라고 설정을 했다.
아직 htpasswd 파일이 없으므로, 만들어 넣어야 한다.

Apache 의 bin 디렉토리에서 아래 명령을 실행한다.
htpasswd.exe -c E:\TeamBuild\repository\teamjoon\htpasswd admin

명령을 실행하면, 패스워드를 물어보고, 위 디렉토리의 htpasswd 파일에 admin 계정을 생성한다.

다음으로, 위에서 추가한 admin 계정을 Trac 의 admin 권한의 계정으로 등록해야 한다.
아래와 같은 명령을 <trac설치디렉토리>/Scripts 디렉토리에서 실행한다.

trac-admin.exe E:\TeamBuild\trac_project\teamjoon permission add admin TRAC_ADMIN

trac-admin 의 명령형식은,
trac-admin <trac 환경디렉토리> <command> ... 이다.

permission 추가 명령은,
permission add <User> <Rule> 이다.
TRAC_ADMIN 은, 관리자 룰이다. 이외의 다양한 룰은, http://trac.edgewall.org/wiki/TracPermissions 에서 Help 를 참고할 수 있다.

설정 완료한 후에, http://tractest.mrjoon.com/trac/teamjoon 으로 접속하여, login 을 admin 으로 하면, 화면 상단 메뉴에, Admin 메뉴가 보일 것이다.

반응형

'Software Development > Dev Tools' 카테고리의 다른 글

[Trac] 권한 설정하기  (1906) 2009.10.16
[trac] 기본 에디터 대체 플러그인  (1198) 2009.10.14
[Trac] Ticket 삭제하려면..  (494) 2009.10.14
[Trac] 필수 플러그인 설치 및 설정 #3  (496) 2009.10.11
[Trac] Trac 설치하기 #1  (1194) 2009.10.10
블로그 이미지

Good Joon

IT Professionalist Since 1999

,