Web Portal Development

After you upload all the data to the database and install Java and openslidetools successfully, you can analyze and visualize the data using the web portal. Here we list the detailed steps to install the web server and deploy the web portal project and its APIs.

1. Install tomcat (root user)

(1) Download the latest version of tomcat (binary distribution) and extract it to /usr/local/tomcat-version

(2) In the folder /usr/local, use the following command to create a softlink:

$ln -s /usr/local/tomcat-version /usr/local/tomcat7

(3) Add the lines below at the end of the file /etc/profile: (Suppose Java is installed under /develop/jdk1.7.0_51):

 export JAVA_HOME=/develop/jdk1.7.0_51
 export TOMCAT_HOME=/usr/local/tomcat7
 export PATH=${TOMCAT_HOME}/bin: ${PATH}

Then run command:

$source /etc/profile

If running Tomcat via sudo account, please modify tomcat startup.sh and shutdown.sh under $TOMCAT_HOME to include EXPORT for JAVA_HOME, e.g.: export JAVA_HOME=/develop/jdk1.7.0_51

(4) Modify the file /usr/local/tomcat7/conf/server.xml, in line 124, change the value of appBasein the element host (appBase=“webapps”) from webapps to /var/www (appBase=“/var/www”) or any other place of your root project.

(5) To support JFreeChart, modify catalina.sh to add a line: JAVA_OPTS=“$JAVA_OPTS -Djava.awt.headless=true”

(6) Try to start tomcat with command $startup.sh

(7) Stop tomcat using command $shutdown.sh

2. Install apache2 (root user)

(0) (Optional) If you don't have the c compiler in your environment, you need to install gcc by the following command: $yum install gcc-c++

(1) Some dependencies are required before installing httpd. Please install these dependencies by the following order. After you find the source of apr, apr-util and pcre, you need to unzip these compressed files and go to each folder of them to run the following commands accordingly.

  • apr:
    $./configure --prefix=/usr/local/apr
    $make install

(Ignore a message from configure step: libtoolT can't be removed. The last step needs sudo/root permission. You may run it as: sudo make install)

  • apr-util:
    $./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
    $make install

(The last step needs sudo/root permission. You may run it as: sudo make install)

  • pcre:
    $./configure --prefix=/usr/local/pcre
    $make install

(The last step needs sudo/root permission. You may run it as: sudo make install)

(2) Download the latest version of apache2 (httpd) ( the httpd-2.4.6.tar.gz in our case) and unzip it.

(3) Go to the extracted folder httpd-2.4.6 and install httpd with dependencies using the following commands:

$./configure --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre --prefix=/usr/local/apache2
$make install

(The last step needs sudo/root permission. You may run it as: sudo make install)

(4) Edit the file /etc/profile and add the following two lines:

export APACHE2_HOME=/usr/local/apache2
export PATH=${APACHE2_HOME}/bin:${PATH}

Then run the command:

$source /etc/profile

(5) Run the following command using root user to start apache2

$apachectl start

Note that Linux may have Apache installed by default. You may want to verify that you are using your own installed Apache, by running “locate apachectl”. The one under /usr/local/apache2 is the one you just installed.

You may get the warning could not reliable ……. Don't worry, it will disappear after doing some configurations later. You can see “HelloWorld” when you visit http://localhost/index.html if you put the file index.html with the content “HelloWorld” in the folder /var/www/html/.

Run the command $apachectl stop to stop apache2.

3. Connect tomcat and apache2 (root user)

Generally speaking, tomcat using 8080 port and this port cannot be accessed directly since it is hidden by the firewall. Apache2 uses port 80 which is open to users. Apache2 is in charge of static html pages and tomcat in charge of jsp pages and REST APIs. Therefore a connector is needed for apache2 to send jsp pages and REST resource request to tomcat. Please make sure tomcat and apache2 are installed before you go into the following steps.

(1) Download the latest tomcat-apache2 connector (the tomcat-connectors-1.2.37-src.tar.gz in our case) and unzip it.

(2) Go to its subfolder “native” and install connector using the following commands:

$./configure --with-apxs=/usr/local/apache2/bin/apxs
$make install

Now you should see file mod_jk.so in the folder /usr/local/apache2/modules/.

(3) Modify the configuration files in the folder /usr/local/apache2/conf

  • Create a new file mod_jk.conf with the following content:
''# where is the workers property file
JkWorkersFile /usr/local/apache2/conf/workers.properties
# Where to put jk logs
JkLogFile /usr/local/apache2/logs/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
# JkOptions indicate to send SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T"
# send all jsp and servlet request to tomcat via ajp13 protocol
JkMount /tcga/* worker1
JkMount /*.jsp worker1

Create a new file workers.properties with the following content:

  • Modify httpd.conf: from up to down

Change line 51 to Listen

Then add new lines to load mod_jk.so

LoadModule jk_module modules/mod_jk.so
Include /usr/local/apache2/conf/mod_jk.conf

After adding the two lines:

Change line 190 to: ServerName LocalHost:80

Change line 214 & 215 to: DocumentRoot “/var/www” <Directory “/var/www”>

In line 247, add: DirectoryIndex index.jsp in element (index.html is already there)

4. Deploy web portal and API

  1. In the folder war, there are two folders: portal is for web portal and tcga for its API. Go to folder tcga/WEB-INF/classes and modify the database configuration file connection.propertiesby changing the connect information inside.
  2. Copy portal and tcga folders to the folder /var/www/.
  3. Reboot the system.
  4. Start tomcat and apache2 using commands:
    $apachectl start
  5. Use a web browser to visit localhost/portal.
  6. You can find a sample DZImage folder inuploadtool/resource/. Then create a link in /var/www named DZImage pointing to it by the following command:
  7. Start tomcat and apache2 using commands:
    $ln -s /path/to/DZImage/folder /var/www/DZImage

You can also generate the tiles by yourself using our tiling tool. please follow the instructions below to generate tiles:

  1. compile the tilegen tool, go to “lib” folder, you can find a c file named tilegen.c, compile it with command:(customize the include and lib path accordingly)
    $gcc -I/usr/local/include/openslide -L/usr/local/lib -lopenslide -o tilegen tilegen.c
  2. you'll find a binary file “tilegen” is created, use it to tile whole slide images into Deep Zoom images.
    $tilegen /path/to/input/folder /path/to/out/put/folder threadnumber level

    the first parameter is input folder, the second is output folder, the third one is the thread number for multi-thread, and the last one is the layer you want to tile.

for example, my whole slide images are located in folder /var/wsi and I want to put the output files in folder /var/www/DZImage. My computer can run 3 threads at the same time to get the optimized performance. I want to tile the lowest level of whole slide image which is 0, then I can run command:

$tilegen /var/wsi/ /var/www/DZImage/ 3 0


When you switch to root user to start tomcat and apache2, please use command su - which will invoke the initialization of /etc/profile rather than command su. * when you add export in file /etc/profile, make sure ${PATH} is always at the end of the export line. Therefore our new installed version of binary program will be called if more than one version are installed.