Install OpenGrok on Ubuntu 12.04.2 LTS to browse Android source code

Source: Internet
Author: User

Http://opengrok.github.io/OpenGrok/

OpenGrok is a fastand usable source code search and cross reference engine. it helps you search, cross-reference and navigate your source tree. it can understand variousprogram file formats and version control histories like Mercurial, Git, SCCS, RCS, CVS,
Subversion, Teamware, ClearCase, Perforce, Monotone and Bazaar. inother words it lets you grok (profoundly understand) source code and isdeveloped in the open, hence the name OpenGrok. it is written in Java.

 

  1. Install ctags

If you cannot run ctags command, install it.

Apt-getinstall exuberant-ctags

 

  1. Install Tomcat

Sudoapt-get install tomcat7 tomcat7-docs tomcat7-examples tomcat7-admin

/Etc/init. d/tomcat7 restart

Sudo vim/etc/tomcat7/tomcat-users.xml // add below change password before </tomcat-users>

<Role rolename = "manager-gui"/>

<Role rolename = "admin-gui"/>

<User username = "admin" password = "root123" roles = "manager-gui, admin-gui"/>

Sudo/etc/init. d/tomcat7 restart

Directories:

/Etc/tomcat7-Global deployments

/Usr/share/tomcat7/-Program

/Etc/tomcat7/Catalina/localhost/-local Catalina configures

/Var/lib/tomcat7/-tomcat home

/Var/lib/tomcat7/webapps-applications

/Var/lib/tomcat7/work-dynamic directory, such as dynamic compiled. jsp

 

 

Another way:

From http://tomcat.apache.org/download Tomcat binary package. (apache-tomcat-7.0.42.tar.gz)

Cd/opt

Tar xvzf apache-tomcat-7.0.42.tar.gz

Cd apache-tomcat-7.0.42/bin

./Startup. Sh (use./shutdown. Sh to stoptomcat)

Visit: http: // localhost: 8080/

 

  1. Install OpenGrok

From http://opengrok.github.io/OpenGrok/ download binaray file (opengrok-0.11.1.tar.gz ).

CD/OPT

Tarxvzf opengrok-0.11.1.tar.gz

Ln-s opengrok-0.11.1 opengrok

Copy/opt/opengrok/lib/source. War to/var/lib/tomcat6/webapps or/opt/Apache-Tomcat-7.0.42/webapps /)

Visit http: // localhost: 8080/source/to confirm opengrok is installed OK.

 

  1. Configure OpenGrok

Add below line to/etc/profile. d/Hansel. Sh

Exportopengrok_instance_base =/opt/opengrok

 

Modify/opt/Apache-Tomcat-7.0.42/webapps/source/WEB-INF/Web. XML, change the path of opengrok.

<Context-param>

<Param-name> CONFIGURATION </param-name>

<Param-value>/opt/opengrok/etc/configuration. xml </param-value>

<Description> Full path to theconfiguration file where OpenGrok can read it's sconfiguration </description>

</Context-param>

 

Setup password for using opengrok web page:

Add role name to/etc/tomcat7/tomcat-users.xml

<Rolerolename = "opengrok"/>

<User username = "opengrok" password = "1234" roles = "opengrok"/>

Modify/var/lib/tomcat7/webapps/source/WEB-INF/web. xml, add below tothe bottom before "</web-app> ":

<Security-constraint>

<Web-resource-collection>

<Web-resource-name> OpenGrokWeb </web-resource-name>

<Url-pattern>/* </url-pattern>

</Web-resource-collection>

<Auth-constraint>

<Role-name> opengrok </role-name>

</Auth-constraint>

</Security-constraint>

<Login-config>

<Auth-method> BASIC </auth-method>

<Realm-name> OpenGrok </realm-name>

</Login-config>

 

  1. Create Index of source code

Cd/opt/opengrok

Mkdir data src

Cd src

Ln-s <your sourcecode> <project name>

Cd ../bin

OPENGROK_VERBOSE = true./OpenGrok index

Chown tomcat7: tomcat7 *-R

 

  1. Create symbol link

To avoid OpenGrok complain about not found/var/opengrok/when doindex using root.

Mkdir-p/var/opengrok/etc/

Ln-s/opt/opengrok/etc/configuration. xml/var/opengrok/etc/configuration. xml

 

  1. Update index automatically

Add execute/opt/opengrok/bin/OpenGrok to system crontab.

Sudo vim/etc/cron. daily/opengrok

#! /Bin/sh

/Opt/opengrok/bin/OpenGrokindex

Sudo chmod + x/etc/cron. daily/opengrok

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.