Apache + SVN + Trac + Hudson in Ubuntu

CoryRight @ iNovate Senry

The following Guide is based on my new ubuntu System, when you are following it please make some change according to your own habits.

We'd better login a root account with password. By doing so we can do operates with admin permission, and makes the installing much more convenient.

Note: you can download the needed files from:

@.@ uploading failed~ Please download and compile the needed files, noted below, by yourself.

I. Install Apache and SVN

Open your Terminal and type the following commands one by one:

apt-get install apache2

apt-get install python2.6

apt-get install libapache2-mod-python

apt-get install subversion

apt-get install python-subversion

apt-get install libapache2-svn

apt-get install python-setuptools

II. Open /etc/apache2/httpd.conf , add the following code before any other lines

[httpd.conf]

ServerName localhost:80

After configuration, have a try to see whether Apache is running well by typing the following command in your Terminal:

/etc/init.d/apache2 restart

III. Relating SVN with Apache

Typing the following command in your Terminal:

mkdir /svn/                           --Create the SVN folder

mkdir /svn/repos                     --Create a folder for repository

svnadmin create /svn/repos             --Create the SVN env in the folder

chmod 777 -R /svn/repos

Open /etc/apache2/httpd.conf , add the following code:

[httpd.conf]

<Location /svn>

DAV svn

SVNParentPath /svn

AuthType Basic   

AuthName "myproject subversion repository"

AuthUserFile /svn/passwd

AuthzSVNAccessFile /svn/auth

Require valid-user
</Location>

<Location /trac>

SetHandler mod_python

PythonInterpreter main_interpreter

PythonHandler trac.web.modpython_frontend

PythonOption TracEnvParentDir /trac

PythonOption TracUriRoot /trac

</Location>

IV. Install Trac

    Typing the following command in your Terminal:

apt-get install sqlite3

apt-get install python-pysqlite2

apt-get install python-docutils

easy_install pytz

easy_install babel

easy_install Genshi

easy_install Trac==0.11.7

mkdir /trac                           --Create Trac folder

mkdir /trac/TestProj                     --Create Test Project

trac-admin /trac/TestProj initenv            --Init the Trac Test Project env

chmod 777 -R /trac/TestProj

(

Note: When you init a Trac env, something like DB and SVN should be congifed here or later in the /conf/trac.ini. Simply, when need to use a DB, I'll type 'Enter' to use the default SQLite3 DB. And the SVN will be '/svn/repos'.

)

To make our Trac more easy to use in a GUI, we'd better install an accountmanager plugin:

easy_install http://trac-hacks.org/svn/accountmanagerplugin/0.11    We use Trac 0.11.7!! NOT the NEWEST version of Trac!!

Then open /your/trac/path/conf/trac.ini, and config the following set into relevant items:

[trac.ini]

[account-manager]

force_passwd_change = false

password_file = /svn/passwd

password_store = HtPasswdStore

......

[components]

acct_mgr.admin.accountmanageradminpage = enabled

acct_mgr.api.accountmanager = enabled

acct_mgr.htfile.htpasswdstore = enabled

acct_mgr.svnserve.svnservepasswordstore = enabled

acct_mgr.web_ui.accountmodule = enabled

acct_mgr.web_ui.loginmodule = enabled

trac.web.auth.loginmodule = disabled

acct_mgr.web_ui.registrationmodule = enabled

Open http://localhost/trac/TestProj, click on the most right link 'register', and register a user say: admin/admin.

Then edit /svn/auth:

[auth]

[groups]

developers=admin

[/]

developers=rw

*=r

a)         /etc/init.d/apache2 restart

b)         Have a try, and see if the SVN works well:

http://localhost/svn/repos

Then we turn the admin user to be Trac's administrator, type the following command in your Terminal:

trac-admin /trac/TestProj/ permission add admin TRAC_ADMIN

Then use a browser to visit http://localhost/trac, and login Trac with admin/admin.

Clicking on the 'admin' tag, and open the 'Plugin'page, upload and install some more plugins like [AdvancedTicketWorkflowPlugin][HudsonTrac][PrivateWikis][TracCodeReview][TracHTTPAuth][TracMasterTickets][TracReportManager]

(

I've put these .egg files in a fold with this document so that you will not need to compile the python projects.O(_)O~ Attention~ in this document we use Python2.6 as Python env, so the .egg files is 2.6 version as well

)

