Installing OpenGrok and Tomcat 7 on Ubuntu 13.04 quickly

If you are a developer you need a good source code navigator. I have used cscope to navigate and edit code directly from my terminal dismissing any graphical user interface but some people like to use the sourcenav or net beans ecosystem. However both are graphically nice but are “heavy” apps and also, if you want to share a way with your co-workers how to browser your code you will need to install the apps in different desktops.

But what about to have a fast way to navigate in your code, have fast crossed references  and share your source code with your co-workers dismissing the installation of source navigators on different desktops using your web browser ?

If you need something like this or if you wants a fast and easy installation of a good source navigation, I recommend OpenGrok. To be honest, even if I do not need to share my code with anyone, I use in my machine only for my personal code browsing.

OpenGrok runs as a webapp that means you and your co-workers can use your favorite browser navigator. Chrome, Firefox, Internet Explorer, whatever! you only need your preferable one to enjoy the code.

Considering OpenGrok is web based you will need to install a web server to be used as servlet server. OpenGroks supports Tomcat or Glassfish.

I am personally using tomcat 7 in my ubuntu 13.04. Let’s see the 3 basic steps:

Step 1) Installing Tomcat 7 quickly

To install the tomcat 7 you need to run:

sudo apt-get install default-jdk tomcat7

Let’s discover the tomcat base dir and set the CATALINA var in your bashrc. To discover the base dir to the following:

cd /usr/share/tomcat7/bin/


You will see something like this as output:

Using CATALINA_BASE: /usr/share/tomcat7
Using CATALINA_HOME: /usr/share/tomcat7
Using CATALINA_TMPDIR: /usr/share/tomcat7/temp
Using JRE_HOME: /usr
Using CLASSPATH: /usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar

Then edit your ~/.bashrc and include using the directory pointed by CATALINA_BASE include the following var:

export CATALINA_HOME=/usr/share/tomcat7/


Run the tomcat and check if it is working:

. /etc/init.d/tomcat7

Done!!! installed!!!! Check if it is running now!!! Using your favorite browser type in the web address: http://localhost:8080/

If ok you should see a web page with message “It works!”


Step 2) Installing OpenGrok

2.1) Install the exuberant C tags:

sudo apt-get install exuberant-ctags

2.2) Then goto and download the last binaries available on this page for example opengrok-0.11.1.tar.gz.

2.3) Unzip and untar in some directory.


tar -zxvf opengrok-0.11.1.tar.gz

2.4) Create and prepare the directories with source code link and OpenGrok data. Here you need to create a directory called “src” and another one “data” in same dir level.

After that, in the src directory you can create a soft link to your real code directory that can be in your local machine or a mapped driver in the network.


mkdir local_src
cd local_src/
mkdir data src
cd src/
ln -s ~/code/base/mir/ mir

On the example above the real code is in the ~/code/base/mir/ but I just created a soft link called “mir” in the local_src dir.

2.5) Set the env variable to point to your code.

Edit you ~/.bashrc again and include:

export OPENGROK_INSTANCE_BASE=/home/mcramon/local_src

if you do not set this variable, the OpenGrok will search for directories in the /var/opengrok directory. If you prefer on this way you can create the following dirs:

sudo mkdir -p /var/opengrok/src

sudo mkdir -p /var/opengrok/data

sudo mkdir -p /var/opengrok/etc

and then you create your soft link to your code in the /var/opengrok/src directory.

Step 3) Deploying, indexing and running the OpenGrok

Step 3.1) Make a fast test deploying the OpenGrok webapp running the following line in your shell:

~/tools/opengrok/opengrok-0.11.1/bin$ sudo ./OpenGrok deploy
Loading the default instance configuration ...
Installing /home/mcramon/tools/opengrok/opengrok-0.11.1/bin/../lib/source.war to /var/lib/tomcat7/webapps ...

Start your application server (Tomcat), if it is not already
running, or wait until it loads the just installed web application.

OpenGrok should be available on <HOST>:<PORT>/source
where HOST and PORT are configured in Tomcat.

Now using your web browser type the following address: http://localhost:8080/source/

You should be able to see the OpenGrok deployed to your tomcat but not code added to be navigated.


If you have some problems executing the deployment, make sure the script is updated with your tomcat version. In my case, I installed the tomcat7 and my opengrok version did not support this version 7. So I changed the OpenGrok script including my version as the pic below:


Step 3.2) Index your code

If the deployment work fine, and if you already created your source code link, then you should index the database typing in your terminal.

mcramon@ubuntu:~/tools/opengrok/opengrok-0.11.1/bin$ sudo ./OpenGrok index

