01.05.02 개발환경구축
개요#
소스코드 관리 툴인 Subversion과 이슈 트래킹 및 위키로 사용할 수 있는 Trac을 설치하는 과정을 담은 문서
기본 환경#
VPS(cafe24)
Fedora9 x86 64bit
Apache
PHP
Mysql
설치 과정#
yum 명령어를 통한 subversion, trac 설치
- [root@thinkingim etc]# yum install trac subversion mod_python
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* fedora: ftp.yz.yamagata-u.ac.jp
* updates: ftp.yz.yamagata-u.ac.jp
Setting up Install Process
Parsing package install arguments
Package subversion-1.4.6-7.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package trac.noarch 0:0.10.4-2.fc9 set to be updated
--> Processing Dependency: python-clearsilver >= 0.9.3 for package: trac
---> Package mod_python.x86_64 0:3.3.1-7 set to be updated
--> Running transaction check
---> Package python-clearsilver.x86_64 0:0.10.5-4.fc9 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================
Package
=============================================================================
Installing:
mod_python
trac
Installing for dependencies:
python-clearsilver
... - ...
- Installed:
- mod_python.x86_64 0:3.3.1-7
- trac.noarch 0:0.10.4-2.fc9
Dependency Installed: - python-clearsilver.x86_64 0:0.10.5-4.fc9
Complete!
- Subversion은 이미 설치되어 있음을 확인 할 수 있었으며, Trac은 Python 언어 기반이기 때문에, Apache에서 사용하는 mod_python, trac 패키지 그리고 의존성인 python-clearsilver를 설치하였다.
svn, trac관리 폴더 만들고, 권한을 apache 권한 주기
- [root@thinkingim home]# mkdir -p /home/svn
- [root@thinkingim home]# mkdir -p /home/trac
- [root@thinkingim home]# chgrp apache /home/trac/
[root@thinkingim home]# chgrp apache /home/svn/
Svn(Subversion), Trac 프로젝트 구축#
Subversion#
svn의 Repository(저장소) 만들기
- [root@thinkingim root]# cd /home/svn
- [root@thinkingim svn]# svnadmin create test_project
svn 권한
- [root@thinkingim conf]# vi /home/svn/test_project/conf/svnserve.conf
- [general]
anon-access = read // #(주석처리) 제거
auth-access = write // #(주석처리) 제거
password-db = passwd // #(주석처리) 제거
authz-db = authz // #(주석처리) 제거
realm = Test Project Repository // #(주석처리) 제거
- anon-access : 로그인 하지 않은 사람들의 접근 권한
- auth-access: 로그인을 한 상태에서의 접근 권한
- password-db : 아이디와 패스워드를 저장하고 있는 파일 이름
- authz-db : 데이터베이스의 접근 권한을 설정하는 파일 이름
- realm : svn Repository의 이름
svn 유저 만들기
- [root@thinkingim conf]# vi /home/svn/test_project/conf/passwd
- [users]
아이디 = 패스워드
svn 유저 권한 설정
-
[root@thinkingim conf]# vi /home/svn/test_project/conf/authz
[groups]
admin= admin, morenice
[/]
@admin = rw
* = r
개인이나 그룹을 직접 입력하여 정한 다음에, 디렉토리 별 권한을 설정한다. *은 groups에 포함되지 않는 아이디에 대한 처리이다.
* 부분(groups에 포함되지 않는 아이디)에 대해 명시를 하지 않으면, svn이 정상적으로 동작하지 않는다.
svn 서버 가동
- [root@thinkingim svn]# svnserve -d -r /home/svn/
위와 같은 명령어를 사용하면 svn 서버에 접속할 수 있다. 현재 VPS서버에서는 서버 가동중.
svn 사용하기
- 예를 들어 위에서 만든 test_project의 코드에 다운받을수도 있고, 내용을 업로드 하여 변경할 수 있다.
-
나머지 부분은 svn 문서나 웹을 이용하여 숙지하도록 합시다. ^^ ( svn status, svn ci, ... )
- co(check out ) : 코드 가져오기
- [root@thinkingim /]#
- svn co svn://Svn_Server_IP/test_project ./test_project
- 서버로 부터 다운로드 받아서 현재 폴더에 적용됨...
- 기본 디렉토리 만들기 ( trunk, tags, branches )
[morenice@thinkingim test_project]$ svn mkdir trunk
A trunk
[morenice@thinkingim test_project]$ svn mkdir tags
A tags
[morenice@thinkingim test_project]$ svn mkdir branches
A branches- [morenice@thinkingim test_project]$ svn ci -m "init directory"
- Adding branches
Adding tags
Adding trunk
Committed revision 1.
- 다른 사람이 변경한 사항 자신의 개발 폴더에 반영시키기(변경사항 적용)
- [morenice@thinkingim test_project]# svn update
Trac#
문제가 발생하였을 경우 다음 링크에서 확인하여 해결하시길 바랍니다.
Trouble Shooting : Trac 프로젝트 설정
Trac 사이트 만들기
- svnadmin으로 svn repository를 만들어 놓았다면, trac 사이트는 쉽게 만들 수 있다.( trac-admin)
- [root@thinkingim /]# cd /home/trac/
- [root@thinkingim trac]# trac-admin test_project initenv
- # trac-admin 폴더생성이름 initenv(초기생성명령어)
- .
- .
- Project Name [My Project]> test_project # 프로젝트명
- Database connection string [sqlite:db/trac.db]> #엔터입력
- Repository type [svn]> #엔터입력
-
Path to repository [/path/to/repos]> /home/svn/test_project
#svn에서 만든 repository를 지정
Templates directory [/usr/share/trac/templates]> #엔터입력
.
Congratulations!
아파치 연동을 위한 폴더 그룹 설정
- [root@thinkingim trac]# chgrp apache test_project/ -R
-
[root@thinkingim trac]# chmod 775 db
[root@thinkingim trac]# chmod 775 db/trac.db
Trac 유저 및 패스워드 설정
- [root@thinkingim conf]# cd /home/trac/test_project/conf/
- [root@thinkingim conf]# htpasswd -cm passwd morenice
- #htpasswd -cm 파일명 ID
New password:
Re-type new password:
Adding password for user morenice
- htpasswd는 암호화된 패스워드를 만들어주는 명령어이다. -c 는 처음 파일을 만들 때 사용하는 것이고 -m은 멤버를 추가할 때 사용하는 것이다. 처음 만들 때만 -cm 옵션을 사용하면 되고 다음부터는 -m 옵션만 주면 된다.
Trac과 아파치 연동
- 방화벽 설정 ( http인 80포트를 개방 ) -> 초기 한번만 세팅 하면됨
- [root@thinkingim html]# iptables -I INPUT -p tcp --dport 80 -j ACCEPT
- [root@thinkingim etc]# /etc/init.d/iptables save
-
Apache에서의 Trac 웹 환경설정 관리
- 한가지가 아닌, 다양한 개발환경을 제공 가능한 환경을 위하여 conf파일도 분할하여 관리
- /etc/httpd/conf.d/trac 폴더안에 각 프로젝트 마다 파일을 만들어서 웹 디렉토리를 할당.
- [root@thinkingim etc]# cd /etc/httpd/conf.d/
- [root@thinkingim conf.d]# mkdir trac
- [root@thinkingim conf.d]# mv trac.conf ./trac
[root@thinkingim conf.d]# vi ./trac/trac.conf - .
- .
- #안의 내용을 전부 주석처리. 특이한 사항이나 옵션을 trac.conf에 명시하는 것으로 하자.
- [root@thinkingim conf.d]# cd /etc/httpd/conf/
- [root@thinkingim conf.d]# vi httpd.conf
- ...
- ..
- Include conf.d/*.conf
- Include conf.d/trac/*.conf # 한줄 추가(trac의 환경설정 파일을 참조함)
- ...
- ...
-
Trac과 Apache 연동을 위한 conf 파일 설정
- '파일이름.conf' 형식으로 파일 생성
- [root@thinkingim conf.d]# cd /etc/httpd/conf.d/trac
- [root@thinkingim conf.d]# vi test_project.conf
-
test_project.conf의 내용. 복사하여 저장
- 만들 trac페이지는 '프로젝트이름_project'의 이름을 갖게 하여 중복되는 페이지가 생기지 않게 합시다.
# Replace all occurrences of /srv/trac with your trac root below
# and uncomment the respective SetEnv and PythonOption directives.
# test_project
#
<LocationMatch /test_project> # 이 부분은 thikingim.cafe24.com/test_project
SetEnv TRAC_ENV /home/trac/test_project # 연결해줄 trac 디렉토리
</LocationMatch>
<IfModule mod_python.c>
<Location /test_project/mpinfo> # 주의! test_project부분을 만들 프로젝트 페이지에 맞게.
SetHandler mod_python
PythonHandler mod_python.testhandler
</Location>
<Location /test_project> # 주의! test_project부분을 만들 프로젝트 페이지에 맞게.
SetHandler mod_python
SetEnv PYTHON_EGG_CACHE /usr/lib/python2.5/site-packages/
PythonHandler trac.web.modpython_frontend
PythonInterpreter main_interpreter
PythonOption TracEnv /home/trac/test_project
</Location>
<Location /test_project/login> # 주의! test_project부분을 만들 프로젝트 페이지에 맞게.
AuthType Basic
AuthName "test_project"
AuthUserFile /home/trac/test_project/conf/passwd # 위에서 만든 project 패스워드파일 경로 지정
Require valid-user
</Location>
</IfModule>
test_project의 Trac의 변경 사항을 적용, 아파치 재 시작
- 아파치의 환경설정 파일(conf)을 적용하긴 위해서는 아파치를 재시작해야함
- [root@thinkingim trac]# cd /home/trac
- [root@thinkingim trac]# trac-admin test_project upgrade
Database is up to date, no upgrade necessary.
[root@thinkingim trac]# trac-admin test_project resync
Resyncing repository history...
1 revisions cached. Done. - [root@thinkingim trac]# killall -9 httpd
- [root@thinkingim trac]# /usr/sbin/httpd -k start -f /etc/httpd/conf/httpd.conf
trac 컴포넌트 등록 및 유저 권한 설정
- [root@thinkingim trac]# vi /home/trac/test_project/conf/trac.ini
-
....[components]
# 이하 강력 추천
webadmin.* = enabled
# 이하 추천
timingandestimationplugin.* = enabled
tracsearchall.* = enabled
tractimevisualizerplugin.* = enabled
worklog.* = enabled
tracrpc.* = enabled
tracdnd.* = enabled
burndown.* = enabled -
... -
[root@thinkingim trac]# trac-admin /home/trac/test_project permission add "USER_ID" TRAC_ADMIN # 권한 설정
참고 문서#
History
Last edited on 04/03/2009 18:30 by moreNice
Comments (0)