(

Note: When some plugins' installation need you to update Trac env, simply following the Message in the web page and type the command in your Terminal. If you get a PYTHON_EGG_CACHE ERROR Like: [Errno 13]Permission denied:'trac/.egg-cache' does not exist, please go to /etc/apache2/conf.d, create a "trac.conf" file and put in the following code:

[trac.conf]

PythonOption PYTHON_EGG_CACHE /tmp

)

V. Preparation for Hudson

Open /your/trac/path/conf/trac.ini, and config the following set into relevant items:

[trac.ini]

[components]

hudsontrac.* = enabled

......

[hudson]

job_url = http://localhost:8080/hudson/

main_page = http://localhost:8080/hudson/

alternate_success_icon = true

    Download JDK6 From: https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/ViewFilteredProducts-SingleVariationTypeFilter

jdk-6u21-linux-i586.bin, say I put the .bin into the top folder:

chmod u+x ./jdk-6u21-linux-i586.bin

./jdk-6u21-linux-i586.bin

mkdir /usr/local/java

mv jdk1.6.0_21 /usr/local/java/jdk6

VI. Install Hudson

download Hudson.war(I've put it in the folder with this word file :))

apt-get install tomcat6

chmod 777 -R /usr/share/tomcat6

copy hudson.war to /var/lib/tomcat6, then open http://localhost:8080/hudson

install plugins in http://localhost:8080/hudson/pluginManager/advanced upload the following plugins:

[analysis-core.hpi](The following plugins are based on this one)[analysis-collector.hpi] [analysis-collector.hpi][email-ext.hpi][findbugs.hpi] (I've put it in the folder with this word file :))

http://localhost:8080/hudson/restart

To setup the Ant task, simply copy $FINDBUGS_HOME/lib/findbugs-ant.jar into the lib subdirectory of your Ant installation:Like   /findbugs-1.3.9/lib/findbugs-ant.jar to /apache-ant-1.8.1/lib; And copy junit-4.8.1.jar to /apache-ant-1.8.1/lib

(I've put it in the folder with this word file :))

Let's use a project to test our Hudson, first import the trunk project into svn(I've put it in the folder with this word file :)) your Terminal:

svn import /pathto/trunk/ file:///svn/repos/trunk

When a message pops up, use ctrl + x, then type c(continue), type enter.

Note:

You'd better setup your environment first. Like editing /etc/environment and add

[environment]

......

JAVA_HOME="/usr/local/java/jdk6"

HUDSON_HOME="/usr/local/Hudson"

FINDBUGS_HOME="/usr/local/findbugs-1.3.9"

CLASSPATH="/usr/local/java/jdk6/lib"

expert JAVA_HOME

expert HUDSON_HOME

expert FINDBUGS_HOME

expert CLASSPATH

......

Open http://192.168.16.100:8081/hudson/configure to config your Hudson.

Usually we only need to setup some environment like: JDKAntMaven

Open http://192.168.16.100:8081/hudson/view/All/newJob and create a new "Build a free-style software project " Hudson job, setup as following:

Project name: TestJob

JDK: Select the JDK you seted in the Hudson setup.

Source Code Management:

Subversion ---Repository URL:http://localhost/svn/repos/trunk, enter authentication if required.

Build:

Invoke ANT: click Advanced, in the Build File, type in:build.xml

Invoke ANT: test/build.xml

Invoke ANT: findbugs.xml

Post-build Actions:

click on Publish FindBugs analysis results , type in: trunk/findbugs/*.xml

click on Publish JUnit test result report , type in: trunk/test/Testresults/report/*.xml

Click Save

Click Build Now and see the resultJ

If you get any problems, please contact me, my e-mail is senryxie@gmail.com.

作者:Senry,转载本文时,必须以超链接的形式标明文章的原始出处!
网址:
 | 1 Comment | EDIT
相关日志

Advertisements

  • 史蒂夫•乔布斯传(精装珍藏版,附印作者签章)
  • 黑客:计算机革命的英雄
  • HTML5揭秘
  • 卓越购书,满一百返20。
  • 1条留言

    Huge time saver, thanks a lot!

    留言

    曙光博客订阅 曙光博客邮件订阅 曙光博客视频
    • Bluehost虚拟主机
    • MediaTemple虚拟主机
    • Hostgator虚拟主机
    • Hostmonster虚拟主机

    推荐文章

    PhotoShop CS5官方下载地址+注册机下载 PhotoShop CS5官方下载地址+注册机下载
    Dropbox Dropbox
    10个免费的在线QR码生成网站 10个免费的在线QR码生成网站
    免费Gmail备份工具 免费Gmail备份工具
    WordPress备份插件汇总 WordPress备份插件汇总
    无觅相关文章插件,快速提升流量