Depending how big is your code it can take several minutes to finish. It is common to have messages saying “there is no history” in the source… to now worry about those messages because it is searching for some control version history provided by git or other cm tools.

Step 3.3) Run!!!!

When the index finish, only refresh your browser screen again (F5) and check if you can see the project listed in a combo-box in the right side of your window. This project will have the same directory name you have to your soft link.


Step 3.4) Share with your friends

Your friends/co-workers can see the code accessing the following addresses: <IP>:<PORT>/source or <hostname>:<PORT>/source

Simple like that!

Of course, OpenGrok and Tomcat are must powerful and this post is only a fast way to start the code browsing… check the OpenGrok and Tomcat sites for advanced topics.


97 thoughts on “Installing OpenGrok and Tomcat 7 on Ubuntu 13.04 quickly

  1. Hi, I followed the steps and installed version opengrok-0.12.1 on Ubuntu 14.04 64 bit as the mentioned version is not available on the specified download directory.

    I can see the source directories listed under the In Projects section. But when I click on the source code I get error.

    Error: File not found!

    The requested resource is not available. The source root specified in your configuration does not point to a valid directory! Please configure your webapp.

    Any suggestions ?

    • Hi Niranjan

      This post is a little bit old and the versions used are outdated now. I will need to update my machines on this week and I will update this post. Send me an email to and it will be my please to keep you informed with the most new procedure!!!

  2. Hi @manoelramon,

    I am facing same problem. We were installed java 8 and tomcat 8 on Centos 7 OS

    You may contact me on

    Error: File not found!

    The requested resource is not available. The source root specified in your configuration does not point to a valid directory! Please configure your webapp.

  3. Pingback: converse embroidery canvas action green uk trainers

  4. Pingback: womens air max air max 2015

  5. Pingback: glitter Adidas NMD R2

  6. Pingback: big boys youth kd 9 flyknit oreo black white

  7. Pingback: 蟹械谢械薪褘泄 胁芯谢褜褌 puma platform

  8. Pingback: uk trainers nike air max 180 em marron

  9. Pingback: puma ignite pink glaze

  10. Pingback: in shape black gs asics gel gt ii peachwater blue h502n

  11. Pingback: wholesale womens limited kevin rader 46 green bay packers jersey

  12. Pingback: nike nike free 30 v3

  13. Pingback: nike free 50 2014

  14. Pingback: nike black white red orbitblack nike epic react flyknit mens

  15. Pingback: advance 8673 vintage pattern 1958 off the shoulder dress roll collar ties in back by sydcam123

  16. Pingback: uk trainers balenciaga ligne match low top canvas amber

  17. Pingback: marr贸n nike dunk hi

  18. Pingback: update adidas yeezy boost 350 v2 butter drop today

  19. Pingback: 芯褉邪薪卸械胁褘泄 褋械褉械斜褉褟薪褘泄 adidas j wall 2

  20. Pingback: shoes mens navy blue 762826 882 nike air huarache ultra id

  21. Pingback: online world anti theft backpack with usb charging port office bag

  22. Pingback: ladies white puma trainers

  23. Pingback: acg nike boots grey

  24. Pingback: richoose fashion womens winter wool cute cat ears knit beanie hats black

  25. Pingback: adidas f50 adizero ii prime fg blue white electricity

  26. Pingback: stella mccartney small falabella backpack

  27. Pingback: jordan rulez white blue silver black white red

  28. Pingback: asics gel stratus 2.1 salmon

  29. Pingback: puma soleil

  30. Pingback: the north face anden triclimate jacket double layer mens winter jacket size

  31. Pingback: pachyderm power 10 000mah portable device charger power bank charges two iphones on a pet

  32. Pingback: mens nike sb janoski max suede

  33. Pingback: converse chuck ii two tone leather ox m japanese eggplant lilacwhite converse me

  34. Pingback: jet set vanilla michael kors

  35. Pingback: riddell speedflex inside

  36. Pingback: girls shoesjordan air jordan 1 retro highanthraciteblack black hyper pink332148

  37. Pingback: universal 4 channel 433 315 mhz gate garage door cloning remote control key fob

  38. Pingback: rucksack white women accessories bags rucksacksby guess storeusa official shop

  39. Pingback: beautiful pajamas ladies burgundy

  40. Pingback: womens shoes nike womens downshifter 5 wide running s

  41. Pingback: indoor sport shoes green black basketball shoes for men super light basketball sneakers cheap high

  42. Pingback: shop womens the north face black size xs vests at a discounted price at poshmark description size small fits more like xs sold by fast delivery

  43. Pingback: 蟹械谢械薪褘泄 泻褉邪褋薪褘泄 nike zoom witness

  44. Pingback: womens nike ultra moire

  45. Pingback: svart chuck taylor all star sneakers dam by converse sverige

  46. Pingback: beautiful hugo boss glasses eyeglasses frames for

  47. Pingback: foliage green convertible fleece beanie cap polyester face mask

  48. Pingback: girls hopsack blazer

  49. Pingback: curly pear flower horse hair wig azbro

  50. Pingback: cheap sport shoes white black white mens hyperdunk 2018 low

  51. Pingback: graceful sleek pearl inlay resin black flower round frame sunglasses cheap

  52. Pingback: menu puma kevler runner jr 186299 03

  53. Pingback: nike air jordan 4 retro bg royalty

  54. Pingback: t shirt chicago bulls hoodie jersey uniform t shirt

  55. Pingback: mens shoes mens adidas originals zx flux trainers blue white main blueadidas pants joggersadidas hoodies cheappromo codes

  56. Pingback: new black adidas yeezy powerphase calabasas cg6420 rrp 125 uk 9

  57. Pingback: cashmere pyjamas grey

  58. Pingback: hot sale adidas ultra boost triple black womens training rv i t shoes

  59. Pingback: utah jazz jersey 2016 jersey wholesale

  60. Pingback: timberland earthkeepers r glancy 6 boot dark blue nubuck womens dress

  61. Pingback: adidas lk cf nb kids trainers navy royal white 33285

  62. Pingback: the nike elite 51 uniform nike news

  63. Pingback: wolf gris nike mercurial vapor xi cr7 fg hematite bottes m茅tallique enfants gris football

  64. Pingback: benassi jdi slides

  65. Pingback: mbt chaussures lac茅es blanche hommes sportmbt pas chermbt basket pas cher

  66. Pingback: nba men s basics structured adjustable hat price

  67. Pingback: nike field general 2 champ drive

  68. Pingback: adidas kids nemeziz messi 17 360 agility fg core black solar red tactile gold metallic

  69. Pingback: 2018 new fashion hello kitty hoodie sweatshirts sportswear clothing womens mens long sleeve star lovers hoodies m xxl hoodies sweater long sleeve online

  70. Pingback: puma speed font t shirt for men puma tees

  71. Pingback: nike air jordan iii golf shoes 2018 release

  72. Pingback: ty beanie baby ty 2k the bear retired 4262

  73. Pingback: nike internationalist nike internationalist

  74. Pingback: adidas superstar bold platform originals shoes womens black white gold metallic 318dxgep

  75. Pingback: prada black patent leather boots in f0002 black

  76. Pingback: neymar will wear the no 10 shirt at psg after completing his 198m transfer

  77. Pingback: toyota trademarks supra moniker in europe overdrive

  78. Pingback: fallen patriot iii kids black blood red skate shoe red skate shoes fanciful vans

  79. Pingback: new air jordan 31 gs black red wolf grey release authentic price

  80. Pingback: new balance m670bpr chinese zodiac rabbit blue red pink womens sneakersnew balance

  81. Pingback: houston rockets james harden nike nba mens marled player t shirt

  82. Pingback: nike zoom kd9 elite pale grey ivory 878637 001 sneaker junkies

  83. Pingback: that sad desperate look on michael jordans face plastered on top of everyone from cam newton to kanye west

  84. Pingback: pull femme no毛l rennes pull de no毛l pas cher

  85. Pingback: puma black gym bag

  86. Pingback: b酶rnet酶j st酶rrelse 98 tilbud p氓

  87. Pingback: 銈汇兗銉玜didas 銈儑銈c儉銈广偢銉ャ儖銈偣銉濄兗銉勩偊銈с偄 銈︺偐銉笺儬銈儍銉椼偣銉笺儎 g 銈搞儯銉笺偢涓婁笅

  88. Pingback: botte ville paul joe sister effie noir chaussures femme vente super pas cher

  89. Pingback: chill fleece headband earband

  90. Pingback: b usa po o ra ph auren casaco mascu ino po o ra ph auren usado

  91. Pingback: ed hardy mermaid and lotus low rise shoes in pink all the best

  92. Pingback: air jordan 3 retro prm hc gg chrome city blue

  93. Pingback: new balance 580 elite edition halloween sz 13 running green suede rare

  94. Pingback: innovasport nike sandalia sunray adjust 4 ni帽os

  95. Pingback: 屑芯写薪芯械 锌谢邪褌褜械 褋 谐械芯屑械褌褉懈褔械褋泻懈屑 褍蟹芯褉芯屑

Leave a Reply