<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4739427765174521248</id><updated>2012-01-11T03:46:53.861-08:00</updated><category term='proxy'/><category term='Tomcat 7'/><category term='Oracle 10g Express'/><category term='HTTPS'/><category term='SQL Server'/><category term='Jasper Reports'/><category term='Geronimo 2'/><category term='Oracle apex'/><category term='APEX'/><category term='Grub'/><category term='Apache Roller'/><category term='Oracle'/><category term='XE'/><category term='Galileo'/><category term='PAE'/><category term='JBoss5'/><category term='JNDI'/><category term='Oracle XE'/><category term='Group Office'/><category term='Tomcat 6'/><category term='PostgreSQL 9'/><category term='SSL'/><category term='MD5'/><category term='Webmin'/><category term='Postgre'/><category term='Tomcat Start Script'/><category term='Install Group Office Centos'/><category term='Install Tomcat'/><category term='Hostname'/><category term='JBoss'/><category term='MySQL'/><category term='OLAP'/><category term='iReport'/><category term='CentOS'/><category term='JBoss6'/><category term='XML'/><category term='Enable Root Login'/><category term='Java'/><category term='Datapump'/><category term='Tomcat Manager Password'/><category term='JDBC'/><category term='PHP'/><category term='404 page'/><category term='service not available'/><category term='Tomcat'/><category term='JDK'/><category term='JasperServer'/><category term='Linux'/><category term='Eclipse'/><category term='SHA'/><category term='Install Group Office RHEL'/><category term='Apache Geronimo'/><category term='Mondrian'/><category term='Bash Script'/><category term='Install Jasper'/><category term='Union Query'/><category term='Glassfish'/><category term='expdp'/><category term='Tomcat7'/><category term='MUTT'/><category term='BIRT'/><title type='text'>David Ghedini's Blog</title><subtitle type='html'>Oracle, Tomcat, and Linux.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://davidghedini.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://davidghedini.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>David Ghedini</name><uri>http://www.blogger.com/profile/17216036360922714725</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='20' src='http://3.bp.blogspot.com/_9kl8kmes6FE/TRZtxgi0R0I/AAAAAAAAAGY/plAxLyonZ_U/S220/TheWholeGang.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>31</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4739427765174521248.post-3841743676521807567</id><published>2011-06-12T02:59:00.000-07:00</published><updated>2011-06-12T02:59:21.380-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JDK'/><title type='text'>JDK 6 Update 26 Released</title><content type='html'>Java Development Kit 6, update 26 has been released.&lt;br /&gt;&lt;br /&gt;You can see the release note, bug fixes,a nd security enhancements here:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.oracle.com/technetwork/java/javase/6u26releasenotes-401875.html" target="_blank"&gt;http://www.oracle.com/technetwork/java/javase/6u26releasenotes-401875.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;You can download from Oracle at:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u26-download-400750.html" target="_blank"&gt;http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u26-download-400750.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In my posts, I use the self-extracting bin file.&lt;br /&gt;&lt;br /&gt;One simple way to upgrade your JDK is to create a new java home directory (usr/java26 for example), install the new JDK, and then update any environment settings (JAVA_HOME, etc..) as well as any scripts that reference the JAVA_HOME.&lt;br /&gt;&lt;br /&gt;Test the new JDK and, once everything looks in order, delete the old.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4739427765174521248-3841743676521807567?l=davidghedini.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://davidghedini.blogspot.com/feeds/3841743676521807567/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4739427765174521248&amp;postID=3841743676521807567&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/3841743676521807567'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/3841743676521807567'/><link rel='alternate' type='text/html' href='http://davidghedini.blogspot.com/2011/06/jdk-6-update-26-released.html' title='JDK 6 Update 26 Released'/><author><name>David Ghedini</name><uri>http://www.blogger.com/profile/17216036360922714725</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='20' src='http://3.bp.blogspot.com/_9kl8kmes6FE/TRZtxgi0R0I/AAAAAAAAAGY/plAxLyonZ_U/S220/TheWholeGang.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4739427765174521248.post-542205331627990018</id><published>2011-03-17T13:59:00.000-07:00</published><updated>2011-08-04T14:32:41.119-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Geronimo 2'/><category scheme='http://www.blogger.com/atom/ns#' term='Apache Geronimo'/><title type='text'>Install Apache Geronimo on CentOS</title><content type='html'>This post will cover installing Geronimo 2 on CentOS, RHEL, or Fedora. &lt;br /&gt;&lt;br /&gt;In this post, we'll install the required JDK, Geronimo 2.2.1, create a Geromino start/stop script, and configure Geronimo to run as a service.&lt;br /&gt;&lt;br /&gt;Geronimo is available with choice of Tomcat or Jetty. Except for the file names, the installation procedure is identical.  &lt;br /&gt;&lt;br /&gt;For this installation, we'll use Geronimo 2.2.1, the current, stable release.&lt;br /&gt;&lt;br /&gt;To start, we'll install the Java Development Kit (JDK) 1.6&lt;br /&gt;&lt;br /&gt;Geronimo 2.2.1 is certified only on Java EE 5 so you can substitute for below, but I have not had any issues with 6. &lt;br /&gt;&lt;br /&gt;If you do have the JDK installed, you can skip to: Step 2: Download and Unpack Geronimo 2.2.1:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;b&gt;Step 1: Install JDK 1.6&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;You can download the JDK here: &lt;a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html" target="_blank"&gt;http://www.oracle.com/technetwork/java/javase/downloads/index.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;We'll install the latest JDK, which is JDK 6 Update 24. The JDK is specific to 32 and 64 bit versions.&lt;br /&gt;&lt;br /&gt;My CentOS box is 64 bit, so I'll need: jdk-6u24-linux-x64.bin.&lt;br /&gt;&lt;br /&gt;If you are on 32 bit, you'll need: jdk-6u24-linux-i586.bin&lt;br /&gt;&lt;br /&gt;Download the appropriate JDK and save it to a directory. I'm saving it to /root.&lt;br /&gt;&lt;br /&gt;Move (mv) or copy (cp) the file to the /opt directory:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 ~]# mv jdk-6u24-linux-x64.bin /opt/jdk-6u24-linux-x64.bin  &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Create a new directory /usr/java.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 ~]# mkdir /usr/java  &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Change to the /usr/java directory we created and install the JDK using 'sh /opt/jdk-6u24-linux-x64.bin'&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 ~]# cd /usr/java&lt;br /&gt;[root@srv6 java]# sh /opt/jdk-6u24-linux-x64.bin&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Set the JAVA_HOME path. This is where we installed our JDK above.&lt;br /&gt;&lt;br /&gt;To set it for your current session, you can issue the following from the CLI:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 java]# JAVA_HOME=/usr/java/jdk1.6.0_24&lt;br /&gt;[root@srv6 java]# export JAVA_HOME&lt;br /&gt;[root@srv6 java]# PATH=$JAVA_HOME/bin:$PATH&lt;br /&gt;[root@srv6 java]# export PATH&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;To set the JAVA_HOME permanently, we add below to either the ~/.bashrc or ~/.bash_profile of the user (in this case, root). &lt;br /&gt;&lt;br /&gt;We can also add it /etc/profile and then source it to give to all users.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;JAVA_HOME=/usr/java/jdk1.6.0_24&lt;br /&gt;export JAVA_HOME&lt;br /&gt;PATH=$JAVA_HOME/bin:$PATH&lt;br /&gt;export PATH&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Once you have added the above to ~/.bash_profile or ~/.bashrc, you should log out, then log back in and check that the JAVA_HOME is set correctly.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 ~]#  echo $JAVA_HOME&lt;br /&gt;/usr/java/jdk1.6.0_24&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;b&gt;Step 2: Download and Unpack Geronimo 2.2.1&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;Download geronimo-tomcat6-javaee5-2.2.1 &lt;a href="http://geronimo.apache.org/apache-geronimo-v221-release.html" target="_blank"&gt;here&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;If you want to use the embedded Jetty version, download geronimo-jetty7-javaee5-2.2.1 from the same page as above.&lt;br /&gt;&lt;br /&gt;Again, the only difference in installation is the file names, so just adjust accordingly.&lt;br /&gt;&lt;br /&gt;Save the file to a directory. I'm saving it to /root/geronimo-tomcat6-javaee5-2.2.1-bin.tar.gz&lt;br /&gt;&lt;br /&gt;Before proceeding, you should verify the MD5 Checksum for your Geronimo download.&lt;br /&gt;&lt;br /&gt;Since we saved the Geronimo download to /root/geronimo-tomcat6-javaee5-2.2.1-bin.tar.gz, we'll go to the /root directory and use the md5sum command.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 ~]# md5sum geronimo-tomcat6-javaee5-2.2.1-bin.tar.gz&lt;br /&gt;0bb2985421398eb2b4af35ce4eaff974  geronimo-tomcat6-javaee5-2.2.1-bin.tar.gz&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Compare the output above to the MD5 Checksum provided by &lt;a href="http://www.apache.org/dist/geronimo/2.2.1/geronimo-tomcat6-javaee5-2.2.1-bin.tar.gz.md5" target="_blank"&gt;the Geronimo Tomcat MD5 page&lt;/a&gt; and insure that they match exactly. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now, move (mv) or copy (cp) the file to the /usr/share directory:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 ~]# mv geronimo-tomcat6-javaee5-2.2.1-bin.tar.gz /usr/share/geronimo-tomcat6-javaee5-2.2.1-bin.tar.gz&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Change to the /usr/share directory and unpack the file using tar -xzf:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 ~]# cd /usr/share&lt;br /&gt;[root@sv2 srv6 ]# tar -xzf geronimo-tomcat6-javaee5-2.2.1-bin.tar.gz  &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This will create the directory /usr/share/geronimo-tomcat6-javaee5-2.2.1&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;b&gt;Step 3: Configure Geronimo to Run as a Service.&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;We will now create a simple Start/Stop/Restart script and configure Geronimo to run as a service.&lt;br /&gt;&lt;br /&gt;Naviagte to the /etc/init.d directory and create a script called 'geronimo' as shown below.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 share]# cd /etc/init.d&lt;br /&gt;[root@srv6 init.d]# vi geronimo&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The script:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;#!/bin/bash&lt;br /&gt;# description: Geronimo Start Stop Restart&lt;br /&gt;# processname: geronimo&lt;br /&gt;# chkconfig: 234 20 80&lt;br /&gt;JAVA_HOME=/usr/java/jdk1.6.0_24&lt;br /&gt;export JAVA_HOME&lt;br /&gt;PATH=$JAVA_HOME/bin:$PATH&lt;br /&gt;export PATH&lt;br /&gt;GERONIMO_HOME=/usr/share/geronimo-tomcat6-javaee5-2.2.1&lt;br /&gt;&lt;br /&gt;case $1 in&lt;br /&gt;start)&lt;br /&gt;sh $GERONIMO_HOME/bin/startup.sh&lt;br /&gt;;; &lt;br /&gt;stop)   &lt;br /&gt;sh $GERONIMO_HOME/bin/shutdown.sh&lt;br /&gt;;; &lt;br /&gt;restart)&lt;br /&gt;sh $GERONIMO_HOME/bin/shutdown.sh&lt;br /&gt;sh $GERONIMO_HOME/bin/startup.sh&lt;br /&gt;;; &lt;br /&gt;esac    &lt;br /&gt;exit 0&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;As you can see, we are simply calling the startup.sh and shutdown.sh scripts located in the Geronimo bin directory (/usr/share/geronimo-tomcat6-javaee5-2.2.1/bin). &lt;br /&gt;&lt;br /&gt;GERONIMO_HOME is the Geronimo home directory where we unpacked at (/usr/share/geronimo-tomcat6-javaee5-2.2.1)&lt;br /&gt;&lt;br /&gt;Now, make the geronimo script executable:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 init.d]# chmod 755 geronimo&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Add Geronimo to chkconfig and set to start at boot.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 init.d]# chkconfig --add geronimo&lt;br /&gt;[root@srv6 init.d]# chkconfig --level 234 geronimo on&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Verify it:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 init.d]# chkconfig --list geronimo&lt;br /&gt;tomcat          0:off   1:off   2:on    3:on    4:on    5:off   6:off&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Now, we can start Geronimo using 'service geronimo start':&lt;br /&gt;&lt;br /&gt;Start Geronimo:&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 ~]# service geronimo start&lt;br /&gt;Using GERONIMO_HOME:   /usr/share/geronimo-tomcat6-javaee5-2.2.1&lt;br /&gt;Using GERONIMO_TMPDIR: var/temp&lt;br /&gt;Using JRE_HOME:        /usr/java/jdk1.6.0_24/jre&lt;br /&gt;Using GERONIMO_OUT:    /usr/share/geronimo-tomcat6-javaee5-2.2.1/var/log/geronimo.out&lt;br /&gt;&lt;br /&gt;Geronimo started in background. PID: 5179&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;You should now be able to navigate to http://yourdomain.com:8080 or http://yourIPaddress:8080 and we should see the Geronimo home page.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-VMSK0I-pauQ/TYJv0eQPi8I/AAAAAAAAAIQ/7IxK6ssnL04/s1600/GeronimoHomePage.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="194" width="320" src="http://1.bp.blogspot.com/-VMSK0I-pauQ/TYJv0eQPi8I/AAAAAAAAAIQ/7IxK6ssnL04/s320/GeronimoHomePage.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;b&gt;Step 4: Access Geronimo Admin Console and Change Password.&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;To access the Geronimo Admin Console, click the 'Console' link under Administration on the home page or simply navigate to http://yourdomain.com:8080/console or http://yourIPaddress:8080/console.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The default user name and password is system/manager.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-9EzspfZH7fU/TYJv0l_5yqI/AAAAAAAAAIY/bQVzMc1sj58/s1600/GeronimoAdminConsole.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="194" width="320" src="http://4.bp.blogspot.com/-9EzspfZH7fU/TYJv0l_5yqI/AAAAAAAAAIY/bQVzMc1sj58/s320/GeronimoAdminConsole.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Logged in as system:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-0pJd-hMBqVs/TYJv0rDsSBI/AAAAAAAAAIg/i0f7KOVxkDQ/s1600/GeronimoWelcome.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="192" width="320" src="http://3.bp.blogspot.com/-0pJd-hMBqVs/TYJv0rDsSBI/AAAAAAAAAIg/i0f7KOVxkDQ/s320/GeronimoWelcome.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;To change the default password, in the Console Navigation menu, expand the Security node and then click on 'Users and Groups'&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-OMKlMX1LT3Q/TYJv07qvGgI/AAAAAAAAAIo/wWbGDjhx2Zs/s1600/GeronimoUsers.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="192" width="320" src="http://3.bp.blogspot.com/-OMKlMX1LT3Q/TYJv07qvGgI/AAAAAAAAAIo/wWbGDjhx2Zs/s320/GeronimoUsers.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Click the Edit link for the user System and update the password.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-lyY6BWKmFzw/TYJv1KPeF3I/AAAAAAAAAIw/kK0C10aue10/s1600/GeronimoPassword.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="192" width="320" src="http://3.bp.blogspot.com/-lyY6BWKmFzw/TYJv1KPeF3I/AAAAAAAAAIw/kK0C10aue10/s320/GeronimoPassword.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;b&gt;Step 5 (optional): Modify Script to Pass the System Password Value.&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Stopping Geronimo.&lt;br /&gt;&lt;br /&gt;Using our script above, when stopping Geronimo using 'service geronimo stop', we will be prompted for the system password: &lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 init.d]# service geronimo stop&lt;br /&gt;Using GERONIMO_HOME:   /usr/share/geronimo-tomcat6-javaee5-2.2.1&lt;br /&gt;Using GERONIMO_TMPDIR: var/temp&lt;br /&gt;Using JRE_HOME:        /usr/java/jdk1.6.0_24/jre&lt;br /&gt;Username: system&lt;br /&gt;Password: *******&lt;br /&gt;Locating server on localhost:1099... Server found.&lt;br /&gt;Server shutdown started&lt;br /&gt;Server shutdown completed&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;We can modify our script, however, to pass the password to the shell by adding '--user system --password manager' to the shutdown command: &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;#!/bin/bash&lt;br /&gt;# description: Geronimo Start Stop Restart&lt;br /&gt;# processname: geronimo&lt;br /&gt;# chkconfig: 234 20 80&lt;br /&gt;JAVA_HOME=/usr/java/jdk1.6.0_24&lt;br /&gt;export JAVA_HOME&lt;br /&gt;PATH=$JAVA_HOME/bin:$PATH&lt;br /&gt;export PATH&lt;br /&gt;GERONIMO_HOME=/usr/share/geronimo-tomcat6-javaee5-2.2.1&lt;br /&gt;&lt;br /&gt;case $1 in&lt;br /&gt;start)&lt;br /&gt;sh $GERONIMO_HOME/bin/startup.sh&lt;br /&gt;;; &lt;br /&gt;stop)   &lt;br /&gt;sh $GERONIMO_HOME/bin/shutdown.sh --user system --password manager&lt;br /&gt;;; &lt;br /&gt;restart)&lt;br /&gt;sh $GERONIMO_HOME/bin/shutdown.sh --user system --password manager&lt;br /&gt;sh $GERONIMO_HOME/bin/startup.sh&lt;br /&gt;;; &lt;br /&gt;esac    &lt;br /&gt;exit 0&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;**In the script above, I am using the default system/manager password above, but don't forget to use the new password you created for the system user in the console in Step 4 above. &lt;br /&gt;&lt;br /&gt;You can also create a new role and user if you wish to.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now, when we stop Geronimo using 'service geronimo stop' we are no longer prompted for the password:&lt;br /&gt;&lt;br /&gt;Stop Geronimo:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 init.d]# service geronimo stop&lt;br /&gt;Using GERONIMO_HOME:   /usr/share/geronimo-tomcat6-javaee5-2.2.1&lt;br /&gt;Using GERONIMO_TMPDIR: var/temp&lt;br /&gt;Using JRE_HOME:        /usr/java/jdk1.6.0_24/jre&lt;br /&gt;Locating server on localhost:1099... Server found.&lt;br /&gt;Server shutdown started&lt;br /&gt;Server shutdown completed&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Learn More About Apache Geronimo&lt;br /&gt;&lt;br /&gt;&lt;a href="http://geronimo.apache.org/" target="_blank"&gt;Apache Geronimo&lt;/a&gt;&lt;br /&gt;&lt;a href="https://cwiki.apache.org/GMOxDOC22/" target="_blank"&gt;Geronimo Documentation Wiki&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4739427765174521248-542205331627990018?l=davidghedini.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://davidghedini.blogspot.com/feeds/542205331627990018/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4739427765174521248&amp;postID=542205331627990018&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/542205331627990018'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/542205331627990018'/><link rel='alternate' type='text/html' href='http://davidghedini.blogspot.com/2011/03/install-apache-geronimo-on-centos.html' title='Install Apache Geronimo on CentOS'/><author><name>David Ghedini</name><uri>http://www.blogger.com/profile/17216036360922714725</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='20' src='http://3.bp.blogspot.com/_9kl8kmes6FE/TRZtxgi0R0I/AAAAAAAAAGY/plAxLyonZ_U/S220/TheWholeGang.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-VMSK0I-pauQ/TYJv0eQPi8I/AAAAAAAAAIQ/7IxK6ssnL04/s72-c/GeronimoHomePage.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4739427765174521248.post-1677500641734995607</id><published>2011-03-12T15:52:00.000-08:00</published><updated>2011-06-12T03:10:41.771-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JBoss'/><category scheme='http://www.blogger.com/atom/ns#' term='JBoss6'/><title type='text'>Install JBoss 6 on CentOS</title><content type='html'>This post will cover installing JBoss 6.0 on CentOS 5.x.&lt;br /&gt;&lt;br /&gt;We'll also set up JBoss to run as a service, as well as secure the JMX and Web Service consoles.&lt;br /&gt;&lt;br /&gt;While there are similarities to JBoss 5.1 installation, the file locations have changed in some instances.&lt;br /&gt;&lt;br /&gt;Here is an outline of the steps we will follow:&lt;br /&gt;&lt;br /&gt;1. Download and Install the Java Development Kit (JDK)&lt;br /&gt;2. Download and Install JBoss 6.0 Application Server&lt;br /&gt;3. Create the user, jboss, who will own and run JBoss&lt;br /&gt;4. Set the required JAVA_HOME and JBOSS_HOME paths&lt;br /&gt;5. Create a start/stop/restart script for JBoss&lt;br /&gt;6. Configure JBoss to run as a service&lt;br /&gt;7. Access the JBoss Admin console&lt;br /&gt;8. Change the JBoss Admin Password&lt;br /&gt;9. Secure the JMX Console&lt;br /&gt;10. Securing the Web Service Console&lt;br /&gt;11. Set memory parameters for JBoss using JAVA_OPTS&lt;br /&gt;12. Configure JBoss to run on port 80&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Step 1: Download and Install the Java Development Kit (JDK)&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;You can download the JDK here: &lt;a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html" target="_blank"&gt;http://www.oracle.com/technetwork/java/javase/downloads/index.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I'm using JDK 6, update 26, the latest as of this post. The JDK is specific to 32 and 64 bit versions. &lt;br /&gt;&lt;br /&gt;My CentOS box is 64 bit, so I'll need: jdk-6u26-linux-x64.bin &lt;br /&gt;&lt;br /&gt;If you are on 32 bit, you'll need: jdk-6u26-linux-i586.bin&lt;br /&gt;&lt;br /&gt;Download the appropriate JDK and save it to a directory. I'm saving it to /root.&lt;br /&gt;&lt;br /&gt;Move (mv) or copy (cp) the file to the /opt directory:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 ~]# mv jdk-6u26-linux-x64.bin /opt/jdk-6u26-linux-x64.bin&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Create the directory /usr/java.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 ~]# mkdir /usr/java&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Change to the /usr/java directory we created and install the JDK using 'sh /opt/jdk-6u26-linux-x64.bin'&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 ~]# cd /usr/java&lt;br /&gt;[root@sv2 java]# sh /opt/jdk-6u26-linux-x64.bin&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;We now have the JDK installed at /usr/java/jdk1.6.0_26. We'll use this for our JAVA_HOME a bit later in step &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Step 2: Download and Install JBoss 6.0 Application Server&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;Download jboss-6.0.0.Final.zip at &lt;a href="http://sourceforge.net/projects/jboss/files/JBoss/JBoss-6.0.0.Final/" target="_blank"&gt;http://sourceforge.net/projects/jboss/files/JBoss/jboss-6.0.0.Final/&lt;/a&gt; or use wget:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 ~]# wget http://sourceforge.net/projects/jboss/files/JBoss/JBoss-6.0.0.Final/jboss-as-distribution-6.0.0.Final.zip/download&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;100%[======================================&gt;] 181,267,148  816K/s   in 3m 31s&lt;br /&gt;&lt;br /&gt;2011-03-13 00:56:44 (839 KB/s) - `jboss-as-distribution-6.0.0.Final.zip' saved [181267148/181267148]&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Move (mv) or copy (cp) the file to /usr/share/jboss-6.0.0.Final.zip.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 ~]# mv jboss-as-distribution-6.0.0.Final.zip /usr/share/jboss-as-distribution-6.0.0.Final.zip&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Change to the /usr/share directory and unzip the file:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 ~]# cd /usr/share&lt;br /&gt;[root@sv2 share]# unzip -q jboss-as-distribution-6.0.0.Final.zip&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The unzip will create the following directory:  /usr/share/jboss-6.0.0.Final&lt;br /&gt;&lt;br /&gt;This directory will be our JBOSS_HOME, which we will use below in Step 4.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Step 3: Create the user, jboss, who will own and run JBoss&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Since we will want to run JBoss as a non-root user with minimal privileges, we'll create a user, jboss, who will own the JBoss files and JBoss will run under his account.&lt;br /&gt;&lt;br /&gt;To do this, we can need to the following.&lt;br /&gt;&lt;br /&gt;Create a new group, jboss, and then create the user jboss and add the user to the jboss group.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 ~]# groupadd jboss&lt;br /&gt;[root@sv2 ~]# useradd -s /bin/bash -g jboss jboss&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Change ownership of the JBoss home directory, /usr/share/jboss-6.0.0.Final so all files are owned by the user jboss we created.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 ~]# chown -Rf jboss.jboss /usr/share/jboss-6.0.0.Final/&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Step 4: Set the required JAVA_HOME and JBOSS_HOME paths&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;We no need to set the JAVA_HOME and JBOSS_HOME.&lt;br /&gt;&lt;br /&gt;The JAVA_HOME is where we installed the JDK above, /usr/java/jdk1.6.0_26, and the JBOSS_HOME is where we installed JBoss above /usr/share/jboss-6.0.0.Final.&lt;br /&gt;&lt;br /&gt;Add the following to the jboss users .bash_profile:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;JAVA_HOME=/usr/java/jdk1.6.0_26&lt;br /&gt;export JAVA_HOME&lt;br /&gt;PATH=$JAVA_HOME/bin:$PATH&lt;br /&gt;export PATH&lt;br /&gt;JBOSS_HOME=/usr/share/jboss-6.0.0.Final&lt;br /&gt;export JBOSS_HOME&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;To set the JAVA_HOME for users, we add this to the user ~/.bashrc or ~/.bash_profile of the user. We can also add it /etc/profile and then source it to give to all users.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;JAVA_HOME=/usr/java/jdk1.6.0_26 &lt;br /&gt;export JAVA_HOME &lt;br /&gt;PATH=$JAVA_HOME/bin:$PATH &lt;br /&gt;export PATH&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Once you have added the above to ~/.bash_profile or ~/.bashrc, you should su to the user jboss and verify that the JAVA_HOME and JBOSS_HOME are set correctly.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 ~]#  su jboss&lt;br /&gt;[jboss@sv2 ~]#  echo $JAVA_HOME&lt;br /&gt;/usr/java/jdk1.6.0_26&lt;br /&gt;[jboss@sv2 ~]#  echo $JBOSS_HOME&lt;br /&gt;/usr/share/jboss-6.0.0.Final&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Step 5: Create a start/stop/restart script for JBoss&lt;/b&gt;.&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;For our JBoss script we will simply copy the existing jboss_init_redhat.sh script located at at /usr/share/jboss-6.0.0.Final/bin, copy it to /etc/init.d and rename it to 'jboss':&lt;br /&gt;&lt;br /&gt;So, as root:&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 ~]# cd /usr/share/jboss-6.0.0.Final/bin &lt;br /&gt;[root@sv2 bin]# cp jboss_init_redhat.sh /etc/init.d/jboss&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;In the jboss script (shown completed below), make the following changes:&lt;br /&gt;&lt;br /&gt;1. Add lines 3,4, and 5:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;# description: JBoss Start Stop Restart&lt;/b&gt;&lt;br /&gt;&lt;b&gt;# processname: jboss&lt;/b&gt;&lt;br /&gt;&lt;b&gt;# chkconfig: 234 20 80&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;2. Line 22, Set the JBOSS_HOME to where we unpacked JBoss in step 2 above:&lt;br /&gt;JBOSS_HOME=${JBOSS_HOME:-"&lt;b&gt;/usr/share/jboss-6.0.0.Final&lt;/b&gt;"}&lt;br /&gt;&lt;br /&gt;3. Line 28. Set the JAVA_HOME to where we installed the JDK in step 1 above:&lt;br /&gt;JAVAPTH=${JAVAPTH:-"&lt;b&gt;/usr/java/jdk1.6.0_26&lt;/b&gt;"}&lt;br /&gt;&lt;br /&gt;4. Add line 34, which sets the JBOSS_HOST to 0.0.0.0, allowing JBoss to bind to any IP.&lt;br /&gt;&lt;b&gt;JBOSS_HOST="0.0.0.0"&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;#!/bin/sh&lt;br /&gt;#&lt;br /&gt;# description: JBoss Start Stop Restart&lt;br /&gt;# processname: jboss6&lt;br /&gt;# chkconfig: 234 20 80&lt;br /&gt;#&lt;br /&gt;# $Id: jboss_init_redhat.sh 81068 2008-11-14 15:14:35Z dimitris@jboss.org $&lt;br /&gt;#&lt;br /&gt;# JBoss Control Script&lt;br /&gt;#&lt;br /&gt;# To use this script run it as root - it will switch to the specified user&lt;br /&gt;#&lt;br /&gt;# Here is a little (and extremely primitive) startup/shutdown script&lt;br /&gt;# for RedHat systems. It assumes that JBoss lives in /usr/local/jboss,&lt;br /&gt;# it's run by user 'jboss' and JDK binaries are in /usr/local/jdk/bin.&lt;br /&gt;# All this can be changed in the script itself. &lt;br /&gt;#&lt;br /&gt;# Either modify this script for your requirements or just ensure that&lt;br /&gt;# the following variables are set correctly before calling the script.&lt;br /&gt;&lt;br /&gt;#define where jboss is - this is the directory containing directories log, bin, conf etc&lt;br /&gt;JBOSS_HOME=${JBOSS_HOME:-"/usr/share/jboss-6.0.0.Final"}&lt;br /&gt;&lt;br /&gt;#define the user under which jboss will run, or use 'RUNASIS' to run as the current user&lt;br /&gt;JBOSS_USER=${JBOSS_USER:-"jboss"}&lt;br /&gt;&lt;br /&gt;#make sure java is in your path&lt;br /&gt;JAVAPTH=${JAVAPTH:-"/usr/java/jdk1.6.0_26"}&lt;br /&gt;&lt;br /&gt;#configuration to use, usually one of 'minimal', 'default', 'all'&lt;br /&gt;JBOSS_CONF=${JBOSS_CONF:-"default"}&lt;br /&gt;&lt;br /&gt;#if JBOSS_HOST specified, use -b to bind jboss services to that address&lt;br /&gt;JBOSS_HOST="0.0.0.0"&lt;br /&gt;JBOSS_BIND_ADDR=${JBOSS_HOST:+"-b $JBOSS_HOST"}&lt;br /&gt;&lt;br /&gt;#define the classpath for the shutdown class&lt;br /&gt;JBOSSCP=${JBOSSCP:-"$JBOSS_HOME/bin/shutdown.jar:$JBOSS_HOME/client/jnet.jar"}&lt;br /&gt;&lt;br /&gt;#define the script to use to start jboss&lt;br /&gt;JBOSSSH=${JBOSSSH:-"$JBOSS_HOME/bin/run.sh -c $JBOSS_CONF $JBOSS_BIND_ADDR"}&lt;br /&gt;&lt;br /&gt;if [ "$JBOSS_USER" = "RUNASIS" ]; then&lt;br /&gt;  SUBIT=""&lt;br /&gt;else&lt;br /&gt;  SUBIT="su - $JBOSS_USER -c "&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;if [ -n "$JBOSS_CONSOLE" -a ! -d "$JBOSS_CONSOLE" ]; then&lt;br /&gt;  # ensure the file exists&lt;br /&gt;  touch $JBOSS_CONSOLE&lt;br /&gt;  if [ ! -z "$SUBIT" ]; then&lt;br /&gt;    chown $JBOSS_USER $JBOSS_CONSOLE&lt;br /&gt;  fi &lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;if [ -n "$JBOSS_CONSOLE" -a ! -f "$JBOSS_CONSOLE" ]; then&lt;br /&gt;  echo "WARNING: location for saving console log invalid: $JBOSS_CONSOLE"&lt;br /&gt;  echo "WARNING: ignoring it and using /dev/null"&lt;br /&gt;  JBOSS_CONSOLE="/dev/null"&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;#define what will be done with the console log&lt;br /&gt;JBOSS_CONSOLE=${JBOSS_CONSOLE:-"/dev/null"}&lt;br /&gt;&lt;br /&gt;JBOSS_CMD_START="cd $JBOSS_HOME/bin; $JBOSSSH"&lt;br /&gt;JBOSS_CMD_STOP=${JBOSS_CMD_STOP:-"java -classpath $JBOSSCP org.jboss.Shutdown --shutdown"}&lt;br /&gt;&lt;br /&gt;if [ -z "`echo $PATH | grep $JAVAPTH`" ]; then&lt;br /&gt;  export PATH=$PATH:$JAVAPTH&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;if [ ! -d "$JBOSS_HOME" ]; then&lt;br /&gt;  echo JBOSS_HOME does not exist as a valid directory : $JBOSS_HOME&lt;br /&gt;  exit 1&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;echo JBOSS_CMD_START = $JBOSS_CMD_START&lt;br /&gt;&lt;br /&gt;case "$1" in&lt;br /&gt;start)&lt;br /&gt;    cd $JBOSS_HOME/bin&lt;br /&gt;    if [ -z "$SUBIT" ]; then&lt;br /&gt;        eval $JBOSS_CMD_START &gt;${JBOSS_CONSOLE} 2&gt;&amp;1 &amp;&lt;br /&gt;    else&lt;br /&gt;        $SUBIT "$JBOSS_CMD_START &gt;${JBOSS_CONSOLE} 2&gt;&amp;1 &amp;" &lt;br /&gt;    fi&lt;br /&gt;    ;;&lt;br /&gt;stop)&lt;br /&gt;    if [ -z "$SUBIT" ]; then&lt;br /&gt;        $JBOSS_CMD_STOP&lt;br /&gt;    else&lt;br /&gt;        $SUBIT "$JBOSS_CMD_STOP"&lt;br /&gt;    fi &lt;br /&gt;    ;;&lt;br /&gt;restart)&lt;br /&gt;    $0 stop&lt;br /&gt;    $0 start&lt;br /&gt;    ;;&lt;br /&gt;*)&lt;br /&gt;    echo "usage: $0 (start|stop|restart|help)"&lt;br /&gt;esac&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Step 6: Run JBoss as a Service&lt;/b&gt;.&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;To run JBoss as a service and enable start up at boot, make the script we created above executable and add it to our chkconfig so it starts at boot.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 init.d]# chmod 755 jboss&lt;br /&gt;[root@sv2 init.d]# chkconfig --add jboss&lt;br /&gt;[root@sv2 init.d]# chkconfig --level 234 jboss on&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;We should now be able to Start, Stop, and Restart JBoss as a service.&lt;br /&gt;&lt;br /&gt;Start JBoss:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Note: JBoss can take some time to start.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 init.d]# service jboss start&lt;br /&gt;JBOSS_CMD_START = cd /usr/share/jboss-6.0.0.Final/bin; /usr/share/jboss-6.0.0.Final/bin/run.sh -c default -b 0.0.0.0&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Stop JBoss:&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 init.d]# service jboss stop&lt;br /&gt;JBOSS_CMD_START = cd /usr/share/jboss-6.0.0.Final/bin; /usr/share/jboss-6.0.0.Final/bin/run.sh -c default -b 0.0.0.0&lt;br /&gt;Shutdown message has been posted to the server.&lt;br /&gt;Server shutdown may take a while - check logfiles for completion&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Step 7: Access the JBoss Admin&lt;/b&gt;.&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;Make sure JBoss is started and you should now be able to access the Jboss Console at:&lt;br /&gt;&lt;br /&gt;http://yourdomain.com:8080 or http://yourip:8080&lt;br /&gt;&lt;br /&gt;The default user name and password for the JBoss Admin Console is admin/admin&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-_z8oD0m0Ed0/TXwB4NlO6LI/AAAAAAAAAH4/IvyU6FNBllU/s1600/JBoss6Admin.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="194" width="320" src="http://1.bp.blogspot.com/-_z8oD0m0Ed0/TXwB4NlO6LI/AAAAAAAAAH4/IvyU6FNBllU/s320/JBoss6Admin.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Access the Admin Console by clicking on the Administration Console link.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-Xu8R3VOAp8o/TXwIrvPp7sI/AAAAAAAAAIA/nVnWzLA8rEY/s1600/Login6.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="192" width="320" src="http://2.bp.blogspot.com/-Xu8R3VOAp8o/TXwIrvPp7sI/AAAAAAAAAIA/nVnWzLA8rEY/s320/Login6.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Step 8: Change the JBoss Admin Password&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;To change the default Admin Console password, go to:&lt;br /&gt;&lt;br /&gt;/usr/share/jboss-6.0.0.Final/server/default/conf/props&lt;br /&gt;&lt;br /&gt;Open the jmx-console-users.properties file in text editor and change the password.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;# A sample users.properties file for use with the UsersRolesLoginModule&lt;br /&gt;admin=MyPassword&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Step 9: Secure the JMX Console&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;To secure the JMX Console, go to: &lt;br /&gt;&lt;br /&gt;/usr/share/jboss-6.0.0.Final/common/deploy/jmx-console.war/WEB-INF&lt;br /&gt;&lt;br /&gt;First, edit the web.xml file. Towards the bottom, you will find the security-constraint as shown below:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&amp;lt;!-- A security constraint that restricts access to the HTML JMX console&lt;br /&gt;   to users with the role JBossAdmin. Edit the roles to what you want and&lt;br /&gt;   uncomment the WEB-INF/jboss-web.xml/security-domain element to enable&lt;br /&gt;   secured access to the HTML JMX console.&lt;br /&gt;   &amp;lt;security-constraint&amp;gt;&lt;br /&gt;     &amp;lt;web-resource-collection&amp;gt;&lt;br /&gt;       &amp;lt;web-resource-name&amp;gt;HtmlAdaptor&amp;lt;/web-resource-name&amp;gt;&lt;br /&gt;       &amp;lt;description&amp;gt;An example security config that only allows users with the&lt;br /&gt;         role JBossAdmin to access the HTML JMX console web application&lt;br /&gt;       &amp;lt;/description&amp;gt;&lt;br /&gt;       &amp;lt;url-pattern&amp;gt;/*&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;     &amp;lt;/web-resource-collection&amp;gt;&lt;br /&gt;     &amp;lt;auth-constraint&amp;gt;&lt;br /&gt;       &amp;lt;role-name&amp;gt;JBossAdmin&amp;lt;/role-name&amp;gt;&lt;br /&gt;     &amp;lt;/auth-constraint&amp;gt;&lt;br /&gt;   &amp;lt;/security-constraint&amp;gt;&lt;br /&gt;   --&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Un-comment the security-constraint section so it appears thus:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&amp;lt;security-constraint&amp;gt;&lt;br /&gt;     &amp;lt;web-resource-collection&amp;gt;&lt;br /&gt;       &amp;lt;web-resource-name&amp;gt;HtmlAdaptor&amp;lt;/web-resource-name&amp;gt;&lt;br /&gt;       &amp;lt;description&amp;gt;An example security config that only allows users with the&lt;br /&gt;         role JBossAdmin to access the HTML JMX console web application&lt;br /&gt;       &amp;lt;/description&amp;gt;&lt;br /&gt;       &amp;lt;url-pattern&amp;gt;/*&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;     &amp;lt;/web-resource-collection&amp;gt;&lt;br /&gt;     &amp;lt;auth-constraint&amp;gt;&lt;br /&gt;       &amp;lt;role-name&amp;gt;JBossAdmin&amp;lt;/role-name&amp;gt;&lt;br /&gt;     &amp;lt;/auth-constraint&amp;gt;&lt;br /&gt;   &amp;lt;/security-constraint&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Next, still in the WEB-INF directory, edit the jboss-web.xml file, which will look as below:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&amp;lt;!DOCTYPE jboss-web PUBLIC&lt;br /&gt;   "-//JBoss//DTD Web Application 5.0//EN"&lt;br /&gt;   "http://www.jboss.org/j2ee/dtd/jboss-web_5_0.dtd"&amp;gt;&lt;br /&gt;   &lt;br /&gt;&amp;lt;jboss-web&amp;gt;&lt;br /&gt;   &amp;lt;!-- Uncomment the security-domain to enable security. You will&lt;br /&gt;      need to edit the htmladaptor login configuration to setup the&lt;br /&gt;      login modules used to authentication users.&lt;br /&gt;      &amp;lt;security-domain&amp;gt;java:/jaas/jmx-console&amp;lt;/security-domain&amp;gt;&lt;br /&gt;   --&amp;gt;&lt;br /&gt;&amp;lt;/jboss-web&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Uncomment the security-domain so it appears thus:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&amp;lt;!DOCTYPE jboss-web PUBLIC&lt;br /&gt;   "-//JBoss//DTD Web Application 5.0//EN"&lt;br /&gt;   "http://www.jboss.org/j2ee/dtd/jboss-web_5_0.dtd"&amp;gt;&lt;br /&gt;   &lt;br /&gt;&amp;lt;jboss-web&amp;gt;&lt;br /&gt;   &lt;br /&gt;      &amp;lt;security-domain&amp;gt;java:/jaas/jmx-console&amp;lt;/security-domain&amp;gt;&lt;br /&gt;   &lt;br /&gt;&amp;lt;/jboss-web&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;At this point, the password for the JMX Console will be the same as the password we set for the Admin Console in step 8 above.&lt;br /&gt;&lt;br /&gt;Both the Admin Console and JMX Console are are using the jmx-console-roles.properties and jmx-console-users.properties files.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Step 10: Secure the Web Service Console&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;To secure the Web Service Console, go to: &lt;br /&gt;&lt;br /&gt;/usr/share/jboss-6.0.0.Final/common/deploy/jbossws-console.war/WEB-INF&lt;br /&gt;&lt;br /&gt;First, edit the web.xml file. Towards the bottom, you will find the security-constraint as shown below:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&amp;lt;!-- A security constraint that restricts access&lt;br /&gt;   &amp;lt;security-constraint&amp;gt;&lt;br /&gt;     &amp;lt;web-resource-collection&amp;gt;&lt;br /&gt;       &amp;lt;web-resource-name&amp;gt;ContextServlet&amp;lt;/web-resource-name&amp;gt;&lt;br /&gt;       &amp;lt;description&amp;gt;An example security config that only allows users with the&lt;br /&gt;         role 'friend' to access the JBossWS console web application&lt;br /&gt;       &amp;lt;/description&amp;gt;&lt;br /&gt;       &amp;lt;url-pattern&amp;gt;/*&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;     &amp;lt;/web-resource-collection&amp;gt;&lt;br /&gt;     &amp;lt;auth-constraint&amp;gt;&lt;br /&gt;       &amp;lt;role-name&amp;gt;friend&amp;lt;/role-name&amp;gt;&lt;br /&gt;     &amp;lt;/auth-constraint&amp;gt;&lt;br /&gt;   &amp;lt;/security-constraint&amp;gt;&lt;br /&gt;   --&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Un-comment the security-constraint section so it appears thus:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&amp;lt;security-constraint&amp;gt;&lt;br /&gt;     &amp;lt;web-resource-collection&amp;gt;&lt;br /&gt;       &amp;lt;web-resource-name&amp;gt;ContextServlet&amp;lt;/web-resource-name&amp;gt;&lt;br /&gt;       &amp;lt;description&amp;gt;An example security config that only allows users with the&lt;br /&gt;         role 'friend' to access the JBossWS console web application&lt;br /&gt;       &amp;lt;/description&amp;gt;&lt;br /&gt;       &amp;lt;url-pattern&amp;gt;/*&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;     &amp;lt;/web-resource-collection&amp;gt;&lt;br /&gt;     &amp;lt;auth-constraint&amp;gt;&lt;br /&gt;       &amp;lt;role-name&amp;gt;friend&amp;lt;/role-name&amp;gt;&lt;br /&gt;     &amp;lt;/auth-constraint&amp;gt;&lt;br /&gt;   &amp;lt;/security-constraint&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Next, still in the WEB-INF directory, edit the jboss-web.xml file, which will look as below:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&amp;lt;?xml version="1.0" encoding="ISO-8859-1"?&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;!DOCTYPE jboss-web&lt;br /&gt;    PUBLIC "-//JBoss//DTD Web Application 2.3V2//EN"&lt;br /&gt;    "http://www.jboss.org/j2ee/dtd/jboss-web_3_2.dtd"&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;jboss-web&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;!-- A security domain that restricts access&lt;br /&gt;  &amp;lt;security-domain&amp;gt;java:/jaas/JBossWS&amp;lt;/security-domain&amp;gt;&lt;br /&gt;  --&amp;gt;&lt;br /&gt;  &lt;br /&gt;  &amp;lt;context-root&amp;gt;jbossws&amp;lt;/context-root&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/jboss-web&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Uncomment the security-domain so it appears thus:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&amp;lt;?xml version="1.0" encoding="ISO-8859-1"?&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;!DOCTYPE jboss-web&lt;br /&gt;    PUBLIC "-//JBoss//DTD Web Application 2.3V2//EN"&lt;br /&gt;    "http://www.jboss.org/j2ee/dtd/jboss-web_3_2.dtd"&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;jboss-web&amp;gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;  &amp;lt;security-domain&amp;gt;java:/jaas/JBossWS&amp;lt;/security-domain&amp;gt;&lt;br /&gt; &lt;br /&gt;  &lt;br /&gt;  &amp;lt;context-root&amp;gt;jbossws&amp;lt;/context-root&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/jboss-web&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The default user name and password are kermit/thefrog&lt;br /&gt;&lt;br /&gt;To change this, go to:&lt;br /&gt;&lt;br /&gt;/usr/share/jboss-6.0.0.Final/server/default/conf/props&lt;br /&gt;&lt;br /&gt;Open jbossws-roles.properties in a text editor it should appear as below.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;# A sample roles.properties file for use with the UsersRolesLoginModule&lt;br /&gt;kermit=friend&lt;br /&gt;&lt;/pre&gt;Change 'kermit' to a new user name. For example, we'll change it to 'mywsuser' as shown below:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;# A sample roles.properties file for use with the UsersRolesLoginModule&lt;br /&gt;mywsuser=friend&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Open jbossws-users.properties in a text editor it should appear as below.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;# A sample users.properties file for use with the UsersRolesLoginModule&lt;br /&gt;kermit=thefrog&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Change 'kermit' to our new user name 'mywsuser' and change the password. For example, we'll change the password to it to 'MyWsPassword' as shown below:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;# A sample users.properties file for use with the UsersRolesLoginModule&lt;br /&gt;mywsuser=MyWsPassword&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Step 11: Set JAVA_OPTS Memory Parameters&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;To set the memory limits for JBoss, &lt;br /&gt;&lt;br /&gt;Got to: /usr/share/jboss-6.0.0.Final/bin&lt;br /&gt;&lt;br /&gt;Open the run.sh file in a text editor.&lt;br /&gt;&lt;br /&gt;Find the section below:&lt;br /&gt;&lt;pre class="js" name="code"&gt;# Setup JBoss specific properties&lt;br /&gt;JAVA_OPTS="-Dprogram.name=$PROGNAME $JAVA_OPTS"&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Directly below this, add the desired parameters. &lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;# Setup JBoss specific properties&lt;br /&gt;JAVA_OPTS="-Dprogram.name=$PROGNAME $JAVA_OPTS"&lt;br /&gt;JAVA_OPTS="$JAVA_OPTS -Xms128m -Xmx256m"&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;I'm installing this on a small VPS so I'm using JAVA_OPTS="$JAVA_OPTS -Xms128m -Xmx256m". You should set this to whatever is appropriate to your server and application.&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Step 12: Running JBoss on Port 80&lt;/b&gt;.&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;To run services below port 1024 as user other than root, you can use port forwarding.&lt;br /&gt;&lt;br /&gt;You can do this by adding the following to your IP tables:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 ~]# iptables -t nat -A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080&lt;br /&gt;[root@sv2 ~]# iptables -t nat -A PREROUTING -p udp -m udp --dport 80 -j REDIRECT --to-ports 8080&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Be sure to save and then restart your IP Tables for the above to take effect.&lt;br /&gt;&lt;br /&gt;Happy JBoss'ing.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4739427765174521248-1677500641734995607?l=davidghedini.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://davidghedini.blogspot.com/feeds/1677500641734995607/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4739427765174521248&amp;postID=1677500641734995607&amp;isPopup=true' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/1677500641734995607'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/1677500641734995607'/><link rel='alternate' type='text/html' href='http://davidghedini.blogspot.com/2011/03/install-jboss-6-on-centos.html' title='Install JBoss 6 on CentOS'/><author><name>David Ghedini</name><uri>http://www.blogger.com/profile/17216036360922714725</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='20' src='http://3.bp.blogspot.com/_9kl8kmes6FE/TRZtxgi0R0I/AAAAAAAAAGY/plAxLyonZ_U/S220/TheWholeGang.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-_z8oD0m0Ed0/TXwB4NlO6LI/AAAAAAAAAH4/IvyU6FNBllU/s72-c/JBoss6Admin.jpg' height='72' width='72'/><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4739427765174521248.post-4448464518368599424</id><published>2011-03-12T13:36:00.000-08:00</published><updated>2011-07-08T04:14:33.102-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JBoss5'/><category scheme='http://www.blogger.com/atom/ns#' term='JBoss'/><title type='text'>Install JBoss 5.1 on CentOS</title><content type='html'>This post will cover installing JBoss 5.1 on CentOS 5.x.&lt;br /&gt;&lt;br /&gt;We'll also set up JBoss to run as a service&lt;br /&gt;&lt;br /&gt;I did my installation below on CentOS 5.5. This should work for RHEL and Fedora as well.&lt;br /&gt;&lt;br /&gt;Firstly, let's outline the steps we will be taking:&lt;br /&gt;&lt;br /&gt;1. Download and Install the Java Development Kit (JDK)&lt;br /&gt;2. Download and Install JBoss 5.1 Application Server&lt;br /&gt;3. Create the user, jboss, who will own and run JBoss&lt;br /&gt;4. Set the required JAVA_HOME and JBOSS_HOME paths&lt;br /&gt;5. Create a start/stop/restart script for JBoss&lt;br /&gt;6. Configure JBoss to run as a service&lt;br /&gt;7. Change the JBoss Admin Console password&lt;br /&gt;8. Set memory parameters for JBoss using JAVA_OPTS&lt;br /&gt;9. Configure JBoss to run on port 80&lt;br /&gt;10. Notes: Securing the JMX Console, Web Console, JBossWS, and Tomcat Status.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Step 1: Download and Install the Java Development Kit (JDK)&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;You can download the JDK here: &lt;a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html" target="_blank"&gt;http://www.oracle.com/technetwork/java/javase/downloads/index.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I'm using JDK 6, update 24, the latest as of this post. The JDK is specific to 32 and 64 bit versions. &lt;br /&gt;&lt;br /&gt;My CentOS box is 64 bit, so I'll need: jdk-6u24-linux-x64.bin.  &lt;br /&gt;&lt;br /&gt;If you are on 32 bit, you'll need: jdk-6u24-linux-i586.bin&lt;br /&gt;&lt;br /&gt;Download the appropriate JDK and save it to a directory. I'm saving it to /root.&lt;br /&gt;&lt;br /&gt;Move (mv) or copy (cp) the file to the /opt directory:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 ~]# mv jdk-6u24-linux-x64.bin /opt/jdk-6u24-linux-x64.bin&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Create the directory /usr/java.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 ~]# mkdir /usr/java&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Change to the /usr/java directory we created and install the JDK using 'sh /opt/jdk-6u24-linux-x64.bin'&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 ~]# cd /usr/java&lt;br /&gt;[root@sv2 java]# sh /opt/jdk-6u24-linux-x64.bin&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;We now have the JDK installed at /usr/java/jdk1.6.0_24. We'll use this for our JAVA_HOME a bit later in step &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Step 2: Download and Install JBoss 5.1 Application Server&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;Download jboss-5.1.0.GA.zip at &lt;a href="http://sourceforge.net/projects/jboss/files/JBoss/JBoss-5.1.0.GA/" target="_blank"&gt;http://sourceforge.net/projects/jboss/files/JBoss/JBoss-5.1.0.GA/&lt;/a&gt; or use wget:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@aoukuk25 ~]# wget http://sourceforge.net/projects/jboss/files/JBoss/JBoss-5.1.0.GA/jboss-5.1.0.GA.zip/download&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;Saving to: `jboss-5.1.0.GA.zip'&lt;br /&gt;&lt;br /&gt;100%[======================================&amp;gt;] 133,466,607 5.58M/s   in 17s&lt;br /&gt;&lt;br /&gt;2011-01-02 02:03:02 (7.56 MB/s) - `jboss-5.1.0.GA.zip' saved [133466607/133466607]&lt;br /&gt;[root@sv2 ~]#&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Move (mv) or copy (cp) the file to /usr/share/jboss-5.1.0.GA.zip.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 ~]# mv jboss-5.1.0.GA.zip /usr/share/jboss-5.1.0.GA.zip&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Change to the /usr/share directory and unzip the file:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 ~]# cd /usr/share&lt;br /&gt;[root@sv2 share]# unzip -q jboss-5.1.0.GA.zip&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The unzip will create the following directory:  /usr/share/jboss-5.1.0.GA&lt;br /&gt;&lt;br /&gt;This directory will be our JBOSS_HOME, which we will use below in Step 4 below&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Step 3: Create the user, jboss, who will own and run JBoss&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Since we will want to run JBoss as a non-root user with minimal privileges, we'll create a user, jboss, who will own the JBoss files and JBoss will run under his account.&lt;br /&gt;&lt;br /&gt;To do this, we can need to the following.&lt;br /&gt;&lt;br /&gt;Create a new group, jboss, and then create the user jboss and add the user to the jboss group.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 ~]# groupadd jboss&lt;br /&gt;[root@sv2 ~]# useradd -s /bin/bash -g jboss jboss&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Change ownership of the JBoss home directory, /usr/share/jboss-5.1.0.GA so all files are owned by the user jboss we created.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 ~]# chown -Rf jboss.jboss /usr/share/jboss-5.1.0.GA/&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Step 4: Set the required JAVA_HOME and JBOSS_HOME paths&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;We no need to set the JAVA_HOME and JBOSS_HOME.&lt;br /&gt;&lt;br /&gt;The JAVA_HOME is where we installed the JDK above, /usr/java/jdk1.6.0_24, and the JBOSS_HOME is where we installed JBoss above /usr/share/jboss-5.1.0.GA.&lt;br /&gt;&lt;br /&gt;Add the following to the jboss users .bash_profile:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;JAVA_HOME=/usr/java/jdk1.6.0_24&lt;br /&gt;export JAVA_HOME&lt;br /&gt;PATH=$JAVA_HOME/bin:$PATH&lt;br /&gt;export PATH&lt;br /&gt;JBOSS_HOME=/usr/share/jboss-5.1.0.GA&lt;br /&gt;export JBOSS_HOME&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;To set the JAVA_HOME for users, we add this to the user ~/.bashrc or ~/.bash_profile of the user. We can also add it /etc/profile and then source it to give to all users.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;JAVA_HOME=/usr/java/jdk1.6.0_24 &lt;br /&gt;export JAVA_HOME &lt;br /&gt;PATH=$JAVA_HOME/bin:$PATH &lt;br /&gt;export PATH&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Once you have added the above to ~/.bash_profile or ~/.bashrc, you should su to the user jboss and verify that the JAVA_HOME and JBOSS_HOME are set correctly.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 ~]#  su jboss&lt;br /&gt;[jboss@sv2 ~]#  echo $JAVA_HOME&lt;br /&gt;/usr/java/jdk1.6.0_24&lt;br /&gt;[jboss@sv2 ~]#  echo $JBOSS_HOME&lt;br /&gt;/usr/share/jboss-5.1.0.GA&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Step 5: Create a start/stop/restart script for JBoss&lt;/b&gt;.&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;For our JBoss script we will simply copy the existing jboss_init_redhat.sh script located at at /usr/share/jboss-5.1.0.GA/bin, copy it to /etc/init.d and rename it to 'jboss':&lt;br /&gt;&lt;br /&gt;So, as root:&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 ~]# cd /usr/share/jboss-5.1.0.GA/bin &lt;br /&gt;[root@sv2 bin]# cp jboss_init_redhat.sh /etc/init.d/jboss&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;In the jboss script (shown completed below), make the following changes:&lt;br /&gt;&lt;br /&gt;1. Add lines 3,4, and 5:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;# description: JBoss Start Stop Restart&lt;/b&gt;&lt;br /&gt;&lt;b&gt;# processname: jboss&lt;/b&gt;&lt;br /&gt;&lt;b&gt;# chkconfig: 234 20 80&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;2. Line 21, Set the JBOSS_HOME to where we unpacked JBoss in step 2 above:&lt;br /&gt;JBOSS_HOME=${JBOSS_HOME:-"&lt;b&gt;/usr/share/jboss-5.1.0.GA&lt;/b&gt;"}&lt;br /&gt;&lt;br /&gt;3. Line 27. Set the JAVA_HOME to where we installed the JDK in step 1 above:&lt;br /&gt;JAVAPTH=${JAVAPTH:-"&lt;b&gt;/usr/java/jdk1.6.0_24&lt;/b&gt;"}&lt;br /&gt;&lt;br /&gt;4. Add line 33, which sets the JBOSS_HOST to 0.0.0.0, allowing JBoss to bind to any IP.&lt;br /&gt;&lt;b&gt;JBOSS_HOST="0.0.0.0"&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;#!/bin/sh&lt;br /&gt;#&lt;br /&gt;# description: JBoss Start Stop Restart&lt;br /&gt;# processname: jboss&lt;br /&gt;# chkconfig: 234 20 80&lt;br /&gt;# $Id: jboss_init_redhat.sh 81068 2008-11-14 15:14:35Z dimitris@jboss.org $&lt;br /&gt;#&lt;br /&gt;# JBoss Control Script&lt;br /&gt;#&lt;br /&gt;# To use this script run it as root - it will switch to the specified user&lt;br /&gt;#&lt;br /&gt;# Here is a little (and extremely primitive) startup/shutdown script&lt;br /&gt;# for RedHat systems. It assumes that JBoss lives in /usr/local/jboss,&lt;br /&gt;# it's run by user 'jboss' and JDK binaries are in /usr/local/jdk/bin.&lt;br /&gt;# All this can be changed in the script itself. &lt;br /&gt;#&lt;br /&gt;# Either modify this script for your requirements or just ensure that&lt;br /&gt;# the following variables are set correctly before calling the script.&lt;br /&gt;&lt;br /&gt;#define where jboss is - this is the directory containing directories log, bin, conf etc&lt;br /&gt;JBOSS_HOME=${JBOSS_HOME:-"/usr/share/jboss-5.1.0.GA"}&lt;br /&gt;&lt;br /&gt;#define the user under which jboss will run, or use 'RUNASIS' to run as the current user&lt;br /&gt;JBOSS_USER=${JBOSS_USER:-"jboss"}&lt;br /&gt;&lt;br /&gt;#make sure java is in your path&lt;br /&gt;JAVAPTH=${JAVAPTH:-"/usr/java/jdk1.6.0_24"}&lt;br /&gt;&lt;br /&gt;#configuration to use, usually one of 'minimal', 'default', 'all'&lt;br /&gt;JBOSS_CONF=${JBOSS_CONF:-"default"}&lt;br /&gt;&lt;br /&gt;#if JBOSS_HOST specified, use -b to bind jboss services to that address&lt;br /&gt;JBOSS_HOST="0.0.0.0"&lt;br /&gt;JBOSS_BIND_ADDR=${JBOSS_HOST:+"-b $JBOSS_HOST"}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#define the classpath for the shutdown class&lt;br /&gt;JBOSSCP=${JBOSSCP:-"$JBOSS_HOME/bin/shutdown.jar:$JBOSS_HOME/client/jnet.jar"}&lt;br /&gt;&lt;br /&gt;#define the script to use to start jboss&lt;br /&gt;JBOSSSH=${JBOSSSH:-"$JBOSS_HOME/bin/run.sh -c $JBOSS_CONF $JBOSS_BIND_ADDR"}&lt;br /&gt;&lt;br /&gt;if [ "$JBOSS_USER" = "RUNASIS" ]; then&lt;br /&gt;  SUBIT=""&lt;br /&gt;else&lt;br /&gt;  SUBIT="su - $JBOSS_USER -c "&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;if [ -n "$JBOSS_CONSOLE" -a ! -d "$JBOSS_CONSOLE" ]; then&lt;br /&gt;  # ensure the file exists&lt;br /&gt;  touch $JBOSS_CONSOLE&lt;br /&gt;  if [ ! -z "$SUBIT" ]; then&lt;br /&gt;    chown $JBOSS_USER $JBOSS_CONSOLE&lt;br /&gt;  fi &lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;if [ -n "$JBOSS_CONSOLE" -a ! -f "$JBOSS_CONSOLE" ]; then&lt;br /&gt;  echo "WARNING: location for saving console log invalid: $JBOSS_CONSOLE"&lt;br /&gt;  echo "WARNING: ignoring it and using /dev/null"&lt;br /&gt;  JBOSS_CONSOLE="/dev/null"&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;#define what will be done with the console log&lt;br /&gt;JBOSS_CONSOLE=${JBOSS_CONSOLE:-"/dev/null"}&lt;br /&gt;&lt;br /&gt;JBOSS_CMD_START="cd $JBOSS_HOME/bin; $JBOSSSH"&lt;br /&gt;JBOSS_CMD_STOP=${JBOSS_CMD_STOP:-"java -classpath $JBOSSCP org.jboss.Shutdown --shutdown"}&lt;br /&gt;&lt;br /&gt;if [ -z "`echo $PATH | grep $JAVAPTH`" ]; then&lt;br /&gt;  export PATH=$PATH:$JAVAPTH&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;if [ ! -d "$JBOSS_HOME" ]; then&lt;br /&gt;  echo JBOSS_HOME does not exist as a valid directory : $JBOSS_HOME&lt;br /&gt;  exit 1&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;echo JBOSS_CMD_START = $JBOSS_CMD_START&lt;br /&gt;&lt;br /&gt;case "$1" in&lt;br /&gt;start)&lt;br /&gt;    cd $JBOSS_HOME/bin&lt;br /&gt;    if [ -z "$SUBIT" ]; then&lt;br /&gt;        eval $JBOSS_CMD_START &amp;gt;${JBOSS_CONSOLE} 2&amp;gt;&amp;amp;1 &amp;amp;&lt;br /&gt;    else&lt;br /&gt;        $SUBIT "$JBOSS_CMD_START &amp;gt;${JBOSS_CONSOLE} 2&amp;gt;&amp;amp;1 &amp;amp;" &lt;br /&gt;    fi&lt;br /&gt;    ;;&lt;br /&gt;stop)&lt;br /&gt;    if [ -z "$SUBIT" ]; then&lt;br /&gt;        $JBOSS_CMD_STOP&lt;br /&gt;    else&lt;br /&gt;        $SUBIT "$JBOSS_CMD_STOP"&lt;br /&gt;    fi &lt;br /&gt;    ;;&lt;br /&gt;restart)&lt;br /&gt;    $0 stop&lt;br /&gt;    $0 start&lt;br /&gt;    ;;&lt;br /&gt;*)&lt;br /&gt;    echo "usage: $0 (start|stop|restart|help)"&lt;br /&gt;esac&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Step 6: Run JBoss as a Service&lt;/b&gt;.&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;To run JBoss as a service and enable start up at boot, make the script we created above executable and add it to our chkconfig so it starts at boot.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 init.d]# chmod 755 jboss&lt;br /&gt;[root@sv2 init.d]# chkconfig --add jboss&lt;br /&gt;[root@sv2 init.d]# chkconfig --level 234 jboss on&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;We should now be able to Start, Stop, and Restart JBoss as a service.&lt;br /&gt;&lt;br /&gt;Start JBoss:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Note: JBoss can take some time to start.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 init.d]# service jboss start&lt;br /&gt;JBOSS_CMD_START = cd /usr/share/jboss-5.1.0.GA/bin; /usr/share/jboss-5.1.0.GA/bin/run.sh -c default -b 0.0.0.0&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Stop JBoss:&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 init.d]# service jboss stop&lt;br /&gt;JBOSS_CMD_START = cd /usr/share/jboss-5.1.0.GA/bin; /usr/share/jboss-5.1.0.GA/bin/run.sh -c default -b 0.0.0.0&lt;br /&gt;Shutdown message has been posted to the server.&lt;br /&gt;Server shutdown may take a while - check logfiles for completion&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Make sure JBoss is started and you should now be able to access the Jboss Console at:&lt;br /&gt;&lt;br /&gt;http://yourdomain.com:8080 or http://yourip:8080&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-L-i3UoxrUGM/TXf3bbp3JQI/AAAAAAAAAHw/Ygn90l9NEYc/s1600/login.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="194" src="http://2.bp.blogspot.com/-L-i3UoxrUGM/TXf3bbp3JQI/AAAAAAAAAHw/Ygn90l9NEYc/s320/login.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;If you have any difficulties, check the logs and also insure that port 8080 is open &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Step 7: Change the Admin Console Pasword&lt;/b&gt;.&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The default user name and password for the JBoss Admin Console is admin/admin&lt;br /&gt;&lt;br /&gt;To change the password, go to: &lt;br /&gt;&lt;br /&gt;/usr/share/jboss-5.1.0.GA/server/default/conf/props&lt;br /&gt;&lt;br /&gt;Edit the jmx-console-users.properties file, shown below&lt;br /&gt;&lt;pre class="js" name="code"&gt;# A sample users.properties file for use with the UsersRolesLoginModule&lt;br /&gt;admin=admin&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The user name is at left and the password at right. Change the password to something hard to guess ;-)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Step 8: Set JAVA_OPTS Memory Parameters&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;To set the memory limits for JBoss, &lt;br /&gt;&lt;br /&gt;Got to: /usr/share/jboss-5.1.0.GA/bin&lt;br /&gt;&lt;br /&gt;Open the run.sh file in a text editor.&lt;br /&gt;&lt;br /&gt;Find the section below:&lt;br /&gt;&lt;pre class="js" name="code"&gt;# Setup JBoss specific properties&lt;br /&gt;JAVA_OPTS="-Dprogram.name=$PROGNAME $JAVA_OPTS"&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Directly below this, add the desired parameters. &lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;# Setup JBoss specific properties&lt;br /&gt;JAVA_OPTS="-Dprogram.name=$PROGNAME $JAVA_OPTS"&lt;br /&gt;JAVA_OPTS="$JAVA_OPTS -Xms128m -Xmx256m"&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;I'm installing this on a small VPS so I'm using JAVA_OPTS="$JAVA_OPTS -Xms128m -Xmx256m". You should set this to whatever is appropriate to your server and application.&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Step 9: Running JBoss on Port 80&lt;/b&gt;.&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;To run services below port 1024 as user other than root, you can use port forwarding.&lt;br /&gt;&lt;br /&gt;You can do this by adding the following to your IP tables:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 ~]# iptables -t nat -A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080&lt;br /&gt;[root@sv2 ~]# iptables -t nat -A PREROUTING -p udp -m udp --dport 80 -j REDIRECT --to-ports 8080&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Step 10: Notes: Secure the JBoss Web Console, JMX Console, JBossWS, and Tomcat Status Page&lt;/b&gt;.&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;This section will cover some simple and most basic methods of securing the consoles.&lt;br /&gt;&lt;br /&gt;If you are simply running JBoss locally to have a look at it, you can skip this bit.&lt;br /&gt;&lt;br /&gt;I've seen more elegent presentations of securing JBoss, so you may want to Google this if you find below a bit clunky. &lt;br /&gt;&lt;br /&gt;As with anything related to your application and server security, please consult the docs. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Step 10a: Secure the JMX Console&lt;/b&gt;.&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;To secure the JMX Console, go to: &lt;br /&gt;/usr/share/jboss-5.1.0.GA/server/default/deploy/jmx-console.war/WEB-INF&lt;br /&gt;&lt;br /&gt;First, edit the web.xml file. Towards the bottom, you will find the security-constraint as shown below:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&amp;lt;!-- A security constraint that restricts access to the HTML JMX console&lt;br /&gt;   to users with the role JBossAdmin. Edit the roles to what you want and&lt;br /&gt;   uncomment the WEB-INF/jboss-web.xml/security-domain element to enable&lt;br /&gt;   secured access to the HTML JMX console.&lt;br /&gt;   &amp;lt;security-constraint&amp;gt;&lt;br /&gt;     &amp;lt;web-resource-collection&amp;gt;&lt;br /&gt;       &amp;lt;web-resource-name&amp;gt;HtmlAdaptor&amp;lt;/web-resource-name&amp;gt;&lt;br /&gt;       &amp;lt;description&amp;gt;An example security config that only allows users with the&lt;br /&gt;         role JBossAdmin to access the HTML JMX console web application&lt;br /&gt;       &amp;lt;/description&amp;gt;&lt;br /&gt;       &amp;lt;url-pattern&amp;gt;/*&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;       &amp;lt;http-method&amp;gt;GET&amp;lt;/http-method&amp;gt;&lt;br /&gt;       &amp;lt;http-method&amp;gt;POST&amp;lt;/http-method&amp;gt;&lt;br /&gt;     &amp;lt;/web-resource-collection&amp;gt;&lt;br /&gt;     &amp;lt;auth-constraint&amp;gt;&lt;br /&gt;       &amp;lt;role-name&amp;gt;JBossAdmin&amp;lt;/role-name&amp;gt;&lt;br /&gt;     &amp;lt;/auth-constraint&amp;gt;&lt;br /&gt;   &amp;lt;/security-constraint&amp;gt;&lt;br /&gt;   --&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Un-comment the security-constraint section so it appears thus:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&amp;lt;security-constraint&amp;gt;&lt;br /&gt;     &amp;lt;web-resource-collection&amp;gt;&lt;br /&gt;       &amp;lt;web-resource-name&amp;gt;HtmlAdaptor&amp;lt;/web-resource-name&amp;gt;&lt;br /&gt;       &amp;lt;description&amp;gt;An example security config that only allows users with the&lt;br /&gt;         role JBossAdmin to access the HTML JMX console web application&lt;br /&gt;       &amp;lt;/description&amp;gt;&lt;br /&gt;       &amp;lt;url-pattern&amp;gt;/*&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;       &amp;lt;http-method&amp;gt;GET&amp;lt;/http-method&amp;gt;&lt;br /&gt;       &amp;lt;http-method&amp;gt;POST&amp;lt;/http-method&amp;gt;&lt;br /&gt;     &amp;lt;/web-resource-collection&amp;gt;&lt;br /&gt;     &amp;lt;auth-constraint&amp;gt;&lt;br /&gt;       &amp;lt;role-name&amp;gt;JBossAdmin&amp;lt;/role-name&amp;gt;&lt;br /&gt;     &amp;lt;/auth-constraint&amp;gt;&lt;br /&gt;   &amp;lt;/security-constraint&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Next, still in the WEB-INF directory, edit the jboss-web.xml file, which will look as below:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&amp;lt;!DOCTYPE jboss-web PUBLIC&lt;br /&gt;   "-//JBoss//DTD Web Application 5.0//EN"&lt;br /&gt;   "http://www.jboss.org/j2ee/dtd/jboss-web_5_0.dtd"&amp;gt;&lt;br /&gt;   &lt;br /&gt;&amp;lt;jboss-web&amp;gt;&lt;br /&gt;   &amp;lt;!-- Uncomment the security-domain to enable security. You will&lt;br /&gt;      need to edit the htmladaptor login configuration to setup the&lt;br /&gt;      login modules used to authentication users.&lt;br /&gt;      &amp;lt;security-domain&amp;gt;java:/jaas/jmx-console&amp;lt;/security-domain&amp;gt;&lt;br /&gt;   --&amp;gt;&lt;br /&gt;&amp;lt;/jboss-web&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Uncomment the security-domain so it appears thus:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&amp;lt;jboss-web&amp;gt;&lt;br /&gt;   &lt;br /&gt;      &amp;lt;security-domain&amp;gt;java:/jaas/jmx-console&amp;lt;/security-domain&amp;gt;&lt;br /&gt;   &lt;br /&gt;&amp;lt;/jboss-web&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;At this point, the password for the JMX Console will be the same as the password we set for the Admin Console at in in step 7a above. Both are using the java:/jaas/jmx-console security domain.&lt;br /&gt;&lt;br /&gt;You can, of course change this if you wish to create a stronger solution.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Step 10b: Secure the Web Console&lt;/b&gt;.&lt;/span&gt;&lt;/div&gt;&lt;div style="color: blue;"&gt;&lt;/div&gt;&lt;br /&gt;To secure the Web Console, go to:&lt;br /&gt;&lt;br /&gt;/usr/share/jboss-5.1.0.GA/server/default/deploy/management/console-mgr.sar/web-console.war/WEB-INF&lt;br /&gt;&lt;br /&gt;As with the JMX Console, in the WEB-INF.xml un-comment the security constraint so it appears thus:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&amp;lt;security-constraint&amp;gt;&lt;br /&gt;   &amp;lt;web-resource-collection&amp;gt;&lt;br /&gt;   &amp;lt;web-resource-name&amp;gt;HtmlAdaptor&amp;lt;/web-resource-name&amp;gt;&lt;br /&gt;   &amp;lt;description&amp;gt;An example security config that only allows users with the&lt;br /&gt;   role JBossAdmin to access the HTML JMX console web application&lt;br /&gt;   &amp;lt;/description&amp;gt;&lt;br /&gt;   &amp;lt;url-pattern&amp;gt;/*&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;   &amp;lt;http-method&amp;gt;GET&amp;lt;/http-method&amp;gt;&lt;br /&gt;   &amp;lt;http-method&amp;gt;POST&amp;lt;/http-method&amp;gt;&lt;br /&gt;   &amp;lt;/web-resource-collection&amp;gt;&lt;br /&gt;   &amp;lt;auth-constraint&amp;gt;&lt;br /&gt;   &amp;lt;role-name&amp;gt;JBossAdmin&amp;lt;/role-name&amp;gt;&lt;br /&gt;   &amp;lt;/auth-constraint&amp;gt;&lt;br /&gt;   &amp;lt;/security-constraint&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Still in the WEB-INF directory, go to the jboss-web.xml file.&lt;br /&gt;&lt;br /&gt;By default, The jboss-web.xml file will appear as below:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&amp;lt;?xml version='1.0' encoding='UTF-8' ?&amp;gt;&lt;br /&gt; &lt;br /&gt;&amp;lt;!DOCTYPE jboss-web&lt;br /&gt;    PUBLIC "-//JBoss//DTD Web Application 2.3V2//EN"&lt;br /&gt;    "http://www.jboss.org/j2ee/dtd/jboss-web_3_2.dtd"&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;jboss-web&amp;gt;&lt;br /&gt;&lt;br /&gt;   &amp;lt;!-- Uncomment the security-domain to enable security. You will&lt;br /&gt;   need to edit the htmladaptor login configuration to setup the&lt;br /&gt;   login modules used to authentication users.&lt;br /&gt;   &amp;lt;security-domain&amp;gt;java:/jaas/web-console&amp;lt;/security-domain&amp;gt;&lt;br /&gt;   --&amp;gt;&lt;br /&gt;&lt;br /&gt;   &amp;lt;!-- The war depends on the --&amp;gt;&lt;br /&gt;   &amp;lt;depends&amp;gt;jboss.admin:service=PluginManager&amp;lt;/depends&amp;gt;&lt;br /&gt;&amp;lt;/jboss-web&amp;gt; &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Un-comment the security-domain so it appears thus:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&amp;lt;jboss-web&amp;gt;&lt;br /&gt;   &lt;br /&gt;   &amp;lt;security-domain&amp;gt;java:/jaas/web-console&amp;lt;/security-domain&amp;gt;&lt;br /&gt;  &lt;br /&gt;&lt;br /&gt;   &lt;br /&gt;   &amp;lt;depends&amp;gt;jboss.admin:service=PluginManager&amp;lt;/depends&amp;gt;&lt;br /&gt;&amp;lt;/jboss-web&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now, we need to make a change to the go to login-config.xml file located under /usr/share/jboss-5.1.0.GA/server/default/conf/&lt;br /&gt;&lt;br /&gt;Open the login-config.xml and look for the section below:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&amp;lt;application-policy name="web-console"&amp;gt;&lt;br /&gt;    &amp;lt;authentication&amp;gt;&lt;br /&gt;      &amp;lt;login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule" flag="required"&amp;gt;&lt;br /&gt;        &amp;lt;module-option name="usersProperties"&amp;gt;web-console-users.properties&amp;lt;/module-option&amp;gt;&lt;br /&gt;        &amp;lt;module-option name="rolesProperties"&amp;gt;web-console-roles.properties&amp;lt;/module-option&amp;gt;&lt;br /&gt;      &amp;lt;/login-module&amp;gt;&lt;br /&gt;    &amp;lt;/authentication&amp;gt;&lt;br /&gt;  &amp;lt;/application-policy&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Add 'props/' to the path of the web-console-users.properties and web-console-roles.properties&lt;br /&gt;&lt;br /&gt;So the section will now appear thus:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&amp;lt;application-policy name="web-console"&amp;gt;&lt;br /&gt;    &amp;lt;authentication&amp;gt;&lt;br /&gt;      &amp;lt;login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule" flag="required"&amp;gt;&lt;br /&gt;        &amp;lt;module-option name="usersProperties"&amp;gt;props/web-console-users.properties&amp;lt;/module-option&amp;gt;&lt;br /&gt;        &amp;lt;module-option name="rolesProperties"&amp;gt;props/web-console-roles.properties&amp;lt;/module-option&amp;gt;&lt;br /&gt;      &amp;lt;/login-module&amp;gt;&lt;br /&gt;    &amp;lt;/authentication&amp;gt;&lt;br /&gt;  &amp;lt;/application-policy&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Finally, go to /root/jboss-5.1.0.GA/server/default/conf/props and create the following files:&lt;br /&gt;&lt;br /&gt;1. web-console-roles.properties&lt;br /&gt;&lt;br /&gt;The web-console-roles.properties file should contain the following:&lt;br /&gt;&lt;pre class="js" name="code"&gt;admin=JBossAdmin,HttpInvoker&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;2. web-console-users.properties&lt;br /&gt;&lt;br /&gt;The web-console-users.properties file should contain the following:&lt;br /&gt;&lt;pre class="js" name="code"&gt;admin=WebSecret&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Where 'WebSecret' is whatever you would like the password to be. If you wish to be able to access the Web Console with the same password as for the Admin and JMX console, simply use the same password here.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Step 10c: Secure the JBossWS&lt;/b&gt;.&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The procedure for securing the JBossWS is virtually identical to securing the JMX-Console, save the difference in file loactions.&lt;br /&gt;&lt;br /&gt;To secure the JBossWS, go to: &lt;br /&gt;/usr/share/jboss-5.1.0.GA/server/default/deploy/jbossws.sar/jbossws-management.war/WEB-INF&lt;br /&gt;&lt;br /&gt;First, edit the web.xml file. Locate the security-constraint (about half-way down the file), and un-comment it so it appears thus:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&amp;lt;security-constraint&amp;gt;&lt;br /&gt;     &amp;lt;web-resource-collection&amp;gt;&lt;br /&gt;       &amp;lt;web-resource-name&amp;gt;ContextServlet&amp;lt;/web-resource-name&amp;gt;&lt;br /&gt;       &amp;lt;description&amp;gt;An example security config that only allows users with the&lt;br /&gt;         role 'friend' to access the JBossWS console web application&lt;br /&gt;       &amp;lt;/description&amp;gt;&lt;br /&gt;       &amp;lt;url-pattern&amp;gt;/*&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;       &amp;lt;http-method&amp;gt;GET&amp;lt;/http-method&amp;gt;&lt;br /&gt;       &amp;lt;http-method&amp;gt;POST&amp;lt;/http-method&amp;gt;&lt;br /&gt;     &amp;lt;/web-resource-collection&amp;gt;&lt;br /&gt;     &amp;lt;auth-constraint&amp;gt;&lt;br /&gt;       &amp;lt;role-name&amp;gt;friend&amp;lt;/role-name&amp;gt;&lt;br /&gt;     &amp;lt;/auth-constraint&amp;gt;&lt;br /&gt;   &amp;lt;/security-constraint&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Next, still in the WEB-INF directory, edit the jboss-web.xml file.&lt;br /&gt;&lt;br /&gt;Un-comment the security-domain so it appears thus:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&amp;lt;?xml version="1.0" encoding="ISO-8859-1"?&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;!DOCTYPE jboss-web&lt;br /&gt;    PUBLIC "-//JBoss//DTD Web Application 2.3V2//EN"&lt;br /&gt;    "http://www.jboss.org/j2ee/dtd/jboss-web_3_2.dtd"&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;jboss-web&amp;gt;&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;  &amp;lt;security-domain&amp;gt;java:/jaas/JBossWS&amp;lt;/security-domain&amp;gt;&lt;br /&gt; &lt;br /&gt;  &lt;br /&gt;  &amp;lt;context-root&amp;gt;jbossws&amp;lt;/context-root&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/jboss-web&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;In the /props directory you will find the jbossws-roles.properties and jbossws-users.properties files.&lt;br /&gt;&lt;br /&gt;The default role is 'friend' with user name 'Kermit' and password 'the frog'&lt;br /&gt;&lt;br /&gt;jbossws-roles.properties:&lt;br /&gt;&lt;pre class="js" name="code"&gt;# A sample roles.properties file for use with the UsersRolesLoginModule&lt;br /&gt;kermit=friend&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;jbossws-users.properties:&lt;br /&gt;&lt;pre class="js" name="code"&gt;# A sample users.properties file for use with the UsersRolesLoginModule&lt;br /&gt;kermit=thefrog&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Change the user name and password.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: blue;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Step 10d: Secure the Tomcat Status Page&lt;/b&gt;.&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="font-size: small;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;br /&gt;Many would recommend simply disabling the Tomcat Status.&lt;br /&gt;&lt;br /&gt;If you wish to secure it, however, go to: &lt;br /&gt;&lt;br /&gt;/usr/share/jboss-5.1.0.GA/server/default/deploy/ROOT.war/WEB-INF&lt;br /&gt;&lt;br /&gt;Just before the closing web-app tag add the following to the end of the web.xml file:  &lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&amp;lt;security-constraint&amp;gt;  &lt;br /&gt;    &amp;lt;security-constraint&amp;gt;&lt;br /&gt;     &amp;lt;web-resource-collection&amp;gt;&lt;br /&gt;       &amp;lt;web-resource-name&amp;gt;HtmlAdaptor&amp;lt;/web-resource-name&amp;gt;&lt;br /&gt;       &amp;lt;description&amp;gt;An example security config that only allows users with the&lt;br /&gt;         role JBossAdmin to access the HTML JMX console web application&lt;br /&gt;       &amp;lt;/description&amp;gt;&lt;br /&gt;       &amp;lt;url-pattern&amp;gt;/status&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;       &amp;lt;http-method&amp;gt;GET&amp;lt;/http-method&amp;gt;&lt;br /&gt;       &amp;lt;http-method&amp;gt;POST&amp;lt;/http-method&amp;gt;&lt;br /&gt;     &amp;lt;/web-resource-collection&amp;gt;&lt;br /&gt;     &amp;lt;auth-constraint&amp;gt;&lt;br /&gt;       &amp;lt;role-name&amp;gt;TomcatStatus&amp;lt;/role-name&amp;gt;&lt;br /&gt;     &amp;lt;/auth-constraint&amp;gt;&lt;br /&gt;   &amp;lt;/security-constraint&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   &amp;lt;login-config&amp;gt;&lt;br /&gt;      &amp;lt;auth-method&amp;gt;BASIC&amp;lt;/auth-method&amp;gt;&lt;br /&gt;      &amp;lt;realm-name&amp;gt;TomcatStatus&amp;lt;/realm-name&amp;gt;&lt;br /&gt;   &amp;lt;/login-config&amp;gt;&lt;br /&gt;&lt;br /&gt;   &amp;lt;security-role&amp;gt;&lt;br /&gt;      &amp;lt;role-name&amp;gt;TomcatStatus&amp;lt;/role-name&amp;gt;&lt;br /&gt;   &amp;lt;/security-role&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Your web.xml file should now look thus:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&amp;lt;?xml version="1.0" encoding="ISO-8859-1"?&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;!DOCTYPE web-app&lt;br /&gt;    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"&lt;br /&gt;    "http://java.sun.com/dtd/web-app_2_3.dtd"&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;web-app&amp;gt;&lt;br /&gt;  &amp;lt;display-name&amp;gt;Welcome to JBoss&amp;lt;/display-name&amp;gt;&lt;br /&gt;  &amp;lt;description&amp;gt;&lt;br /&gt;     Welcome to JBoss&lt;br /&gt;  &amp;lt;/description&amp;gt;&lt;br /&gt;  &amp;lt;servlet&amp;gt;&lt;br /&gt;    &amp;lt;servlet-name&amp;gt;Status Servlet&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;    &amp;lt;servlet-class&amp;gt;org.jboss.web.tomcat.service.StatusServlet&amp;lt;/servlet-class&amp;gt;&lt;br /&gt;  &amp;lt;/servlet&amp;gt;&lt;br /&gt;  &amp;lt;servlet-mapping&amp;gt;&lt;br /&gt;    &amp;lt;servlet-name&amp;gt;Status Servlet&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;    &amp;lt;url-pattern&amp;gt;/status&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;  &amp;lt;/servlet-mapping&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;security-constraint&amp;gt;&lt;br /&gt;     &amp;lt;web-resource-collection&amp;gt;&lt;br /&gt;       &amp;lt;web-resource-name&amp;gt;HtmlAdaptor&amp;lt;/web-resource-name&amp;gt;&lt;br /&gt;       &amp;lt;description&amp;gt;An example security config that only allows users with the&lt;br /&gt;         role JBossAdmin to access the HTML JMX console web application&lt;br /&gt;       &amp;lt;/description&amp;gt;&lt;br /&gt;       &amp;lt;url-pattern&amp;gt;/status&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;       &amp;lt;http-method&amp;gt;GET&amp;lt;/http-method&amp;gt;&lt;br /&gt;       &amp;lt;http-method&amp;gt;POST&amp;lt;/http-method&amp;gt;&lt;br /&gt;     &amp;lt;/web-resource-collection&amp;gt;&lt;br /&gt;     &amp;lt;auth-constraint&amp;gt;&lt;br /&gt;       &amp;lt;role-name&amp;gt;TomcatStatus&amp;lt;/role-name&amp;gt;&lt;br /&gt;     &amp;lt;/auth-constraint&amp;gt;&lt;br /&gt;   &amp;lt;/security-constraint&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   &amp;lt;login-config&amp;gt;&lt;br /&gt;      &amp;lt;auth-method&amp;gt;BASIC&amp;lt;/auth-method&amp;gt;&lt;br /&gt;      &amp;lt;realm-name&amp;gt;TomcatStatus&amp;lt;/realm-name&amp;gt;&lt;br /&gt;   &amp;lt;/login-config&amp;gt;&lt;br /&gt;&lt;br /&gt;   &amp;lt;security-role&amp;gt;&lt;br /&gt;      &amp;lt;role-name&amp;gt;TomcatStatus&amp;lt;/role-name&amp;gt;&lt;br /&gt;   &amp;lt;/security-role&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/web-app&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Still in the /usr/share/jboss-5.1.0.GA/server/default/deploy/ROOT.war/ directory, create a jboss-web.xml file with the following contents:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&amp;lt;jboss-web&amp;gt;  &lt;br /&gt;      &lt;br /&gt;       &amp;lt;security-domain&amp;gt;java:/jaas/tomcat-status&amp;lt;/security-domain&amp;gt;  &lt;br /&gt;      &lt;br /&gt;&amp;lt;/jboss-web&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Go to /usr/share/jboss-5.1.0.GA/server/default/conf&lt;br /&gt;&lt;br /&gt;Look for the following section:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&amp;lt;application-policy name="web-console"&amp;gt;&lt;br /&gt;    &amp;lt;authentication&amp;gt;&lt;br /&gt;      &amp;lt;login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule"&lt;br /&gt;        flag="required"&amp;gt;&lt;br /&gt;        &amp;lt;module-option name="usersProperties"&amp;gt;props/web-console-users.properties&amp;lt;/module-option&amp;gt;&lt;br /&gt;        &amp;lt;module-option name="rolesProperties"&amp;gt;props/web-console-roles.properties&amp;lt;/module-option&amp;gt;&lt;br /&gt;      &amp;lt;/login-module&amp;gt;&lt;br /&gt;    &amp;lt;/authentication&amp;gt;&lt;br /&gt;  &amp;lt;/application-policy&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Directly under this section, add the following entry:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&amp;lt;application-policy name="tomcat-status"&amp;gt;&lt;br /&gt;    &amp;lt;authentication&amp;gt;&lt;br /&gt;      &amp;lt;login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule"&lt;br /&gt;        flag="required"&amp;gt;&lt;br /&gt;        &amp;lt;module-option name="usersProperties"&amp;gt;props/tomcat-status-users.properties&amp;lt;/module-option&amp;gt;&lt;br /&gt;        &amp;lt;module-option name="rolesProperties"&amp;gt;props/tomcat-status-roles.properties&amp;lt;/module-option&amp;gt;&lt;br /&gt;      &amp;lt;/login-module&amp;gt;&lt;br /&gt;    &amp;lt;/authentication&amp;gt;&lt;br /&gt;  &amp;lt;/application-policy&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now, in the /usr/share/jboss-5.1.0.GA/server/default/conf/props directory, create the following two files:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;1. tomcat-status-roles.properties&lt;br /&gt;&lt;br /&gt;The tomcat-status-roles.properties file should contain the following:&lt;br /&gt;&lt;pre class="js" name="code"&gt;admin=TomcatStatus&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;2. tomcat-status-users.properties&lt;br /&gt;&lt;br /&gt;The tomcat-status-users.properties file should contain the following:&lt;br /&gt;&lt;pre class="js" name="code"&gt;admin=TomcatSecret&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Where 'TomcatSecret' is whatever you would like the password to be. If you wish to be able to access the Web Console with the same password as for the Admin and JMX console, simply use the same password here.&lt;br /&gt;&lt;br /&gt;Again, you may find it simpler to just disable the Tomcat Status.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://community.jboss.org/" target="_blank"&gt;http://community.jboss.org/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4739427765174521248-4448464518368599424?l=davidghedini.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://davidghedini.blogspot.com/feeds/4448464518368599424/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4739427765174521248&amp;postID=4448464518368599424&amp;isPopup=true' title='13 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/4448464518368599424'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/4448464518368599424'/><link rel='alternate' type='text/html' href='http://davidghedini.blogspot.com/2011/03/install-jboss-51-on-centos.html' title='Install JBoss 5.1 on CentOS'/><author><name>David Ghedini</name><uri>http://www.blogger.com/profile/17216036360922714725</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='20' src='http://3.bp.blogspot.com/_9kl8kmes6FE/TRZtxgi0R0I/AAAAAAAAAGY/plAxLyonZ_U/S220/TheWholeGang.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-L-i3UoxrUGM/TXf3bbp3JQI/AAAAAAAAAHw/Ygn90l9NEYc/s72-c/login.jpg' height='72' width='72'/><thr:total>13</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4739427765174521248.post-863245724049109484</id><published>2011-03-08T07:21:00.000-08:00</published><updated>2011-03-21T11:49:49.822-07:00</updated><title type='text'>Installing GlassFish 3.1 on CentOS or RHEL</title><content type='html'>GlassFish 3.1 has been released.&lt;br /&gt;&lt;br /&gt;I've created a post for installing GlassFish 3.1 on CentOS/RHEL which you can find on my new Roller Blog here:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.davidghedini.com/pg/entry/install_glassfish_3_1_on" target="_blank"&gt;http://www.davidghedini.com/pg/entry/install_glassfish_3_1_on &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;It is basically the same procedure as GlassFish 3.0.1, with some minor changes.&lt;br /&gt;&lt;br /&gt;You can find my GlassFish 3.0.1 post&amp;nbsp; &lt;a href="http://davidghedini.blogspot.com/2010/12/install-glassfish-3-on-centos.html"&gt;in this blog&lt;/a&gt;&lt;br /&gt;as well as at my new Roller blog:&amp;nbsp; &lt;a href="http://www.davidghedini.com/pg/entry/how_to_install_glassfish_3" target="_blank"&gt;http://www.davidghedini.com/pg/entry/how_to_install_glassfish_3&amp;nbsp;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;HTH.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;var a = $('h3.post-title').last().text();document.write(a);&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4739427765174521248-863245724049109484?l=davidghedini.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://davidghedini.blogspot.com/feeds/863245724049109484/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4739427765174521248&amp;postID=863245724049109484&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/863245724049109484'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/863245724049109484'/><link rel='alternate' type='text/html' href='http://davidghedini.blogspot.com/2011/03/installing-glassfish-31-on-centos-or.html' title='Installing GlassFish 3.1 on CentOS or RHEL'/><author><name>David Ghedini</name><uri>http://www.blogger.com/profile/17216036360922714725</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='20' src='http://3.bp.blogspot.com/_9kl8kmes6FE/TRZtxgi0R0I/AAAAAAAAAGY/plAxLyonZ_U/S220/TheWholeGang.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4739427765174521248.post-4744378960754174490</id><published>2011-02-10T16:02:00.000-08:00</published><updated>2011-03-21T10:55:16.720-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Apache Roller'/><category scheme='http://www.blogger.com/atom/ns#' term='Tomcat'/><title type='text'>Install Apache Roller 4 on CentOS and Tomcat</title><content type='html'>This post will cover installing Apache Roller 4.0.1 on CentOS with Tomcat and MySQL.&lt;br /&gt;&lt;br /&gt;4.0.1 is the current GA production release of Apache Roller.&lt;br /&gt;&lt;br /&gt;For this post, you will need a working installation of Tomcat. If you do not have Tomcat installed, you can install it using our Tomcat step-by-step guide &lt;a href="http://davidghedini.blogspot.com/2010/07/install-tomcat-6-on-centos.html" target="_blank"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;What you will need to download:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://roller.apache.org/download.cgi#roller40" target="_blank"&gt;apache-roller-4.0.1.zip&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.oracle.com/technetwork/java/javaee/index-138643.html" target="_blank"&gt;JavaMail 1.4.4&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.mysql.com/downloads/connector/j/" target="_blank"&gt;mysql-connector-java-5.1.15-bin.jar&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I'll be saving the above file to my /opt directory.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;b&gt;1. Create the Required MySQL Database and User:&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;We'll call our database 'roller'&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 opt]# mysql -u root -p&lt;br /&gt;Enter password:&lt;br /&gt;Welcome to the MySQL monitor.  Commands end with ; or \g.&lt;br /&gt;Your MySQL connection id is 2694&lt;br /&gt;Server version: 5.0.77 Source distribution&lt;br /&gt;&lt;br /&gt;Type 'help;' or '\h' for help. Type '\c' to clear the buffer.&lt;br /&gt;&lt;br /&gt;mysql&amp;gt; create database roller;&lt;br /&gt;Query OK, 1 row affected (0.00 sec)&lt;br /&gt;&lt;br /&gt;mysql&amp;gt; grant all on roller.* to myuser@localhost identified by 'secret';&lt;br /&gt;Query OK, 0 rows affected (0.00 sec)&lt;br /&gt;&lt;br /&gt;mysql&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;b&gt;2. Copy The Required JAR Files to the Tomcat/lib Directory&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;From our downloads, we'll need to copy the mail.jar and mysql-connector-java-5.1.15-bin.jar to our Tomcat/lib Directory&lt;br /&gt;&lt;br /&gt;Unzip javamail1_4_4.zip&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 opt]# unzip -q javamail1_4_4.zip&lt;br /&gt;&lt;/pre&gt;Change to the javamail-1.4.4 directory and copy mail.jar to the Tomcat lib directory:&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 opt]# cd javamail-1.4.4&lt;br /&gt;[root@srv6 javamail-1.4.4]# cp mail.jar /usr/share/apache-tomcat-6.0.30/lib/mail.jar&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Change back to the /opt directory and unpack mysql-connector-java-5.1.15.tar.gz &lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 javamail-1.4.4]# cd /opt&lt;br /&gt;[root@srv6 opt]# tar -xvf mysql-connector-java-5.1.15.tar.gz&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Change to the mysql-connector-java-5.1.15 directory and copy mysql-connector-java-5.1.15-bin.jar to the Tomcat lib directory:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 opt]# cd mysql-connector-java-5.1.15&lt;br /&gt;[root@srv6 mysql-connector-java-5.1.15]# cp mysql-connector-java-5.1.15-bin.jar /usr/share/apache-tomcat-6.0.30/lib/mysql-connector-java-5.1.15-bin.jar&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;b&gt;3. Create a roller-custom.properties File&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;We'll now create our roller-custom.properties file in the Tomcat/lib directory&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 mysql-connector-java-5.1.15]#  cd /usr/share/apache-tomcat-6.0.30/lib&lt;br /&gt;[root@srv6 lib]# vi roller-custom.properties&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The file should contain the following. Replace database, user and password with your own. If required enter the mail user credentials as well. &lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;installation.type=auto&lt;br /&gt;database.configurationType=jdbc&lt;br /&gt;database.jdbc.driverClass=com.mysql.jdbc.Driver&lt;br /&gt;database.jdbc.connectionURL=jdbc:mysql://localhost:3306/roller&lt;br /&gt;database.jdbc.username=myuser&lt;br /&gt;database.jdbc.password=secret&lt;br /&gt;mail.configurationType=properties&lt;br /&gt;mail.hostName=localhost&lt;br /&gt;#mail.username=&lt;br /&gt;#mail.password=&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;b&gt;4. Create roller.war&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;We now need to build the roller.war file from our Roller download.&lt;br /&gt;&lt;br /&gt;Unzip apache-roller-4.0.1.zip &lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 opt]# unzip -q apache-roller-4.0.1.zip&lt;br /&gt;&lt;/pre&gt;Change to the apache-roller-4.0.1/webapp/roller directory&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 opt]# cd apache-roller-4.0.1/webapp/roller&lt;br /&gt;&lt;/pre&gt;Create the WAR file&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 roller]# % jar cvf ../roller.war *&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;b&gt;5. Copy the roller.war to your Tomcat/webapps Directory&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;The roller.war file is created apache-roller-4.0.1/webapp directory. Copy the WAR to your Tomcat/webapps directory&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 webapp]# cp roller.war /usr/share/apache-tomcat-6.0.30/webapps/roller.war&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;b&gt;6. Start Tomcat&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;Start up Tomcat to load your new files and jars.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 webapp]# service tomcat start&lt;br /&gt;Using CATALINA_BASE:   /usr/share/apache-tomcat-6.0.30&lt;br /&gt;Using CATALINA_HOME:   /usr/share/apache-tomcat-6.0.30&lt;br /&gt;Using CATALINA_TMPDIR: /usr/share/apache-tomcat-6.0.30/temp&lt;br /&gt;Using JRE_HOME:        /usr/java/jdk1.6.0_23&lt;br /&gt;Using CLASSPATH:       /usr/share/apache-tomcat-6.0.30/bin/bootstrap.jar&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;b&gt;7. Create Roller Tables in MySQL via Roller GUI&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;If your installation was successful, you should now be able to go to http://YourIP:8080/roller or http://YourDomain:8080/roller&lt;br /&gt;&lt;br /&gt;If you are not able to access Roller, check your catalina.out or roller.log files in your Tomcat/logs directory.&lt;br /&gt;&lt;br /&gt;You should see a prompt to create the roller tables in MySQL.&lt;br /&gt;&lt;br /&gt;Click the "Yes - Create Tables Now" button&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-jaFCGMg8pQY/TVRqDAwu8LI/AAAAAAAAAHQ/KetJZ7t4LSg/s1600/RollerFirst.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="242" src="http://1.bp.blogspot.com/-jaFCGMg8pQY/TVRqDAwu8LI/AAAAAAAAAHQ/KetJZ7t4LSg/s400/RollerFirst.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;On successful completion of creating the Roller tables in MySQL you will see the following:&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-qPipy1A_m9A/TVRrslYDaeI/AAAAAAAAAHY/e_KuATDmUKc/s1600/RollerDBTables.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="238" src="http://4.bp.blogspot.com/-qPipy1A_m9A/TVRrslYDaeI/AAAAAAAAAHY/e_KuATDmUKc/s400/RollerDBTables.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Follow the prompt and click to complete the installation.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;b&gt;8. Create Global Admin User&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;The Roller Front Page should now be displayed as below.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-Grtz5N9Z1GA/TVRsOYbuyHI/AAAAAAAAAHg/QnHO7619l7I/s1600/RollerInstalled.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="238" src="http://2.bp.blogspot.com/-Grtz5N9Z1GA/TVRsOYbuyHI/AAAAAAAAAHg/QnHO7619l7I/s400/RollerInstalled.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Click the 'New User Registration Link' to create your Global Admin user. As noted, the first user registered will have Global Admin rights.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-OG9nCkREXUs/TVRstALaBcI/AAAAAAAAAHo/zQmYjQkF8oo/s1600/CreateAdmin.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="238" src="http://1.bp.blogspot.com/-OG9nCkREXUs/TVRstALaBcI/AAAAAAAAAHo/zQmYjQkF8oo/s400/CreateAdmin.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://roller.apache.org/"&gt;http://roller.apache.org/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;var a = $('h3.post-title').text();document.write(a);&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4739427765174521248-4744378960754174490?l=davidghedini.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://davidghedini.blogspot.com/feeds/4744378960754174490/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4739427765174521248&amp;postID=4744378960754174490&amp;isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/4744378960754174490'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/4744378960754174490'/><link rel='alternate' type='text/html' href='http://davidghedini.blogspot.com/2011/02/install-apache-roller-4-on-centos-and.html' title='Install Apache Roller 4 on CentOS and Tomcat'/><author><name>David Ghedini</name><uri>http://www.blogger.com/profile/17216036360922714725</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='20' src='http://3.bp.blogspot.com/_9kl8kmes6FE/TRZtxgi0R0I/AAAAAAAAAGY/plAxLyonZ_U/S220/TheWholeGang.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-jaFCGMg8pQY/TVRqDAwu8LI/AAAAAAAAAHQ/KetJZ7t4LSg/s72-c/RollerFirst.jpg' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4739427765174521248.post-1369276287644161298</id><published>2011-02-09T03:45:00.000-08:00</published><updated>2011-02-09T03:45:14.227-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Mondrian'/><category scheme='http://www.blogger.com/atom/ns#' term='Tomcat'/><category scheme='http://www.blogger.com/atom/ns#' term='OLAP'/><title type='text'>Install Mondrian OLAP 3.2 on CentOS with Tomcat and MySQL</title><content type='html'>This post will cover installing Mondrian OLAP Engine on CentOS with Tomcat and MySQL.&lt;br /&gt;&lt;br /&gt;Mondrian 3.2.0.13661&lt;br /&gt;Tomcat 6.0.30&lt;br /&gt;MySQL 5.0.77&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This post assumes you have a working Tomcat installation. If you do not, please follow our step-by-step tutorial to installing &lt;a href="http://davidghedini.blogspot.com/2010/07/install-tomcat-6-on-centos.html" target="_blank"&gt;Tomcat 6&lt;/a&gt; or &lt;a href="http://davidghedini.blogspot.com/2011/02/install-tomcat-7-on-centos-rhel.html" target="_blank"&gt;Tomcat 7&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;You will need to download the following:&lt;br /&gt;&lt;br /&gt;Mondrian: mondrian-3.2.0.13661.zip &lt;br /&gt;&lt;a href="http://sourceforge.net/projects/mondrian/files/mondrian/mondrian-3.2.0.13661-GA/" target="_blank"&gt;http://sourceforge.net/projects/mondrian/files/mondrian/mondrian-3.2.0.13661-GA/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Apache Axis 1.4: axis-bin-1_4.tar.gz&lt;br /&gt;&lt;a href="http://www.apache.org/dyn/closer.cgi/ws/axis/1_4" target="_blank"&gt;http://www.apache.org/dyn/closer.cgi/ws/axis/1_4&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;MySQL Connector J (if not already installed): mysql-connector-java-5.1.14.tar.gz&lt;br /&gt;&lt;a href="http://www.mysql.com/downloads/connector/j/" target="_blank"&gt;http://www.mysql.com/downloads/connector/j/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;b&gt;1. Download the Above Files to the /opt Directory.&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;Unzip mondrian-3.2.0.13661.zip&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 opt]# unzip -q mondrian-3.2.0.13661.zip&lt;br /&gt;&lt;/pre&gt;Unpack Axis 1.4&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 opt]# tar xzf axis-bin-1_4.tar.gz&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Unpack mysql-connector-java-5.1.14.tar.gz&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 opt]# tar xzf mysql-connector-java-5.1.14.tar.gz&lt;br /&gt;&lt;/pre&gt;In your /opt directory you should now have:&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 opt]# ls&lt;br /&gt;axis-1_4                mondrian-3.2.0.13661&lt;br /&gt;mysql-connector-java-5.1.14&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;b&gt;2. Deploy Mondrian to the Tomcat_Home/webapps folder.&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;Naviagte to /opt/mondrian-3.2.0.13661/lib &lt;br /&gt;&lt;br /&gt;You can use one of two methods to deploy the mondrian.war to Tomcat_Home/webapps:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;i&gt;Method 1.&lt;/i&gt;&lt;/b&gt; Copy or mv the Modrian.WAR file from /opt/mondrian-3.2.0.13661/lib to your Tomcat/webapps directory and restart Tomcat to deploy the WAR.&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 opt]# cp /opt/mondrian-3.2.0.13661/lib/mondrian.war /usr/share/apache-tomcat-6.0.30/webapps/mondrian.war&lt;br /&gt;[root@srv6 opt]# service tomcat start (or restart)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;i&gt;&lt;b&gt;Method 2.&lt;/b&gt;&lt;/i&gt; Create the mondrian directory under Tomcat_Home/webapps and manually and explode the WAR via the CLI&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 opt]# mkdir /usr/share/apache-tomcat-6.0.30/webapps/mondrian&lt;br /&gt;[root@srv6 opt]# cp /opt/mondrian-3.2.0.13661/lib/mondrian.war /usr/share/apache-tomcat-6.0.30/webapps/mondrian/mondrian.war&lt;br /&gt;[root@srv6 opt]# cd /usr/share/apache-tomcat-6.0.30/webapps/mondrian&lt;br /&gt;[root@srv6 mondrian]# jar -xvf mondrian.war&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;b&gt;3. Copy the Required Jars from Axis and MySQL to the Mondrain Directory Created Above&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;There are four JAR files we need from /opt/axis-1_4/lib: &lt;br /&gt;&lt;br /&gt;axis.jar&lt;br /&gt;commons-discovery-0.2.jar&lt;br /&gt;wsdl4j-1.5.1.jar&lt;br /&gt;jaxrpc.jar&lt;br /&gt;&lt;br /&gt;Copy or move these JAR file to /mondrian/WEB-INF/lib:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 mondrian]# cd /opt/axis-1_4/lib&lt;br /&gt;[root@srv6 lib]# cp axis.jar /usr/share/apache-tomcat-6.0.30/webapps/mondrian/WEB-INF/lib/axis.jar&lt;br /&gt;[root@srv6 lib]# cp commons-discovery-0.2.jar /usr/share/apache-tomcat-6.0.30/webapps/mondrian/WEB-INF/lib/commons-discovery-0.2.jar&lt;br /&gt;[root@srv6 lib]# cp wsdl4j-1.5.1.jar /usr/share/apache-tomcat-6.0.30/webapps/mondrian/WEB-INF/lib/wsdl4j-1.5.1.jar&lt;br /&gt;[root@srv6 lib]# cp jaxrpc.jar /usr/share/apache-tomcat-6.0.30/webapps/mondrian/WEB-INF/lib/jaxrpc.jar&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Copy or move the MySQL Connector to /usr/share/apache-tomcat-6.0.30/webapps/mondrian/WEB-INF/lib&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 lib]# cp /opt/mysql-connector-java-5.1.14/mysql-connector-java-5.1.14-bin.jar /usr/share/apache-tomcat-6.0.30/webapps/mondrian/WEB-INF/lib/mysql-connector-java-5.1.14-bin.jar&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;b&gt;4. Restart Tomcat&lt;/b&gt;&lt;/div&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;pre class="js" name="code"&gt;[root@srv6 ~]# service tomcat restart&lt;br /&gt;Using CATALINA_BASE:   /usr/share/apache-tomcat-6.0.30&lt;br /&gt;Using CATALINA_HOME:   /usr/share/apache-tomcat-6.0.30&lt;br /&gt;Using CATALINA_TMPDIR: /usr/share/apache-tomcat-6.0.30/temp&lt;br /&gt;Using JRE_HOME:        /usr/java/jdk1.6.0_23&lt;br /&gt;Using CLASSPATH:       /usr/share/apache-tomcat-6.0.30/bin/bootstrap.jar&lt;br /&gt;Using CATALINA_BASE:   /usr/share/apache-tomcat-6.0.30&lt;br /&gt;Using CATALINA_HOME:   /usr/share/apache-tomcat-6.0.30&lt;br /&gt;Using CATALINA_TMPDIR: /usr/share/apache-tomcat-6.0.30/temp&lt;br /&gt;Using JRE_HOME:        /usr/java/jdk1.6.0_23&lt;br /&gt;Using CLASSPATH:       /usr/share/apache-tomcat-6.0.30/bin/bootstrap.jar&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;b&gt;5. Create the Foodmart Database and Database User:&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 lib]# mysql -u root -p&lt;br /&gt;Enter password:&lt;br /&gt;Welcome to the MySQL monitor.  Commands end with ; or \g.&lt;br /&gt;Your MySQL connection id is 10&lt;br /&gt;Server version: 5.0.77 Source distribution&lt;br /&gt;&lt;br /&gt;Type 'help;' or '\h' for help. Type '\c' to clear the buffer.&lt;br /&gt;&lt;br /&gt;mysql&amp;gt; create database foodmart&lt;br /&gt;    -&amp;gt; ;&lt;br /&gt;Query OK, 1 row affected (0.02 sec)&lt;br /&gt;&lt;br /&gt;mysql&amp;gt; grant all privileges on *.* to 'foodmart'@'localhost' identified by 'foodmart';&lt;br /&gt;Query OK, 0 rows affected (0.02 sec)&lt;br /&gt;&lt;br /&gt;mysql&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;b&gt;6. Load the Foodmart Sample Data.&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;java -cp "/usr/share/apache-tomcat-6.0.30/webapps/mondrian/WEB-INF/lib/mondrian.jar:/usr/share/apache-tomcat-6.0.30/webapps/mondrian/WEB-INF/lib/log4j-1.2.8.jar:/usr/share/apache-tomcat-6.0.30/webapps/mondrian/WEB-INF/lib/commons-logging-1.0.4.jar:/usr/share/apache-tomcat-6.0.30/webapps/mondrian/WEB-INF/lib/commons-collections-3.1.jar:/usr/share/apache-tomcat-6.0.30/webapps/mondrian/WEB-INF/lib/eigenbase-xom.jar:/usr/share/apache-tomcat-6.0.30/webapps/mondrian/WEB-INF/lib/eigenbase-resgen.jar:/usr/share/apache-tomcat-6.0.30/webapps/mondrian/WEB-INF/lib/eigenbase-properties.jar:/usr/share/apache-tomcat-6.0.30/webapps/mondrian/WEB-INF/lib/mysql-connector-java-5.1.14-bin.jar" mondrian.test.loader.MondrianFoodMartLoader &lt;br /&gt;-verbose -tables -data -indexes -jdbcDrivers=com.mysql.jdbc.Driver &lt;br /&gt;-inputFile=/opt/mondrian-3.2.0.13661/demo/FoodMartCreateData.sql&lt;br /&gt;-outputJdbcURL="jdbc:mysql://localhost/foodmart?user=foodmart&amp;amp;password=foodmart"&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;In the above, I have used the full directory paths for everything. So you can run the above from any directory. It also allows you to see exactly where everything is coming from.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;My Tomcat installation is located at /usr/share/apache-tomcat-6.0.30, so if yours is elsewhere, you'll need to update this above.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Similarly, I have placed mysql-connector-java-5.1.14-bin.jar in mondrain/WEB-INF/lib. If you already have this elsewhere or are using a different version of connector j, update accordingly.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;The Pentaho/Mondrian docs do not mention using commons-collections-3.1.jar, but I needed to use this to get the data to load.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Now that we have loaded all of the require jars and loaded the sample data, we need to create a data source, and edit some files.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;b&gt;7. Create a Data Source:&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Create a Data Source, we'll call it DsMySQL. &lt;br /&gt;&lt;br /&gt;Open /usr/share/apache-tomcat-6.0.30/webapps/mondrian/WEB-INF/datasurce.xml and edit to look like below.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&lt;datasources&gt;&lt;br /&gt; &lt;datasource&gt;&lt;br /&gt;   &lt;datasourcename&gt;Provider=Mondrian;DataSource=DsMySQL;&lt;/datasourcename&gt;&lt;br /&gt;   &lt;datasourcedescription&gt;FoodMart Data Warehouse&lt;/datasourcedescription&gt;&lt;br /&gt;   &lt;url&gt;http://localhost:8080/mondrian/xmla&lt;/url&gt;&lt;br /&gt;   &lt;br /&gt;&lt;br /&gt;&lt;datasourceinfo&gt;Provider=mondrian;Jdbc=jdbc:mysql://localhost/foodmart;JdbcUser=foodmart;JdbcPassword=foodmart;JdbcDrivers=com.mysql.jdbc.Driver;&lt;/datasourceinfo&gt;&lt;br /&gt;  &lt;providername&gt;Mondrian&lt;/providername&gt;&lt;br /&gt;  &lt;providertype&gt;MDP&lt;/providertype&gt;&lt;br /&gt;  &lt;authenticationmode&gt;Unauthenticated&lt;/authenticationmode&gt;&lt;br /&gt;   &lt;catalogs&gt;&lt;br /&gt;    &lt;catalog name="FoodMart"&gt;&lt;br /&gt;     &lt;definition&gt;/WEB-INF/queries/FoodMart.xml&lt;/definition&gt;&lt;br /&gt;    &lt;/catalog&gt;&lt;br /&gt;   &lt;/catalogs&gt;&lt;br /&gt;&lt;/datasource&gt;&lt;/datasources&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;b&gt;8. Edit Mondrian web.xml.&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;Replace the two instances of @mondrian.webapp.connectString@ with the following:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;Provider=mondrian;Jdbc=jdbc:mysql://localhost/foodmart?user=foodmart&amp;amp;password=foodmart;Catalog=/WEB-INF/queries/FoodMart.xml;JdbcDrivers=com.mysql.jdbc.Driver;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Original web.xml entries:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&lt;context-param&gt;&lt;br /&gt;    &lt;param-name&gt;connectString&lt;/param-name&gt;&lt;param-value&gt;@mondrian.webapp.connectString@&lt;/param-value&gt;&lt;/context-param&gt;&lt;br /&gt;&lt;br /&gt;  &lt;servlet&gt;&lt;br /&gt;    &lt;servlet-name&gt;MDXQueryServlet&lt;/servlet-name&gt;&lt;br /&gt;    &lt;servlet-class&gt;mondrian.web.servlet.MdxQueryServlet&lt;/servlet-class&gt;&lt;br /&gt;    &lt;init-param&gt;&lt;br /&gt;      &lt;param-name&gt;connectString&lt;/param-name&gt;&lt;param-value&gt;@mondrian.webapp.connectString@&lt;/param-value&gt;&lt;/init-param&gt;&lt;br /&gt;  &lt;/servlet&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Web.xml after editing:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&lt;context-param&gt;&lt;br /&gt;    &lt;param-name&gt;connectString&lt;/param-name&gt;&lt;param-value&gt;Provider=mondrian;Jdbc=jdbc:mysql://localhost/foodmart?user=foodmart&amp;amp;password=foodmart;Catalog=/WEB-INF/queries/FoodMart.xml;JdbcDrivers=com.mysql.jdbc.Driver;&lt;/param-value&gt;&lt;/context-param&gt;&lt;br /&gt;  &lt;servlet&gt;&lt;br /&gt;    &lt;servlet-name&gt;MDXQueryServlet&lt;/servlet-name&gt;&lt;br /&gt;    &lt;servlet-class&gt;mondrian.web.servlet.MdxQueryServlet&lt;/servlet-class&gt;&lt;br /&gt;    &lt;init-param&gt;&lt;br /&gt;      &lt;param-name&gt;connectString&lt;/param-name&gt;&lt;param-value&gt;Provider=mondrian;Jdbc=jdbc:mysql://localhost/foodmart?user=foodmart&amp;amp;password=foodmart;Catalog=/WEB-INF/queries/FoodMart.xml;JdbcDrivers=com.mysql.jdbc.Driver;&lt;/param-value&gt;&lt;/init-param&gt;&lt;br /&gt;  &lt;/servlet&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;b&gt;9. Edit Queries &lt;/b&gt;&lt;/div&gt;&lt;br /&gt;Under /usr/share/apache-tomcat-6.0.30/webapps/mondrian/WEB-INF/queries, edit the following:&lt;br /&gt;&lt;br /&gt;fourhier.jsp&lt;br /&gt;mondrian.jsp&lt;br /&gt;colors.jsp&lt;br /&gt;arrows.jsp&lt;br /&gt;&lt;br /&gt;In each case, replace this:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&lt;jp:mondrianquery cataloguri="/WEB-INF/queries/FoodMart.xml" connectionpooling="false" id="query01" jdbcdriver="org.apache.derby.jdbc.EmbeddedDriver" jdbcpassword="sa" jdbcurl="jdbc:derby:classpath:/foodmart" jdbcuser="sa"&gt;&lt;br /&gt;&lt;/jp:mondrianquery&gt;&lt;/pre&gt;&lt;br /&gt;with this...&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&lt;jp:mondrianquery cataloguri="/WEB-INF/queries/FoodMart.xml" id="query01" jdbcdriver="com.mysql.jdbc.Driver" jdbcurl="jdbc:mysql://localhost/foodmart?user=foodmart&amp;amp;password=foodmart"&gt;&lt;br /&gt;&lt;/jp:mondrianquery&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;For testrole.jsp, replace this:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&lt;jp:mondrianquery cataloguri="/WEB-INF/queries/FoodMart.xml" id="query01" jdbcdriver="sun.jdbc.odbc.JdbcOdbcDriver" jdbcurl="jdbc:odbc:MondrianFoodMart" role="California manager"&gt;&lt;br /&gt;&lt;/jp:mondrianquery&gt;&lt;/pre&gt;&lt;br /&gt;with this...&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&lt;jp:mondrianquery cataloguri="/WEB-INF/queries/FoodMart.xml" id="query01" jdbcdriver="com.mysql.jdbc.Driver" jdbcurl="jdbc:mysql://localhost/foodmart?user=foodmart&amp;amp;password=foodmart" role="California manager"&gt;&lt;br /&gt;&lt;/jp:mondrianquery&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;For xmla.jsp, replace this:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&lt;jp:xmlaquery catalog="FoodMart" datasource="Provider=Mondrian;DataSource=MondrianFoodMart;" id="query01" uri="http://localhost:8080/mondrian/xmla"&gt;&lt;br /&gt;&lt;/jp:xmlaquery&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;with this...(using the Data Source, DsMySQL, we created in step 7 above):&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&lt;jp:xmlaquery catalog="FoodMart" datasource="Provider=Mondrian;DataSource=DsMySQL;" id="query01" uri="http://localhost:8080/mondrian/xmla"&gt;&lt;br /&gt;&lt;/jp:xmlaquery&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;b&gt;10. Edit Catalina.sh to force use of Axis for SOAP:&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;/usr/share/apache-tomcat-6.0.30/bin/Catalina.sh&lt;br /&gt;&lt;br /&gt;Add the following:&lt;br /&gt;&lt;pre class="js" name="code"&gt;JAVA_OPTS="-Djavax.xml.soap.MessageFactory=org.apache.axis.soap.MessageFactoryImpl -&lt;br /&gt;Djavax.xml.soap.SOAPConnectionFactory=org.apache.axis.soap.SOAPConnectionFactoryImpl -Djavax.xml.soap.SOAPFactory=org.apache.axis.soap.SOAPFactoryImpl"&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;b&gt;11. Restart Tomcat to Reload Edited Files.&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 ~]# service tomcat restart&lt;br /&gt;Using CATALINA_BASE:   /usr/share/apache-tomcat-6.0.30&lt;br /&gt;Using CATALINA_HOME:   /usr/share/apache-tomcat-6.0.30&lt;br /&gt;Using CATALINA_TMPDIR: /usr/share/apache-tomcat-6.0.30/temp&lt;br /&gt;Using JRE_HOME:        /usr/java/jdk1.6.0_23&lt;br /&gt;Using CLASSPATH:       /usr/share/apache-tomcat-6.0.30/bin/bootstrap.jar&lt;br /&gt;Using CATALINA_BASE:   /usr/share/apache-tomcat-6.0.30&lt;br /&gt;Using CATALINA_HOME:   /usr/share/apache-tomcat-6.0.30&lt;br /&gt;Using CATALINA_TMPDIR: /usr/share/apache-tomcat-6.0.30/temp&lt;br /&gt;Using JRE_HOME:        /usr/java/jdk1.6.0_23&lt;br /&gt;Using CLASSPATH:       /usr/share/apache-tomcat-6.0.30/bin/bootstrap.jar&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;That should do it :)&lt;br /&gt;&lt;br /&gt;Navigate to http://YourIP:8080/modrian or http://YourDomain.com:8080/mondrian and verify that all samples are working correctly.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Notes:&lt;br /&gt;&lt;br /&gt;Mondrian Installation Docs:&lt;br /&gt;&lt;a href="http://mondrian.pentaho.com/documentation/installation.php" target="_blank"&gt;http://mondrian.pentaho.com/documentation/installation.php&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Forcing Mondrian to use axis (SOAP) and Xalan libraries for JPivot by Sherman Wood;&lt;br /&gt;&lt;a href="http://lists.pentaho.org/pipermail/mondrian/2009-January/001550.html" target="_blank"&gt;http://lists.pentaho.org/pipermail/mondrian/2009-January/001550.html&lt;/a&gt;&lt;br /&gt;&lt;a href="http://lists.pentaho.org/pipermail/mondrian/2009-January/001553.html" target="_blank"&gt;http://lists.pentaho.org/pipermail/mondrian/2009-January/001553.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I did not use Xalan in the above post.  &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;A great step-by-step guide to trouble-shooting each sample app from Feris Thia:&lt;br /&gt;&lt;a href="http://pentaho-en.phi-integration.com/mondrian/configuring-mondrian-sample" target="_blank"&gt;http://pentaho-en.phi-integration.com/mondrian/configuring-mondrian-sample&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4739427765174521248-1369276287644161298?l=davidghedini.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://davidghedini.blogspot.com/feeds/1369276287644161298/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4739427765174521248&amp;postID=1369276287644161298&amp;isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/1369276287644161298'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/1369276287644161298'/><link rel='alternate' type='text/html' href='http://davidghedini.blogspot.com/2011/02/install-mondrian-olap-32-on-centos-with.html' title='Install Mondrian OLAP 3.2 on CentOS with Tomcat and MySQL'/><author><name>David Ghedini</name><uri>http://www.blogger.com/profile/17216036360922714725</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='20' src='http://3.bp.blogspot.com/_9kl8kmes6FE/TRZtxgi0R0I/AAAAAAAAAGY/plAxLyonZ_U/S220/TheWholeGang.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4739427765174521248.post-2903577252258790317</id><published>2011-02-01T01:36:00.000-08:00</published><updated>2011-12-25T05:43:03.844-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CentOS'/><category scheme='http://www.blogger.com/atom/ns#' term='Tomcat'/><category scheme='http://www.blogger.com/atom/ns#' term='Install Tomcat'/><category scheme='http://www.blogger.com/atom/ns#' term='Tomcat 7'/><title type='text'>Install Tomcat 7 on CentOS / RHEL</title><content type='html'>This post will cover installing and basic configuration of Tomcat 7 on CentOS 5.x.&lt;br /&gt;&lt;br /&gt;The procedure can be used for Fedora and RHEL as well.&lt;br /&gt;&lt;br /&gt;Tomcat 7 implements the JavaServer Pages 2.2 and Servlet 3.0 specifications and a number of new features. The Manager application also has a new look with finer-grain roles and access than 6.x&lt;br /&gt;&lt;br /&gt;In this post, we'll install the required JDK, Tomcat, configure Tomcat as a service, create a start/stop/restart script, and (optionally) configure Tomcat to run under a non-root user.&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;b&gt;PLEASE NOTE: This post covers installation of Tomcat 7 along with JDK 6. For installation of Tomcat 7 with JDK 7 (recommended), please see my updated post here:&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;b&gt;&lt;a href="http://www.davidghedini.com/pg/entry/install_tomcat_7_on_centos" target="_blank"&gt;http://www.davidghedini.com/pg/entry/install_tomcat_7_on_centos&lt;/a&gt;&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;For this installation, we'll use Tomcat 7.0.19, the current stable release of Tomcat 7. This post began with the first Tomcat 7 release and I have tried to keep it updated to keep things as "copy and paste" as possible. &lt;br /&gt;&lt;br /&gt;I've also updated the post for JDK 6, Update 26.&lt;br /&gt;&lt;br /&gt;To begin, we'll need to install the Java Development Kit (JDK) 1.6&lt;br /&gt;&lt;br /&gt;&lt;b&gt;JDK 1.6 is the minimum JDK version for Tomcat 7.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;If you do have the JDK installed, you can skip to: Step 2: Download and Unpack Tomcat 7.0.19:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;b&gt;Step 1: Install JDK 1.6&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;You can download the JDK here: &lt;a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html" target="_blank"&gt;http://www.oracle.com/technetwork/java/javase/downloads/index.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;We'll install the latest JDK, which is JDK 6 Update 26. The JDK is specific to 32 and 64 bit versions.&lt;br /&gt;&lt;br /&gt;My CentOS box is 64 bit, so I'll need: jdk-6u26-linux-x64.bin&lt;br /&gt;&lt;br /&gt;If you are on 32 bit, you'll need: jdk-6u26-linux-i586.bin&lt;br /&gt;&lt;br /&gt;Download the appropriate JDK and save it to a directory. I'm saving it to /root.&lt;br /&gt;&lt;br /&gt;Move (mv) or copy (cp) the file to the /opt directory:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 ~]# mv jdk-6u26-linux-x64.bin /opt/jdk-6u26-linux-x64.bin  &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Create a new directory /usr/java.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 ~]# mkdir /usr/java  &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Change to the /usr/java directory we created and install the JDK using 'sh /opt/jdk-6u26-linux-x64.bin'&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 ~]# cd /usr/java&lt;br /&gt;[root@srv6 java]# sh /opt/jdk-6u26-linux-x64.bin&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Set the JAVA_HOME path. This is where we installed our JDK above.&lt;br /&gt;&lt;br /&gt;To set it for your current session, you can issue the following from the CLI:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 java]# JAVA_HOME=/usr/java/jdk1.6.0_26&lt;br /&gt;[root@srv6 java]# export JAVA_HOME&lt;br /&gt;[root@srv6 java]# PATH=$JAVA_HOME/bin:$PATH&lt;br /&gt;[root@srv6 java]# export PATH&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;To set the JAVA_HOME permanently, we add below to either the ~/.bashrc or ~/.bash_profile of the user (in this case, root). &lt;br /&gt;&lt;br /&gt;We can also add it /etc/profile and then source it to give to all users.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;JAVA_HOME=/usr/java/jdk1.6.0_26&lt;br /&gt;export JAVA_HOME&lt;br /&gt;PATH=$JAVA_HOME/bin:$PATH&lt;br /&gt;export PATH&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Once you have added the above to ~/.bash_profile or ~/.bashrc, you should log out, then log back in and check that the JAVA_HOME is set correctly.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 ~]#  echo $JAVA_HOME&lt;br /&gt;/usr/java/jdk1.6.0_26&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;b&gt;Step 2: Download and Unpack Tomcat 7.0.19&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;Download apache-tomcat-7.0.19.tar.gz &lt;a href="http://tomcat.apache.org/download-70.cgi" target="_blank"&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Alternatively, you can download using wget. &lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 ~]#  wget http://apache.mivzakim.net/tomcat/tomcat-7/v7.0.19/bin/apache-tomcat-7.0.19.tar.gz&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Save the file to a directory. I'm saving it to /root/apache-tomcat-7.0.19.tar.gz&lt;br /&gt;&lt;br /&gt;Before proceeding, you should verify the MD5 Checksum for your Tomcat download (or any other download).&lt;br /&gt;&lt;br /&gt;Since we saved the Tomcat download to /root/apache-tomcat-7.0.19.tar.gz, we'll go to the /root directory and use the md5sum command.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 ~]# md5sum apache-tomcat-7.0.19.tar.gz&lt;br /&gt;5a5e9bc742714d1b7210d9f68764fd8e *apache-tomcat-7.0.19.zip&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Compare the output above to the MD5 Checksum provided by &lt;a href="http://www.apache.org/dist/tomcat/tomcat-7/v7.0.19/bin/apache-tomcat-7.0.19.zip.md5" target="_blank"&gt;here the Apache Tomcat MD5 page&lt;/a&gt; and insure that they match exactly. &lt;br /&gt;&lt;br /&gt;Now, move (mv) or copy (cp) the file to the /usr/share directory:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 ~]# mv apache-tomcat-7.0.19.tar.gz /usr/share/apache-tomcat-7.0.19.tar.gz&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Change to the /usr/share directory and unpack the file using tar -xzf:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 ~]# cd /usr/share&lt;br /&gt;[root@sv2 srv6 ]# tar -xzf apache-tomcat-7.0.19.tar.gz  &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This will create the directory /usr/share/apache-tomcat-7.0.19&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;b&gt;Step 3: Configure Tomcat to Run as a Service.&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;We will now see how to run Tomcat as a service and create a simple Start/Stop/Restart script, as well as to start Tomcat at boot.&lt;br /&gt;&lt;br /&gt;Change to the /etc/init.d directory and create a script called 'tomcat' as shown below.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 share]# cd /etc/init.d&lt;br /&gt;[root@srv6 init.d]# vi tomcat&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;#!/bin/bash&lt;br /&gt;# description: Tomcat Start Stop Restart&lt;br /&gt;# processname: tomcat&lt;br /&gt;# chkconfig: 234 20 80&lt;br /&gt;JAVA_HOME=/usr/java/jdk1.6.0_26&lt;br /&gt;export JAVA_HOME&lt;br /&gt;PATH=$JAVA_HOME/bin:$PATH&lt;br /&gt;export PATH&lt;br /&gt;CATALINA_HOME=/usr/share/apache-tomcat-7.0.19&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;case $1 in&lt;br /&gt;start)&lt;br /&gt;sh $CATALINA_HOME/bin/startup.sh&lt;br /&gt;;; &lt;br /&gt;stop)   &lt;br /&gt;sh $CATALINA_HOME/bin/shutdown.sh&lt;br /&gt;;; &lt;br /&gt;restart)&lt;br /&gt;sh $CATALINA_HOME/bin/shutdown.sh&lt;br /&gt;sh $CATALINA_HOME/bin/startup.sh&lt;br /&gt;;; &lt;br /&gt;esac    &lt;br /&gt;exit 0&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The above script is simple and contains all of the basic elements you will need to get going. &lt;br /&gt;&lt;br /&gt;As you can see, we are simply calling the startup.sh and shutdown.sh scripts located in the Tomcat bin directory (/usr/share/apache-tomcat-7.0.19/bin). &lt;br /&gt;&lt;br /&gt;You can adjust your script according to your needs and, in subsequent posts, we'll look at additional examples.&lt;br /&gt;&lt;br /&gt;CATALINA_HOME is the Tomcat home directory (/usr/share/apache-tomcat-7.0.19)&lt;br /&gt;&lt;br /&gt;Now, set the permissions for your script to make it executable:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 init.d]# chmod 755 tomcat&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;We now use the chkconfig utility to have Tomcat start at boot time. In my script above, I am using chkconfig: 234 20 80. 2445 are the run levels and 20 and 80 are the stop and start priorities respectively. You can adjust as needed.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 init.d]# chkconfig --add tomcat&lt;br /&gt;[root@srv6 init.d]# chkconfig --level 234 tomcat on&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Verify it:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 init.d]# chkconfig --list tomcat&lt;br /&gt;tomcat          0:off   1:off   2:on    3:on    4:on    5:off   6:off&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Now, let's test our script.&lt;br /&gt;&lt;br /&gt;Start Tomcat:&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 ~]# service tomcat start&lt;br /&gt;Using CATALINA_BASE:   /usr/share/apache-tomcat-7.0.19&lt;br /&gt;Using CATALINA_HOME:   /usr/share/apache-tomcat-7.0.19&lt;br /&gt;Using CATALINA_TMPDIR: /usr/share/apache-tomcat-7.0.19/temp&lt;br /&gt;Using JRE_HOME:        /usr/java/jdk1.6.0_26&lt;br /&gt;Using CLASSPATH:       /usr/share/apache-tomcat-7.0.19/bin/bootstrap.jar:/usr/share/apache-tomcat-7.0.19/bin/tomcat-juli.jar&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Stop Tomcat:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 ~]# service tomcat stop&lt;br /&gt;Using CATALINA_BASE:   /usr/share/apache-tomcat-7.0.19&lt;br /&gt;Using CATALINA_HOME:   /usr/share/apache-tomcat-7.0.19&lt;br /&gt;Using CATALINA_TMPDIR: /usr/share/apache-tomcat-7.0.19/temp&lt;br /&gt;Using JRE_HOME:        /usr/java/jdk1.6.0_26&lt;br /&gt;Using CLASSPATH:       /usr/share/apache-tomcat-7.0.19/bin/bootstrap.jar:/usr/share/apache-tomcat-7.0.19/bin/tomcat-juli.jar&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Restarting Tomcat (Must be started first):&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 ~]# service tomcat restart&lt;br /&gt;Using CATALINA_BASE:   /usr/share/apache-tomcat-7.0.19&lt;br /&gt;Using CATALINA_HOME:   /usr/share/apache-tomcat-7.0.19&lt;br /&gt;Using CATALINA_TMPDIR: /usr/share/apache-tomcat-7.0.19/temp&lt;br /&gt;Using JRE_HOME:        /usr/java/jdk1.6.0_26&lt;br /&gt;Using CLASSPATH:       /usr/share/apache-tomcat-7.0.19/bin/bootstrap.jar:/usr/share/apache-tomcat-7.0.19/bin/tomcat-juli.jar&lt;br /&gt;Using CATALINA_BASE:   /usr/share/apache-tomcat-7.0.19&lt;br /&gt;Using CATALINA_HOME:   /usr/share/apache-tomcat-7.0.19&lt;br /&gt;Using CATALINA_TMPDIR: /usr/share/apache-tomcat-7.0.19/temp&lt;br /&gt;Using JRE_HOME:        /usr/java/jdk1.6.0_26&lt;br /&gt;Using CLASSPATH:       /usr/share/apache-tomcat-7.0.19/bin/bootstrap.jar:/usr/share/apache-tomcat-7.0.19/bin/tomcat-juli.jar&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;We should review the Catalina.out log located at /usr/share/apache-tomcat-7.0.19/logs/catalina.out and check for any errors.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 init.d]# more /usr/share/apache-tomcat-7.0.19/logs/catalina.out&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;We can now access the swanky new Tomcat Manager page at:&lt;br /&gt;&lt;br /&gt;http://yourdomain.com:8080 or http://yourIPaddress:8080 and we should see the Tomcat home page.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_9kl8kmes6FE/TUcwA18AARI/AAAAAAAAAHE/aI_eoXu9JAs/s1600/TomcatManager.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="258" src="http://1.bp.blogspot.com/_9kl8kmes6FE/TUcwA18AARI/AAAAAAAAAHE/aI_eoXu9JAs/s320/TomcatManager.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;b&gt;Step 4: Configuring Tomcat Manager Access.&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;Tomcat 7 contains a number of changes that offer finer-grain roles.&lt;br /&gt;&lt;br /&gt;For security reasons, no users or passwords are created for the Tomcat manager roles by default. In a production deployment, it is always best to remove the Manager application.&lt;br /&gt;&lt;br /&gt;To set roles, user name(s) and password(s), we need to configure the tomcat-users.xml file located at $CATALINA_HOME/conf/tomcat-users.xml.&lt;br /&gt;&lt;br /&gt;In the case of our installation, $CATALINA_HOME is located at /usr/share/apache-tomcat-7.0.19.&lt;br /&gt;&lt;br /&gt;By default the Tomcat 7 tomcat-users.xml file will look as below.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&amp;lt;!--&lt;br /&gt;  Licensed to the Apache Software Foundation (ASF) under one or more&lt;br /&gt;  contributor license agreements.  See the NOTICE file distributed with&lt;br /&gt;  this work for additional information regarding copyright ownership.&lt;br /&gt;  The ASF licenses this file to You under the Apache License, Version 2.0&lt;br /&gt;  (the "License"); you may not use this file except in compliance with&lt;br /&gt;  the License.  You may obtain a copy of the License at&lt;br /&gt;&lt;br /&gt;      http://www.apache.org/licenses/LICENSE-2.0&lt;br /&gt;&lt;br /&gt;  Unless required by applicable law or agreed to in writing, software&lt;br /&gt;  distributed under the License is distributed on an "AS IS" BASIS,&lt;br /&gt;  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&lt;br /&gt;  See the License for the specific language governing permissions and&lt;br /&gt;  limitations under the License.&lt;br /&gt;--&amp;gt;&lt;br /&gt;&amp;lt;tomcat-users&amp;gt;&lt;br /&gt;&amp;lt;!--&lt;br /&gt;  NOTE:  By default, no user is included in the "manager-gui" role required&lt;br /&gt;  to operate the "/manager/html" web application.  If you wish to use this app,&lt;br /&gt;  you must define such a user - the username and password are arbitrary.&lt;br /&gt;--&amp;gt;&lt;br /&gt;&amp;lt;!--&lt;br /&gt;  NOTE:  The sample user and role entries below are wrapped in a comment&lt;br /&gt;  and thus are ignored when reading this file. Do not forget to remove&lt;br /&gt;  &amp;lt;!.. ..&amp;gt; that surrounds them.&lt;br /&gt;--&amp;gt;&lt;br /&gt;&amp;lt;!--&lt;br /&gt;  &amp;lt;role rolename="tomcat"/&amp;gt;&lt;br /&gt;  &amp;lt;role rolename="role1"/&amp;gt;&lt;br /&gt;  &amp;lt;user username="tomcat" password="tomcat" roles="tomcat"/&amp;gt;&lt;br /&gt;  &amp;lt;user username="both" password="tomcat" roles="tomcat,role1"/&amp;gt;&lt;br /&gt;  &amp;lt;user username="role1" password="tomcat" roles="role1"/&amp;gt;&lt;br /&gt;--&amp;gt;&lt;br /&gt;&amp;lt;/tomcat-users&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Note that while examples are provided, the elements between the &amp;lt;tomcat-users&amp;gt; and &amp;lt;/tomcat-users&amp;gt; tags have been commented-out.&lt;br /&gt;&lt;br /&gt;New roles for Tomcat 7 offer finer-grained access.&lt;br /&gt;&lt;br /&gt;The following roles are available: &lt;br /&gt;&lt;br /&gt;manager-gui&lt;br /&gt;manager-status&lt;br /&gt;manager-jmx&lt;br /&gt;manager-script&lt;br /&gt;admin-gu&lt;br /&gt;admin-script.&lt;br /&gt;&lt;br /&gt;We can enable access for the manager-gui role, for example as below:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&amp;lt;tomcat-users&amp;gt;&lt;br /&gt;&amp;lt;role rolename="manager-gui"&amp;gt;&lt;br /&gt;&amp;lt;user username="tomcat" password="secret" roles="manager-gui"&amp;gt;&lt;br /&gt;&amp;lt;/user&amp;gt;&lt;br /&gt;&amp;lt;/role&amp;gt;&amp;lt;/tomcat-users&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Caution should be exercised in granting multiple roles so as not to under-mind security.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;b&gt;Step 5 (Optional): How to Run Tomcat using Minimally Privileged (non-root) User.&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;In our Tomcat configuration above, we are running Tomcat as Root.&lt;br /&gt;&lt;br /&gt;For security reasons, it is always best to run services with the only those privileges that are necessary. &lt;br /&gt;&lt;br /&gt;There are some who make a strong case that this is not required, but it's always best to err on the side of caution.&lt;br /&gt;&lt;br /&gt;To run Tomcat as non-root user, we need to do the following:&lt;br /&gt;&lt;br /&gt;1. Create the group 'tomcat':&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 ~]# groupadd tomcat&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;2. Create the user 'tomcat' and add this user to the tomcat group we created above.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 ~]# useradd -s /bin/bash -g tomcat tomcat&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The above will create a home directory for the user tomcat in the default user home as /home/tomcat&lt;br /&gt;&lt;br /&gt;If we want the home directory to be elsewhere, we simply specify so using the -d switch.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 ~]# useradd -g tomcat -d /usr/share/apache-tomcat-7.0.19/tomcat tomcat&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The above will create the user tomcat's home directory as /usr/share/apache-tomcat-7.0.19/tomcat&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;3. Change ownership of the tomcat files to the user tomcat we created above:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 ~]# chown -Rf tomcat.tomcat /usr/share/apache-tomcat-7.0.19/&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Note: it is possible to enhance our security still further by making certain files and directories read-only. This will not be covered in this post and care should be used when setting such permissions.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;4. Adjust the start/stop service script we created above. In our new script, we need to su to the user tomcat:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;#!/bin/bash&lt;br /&gt;# description: Tomcat Start Stop Restart&lt;br /&gt;# processname: tomcat&lt;br /&gt;# chkconfig: 234 20 80&lt;br /&gt;JAVA_HOME=/usr/java/jdk1.6.0_26&lt;br /&gt;export JAVA_HOME&lt;br /&gt;PATH=$JAVA_HOME/bin:$PATH&lt;br /&gt;export PATH&lt;br /&gt;TOMCAT_HOME=/usr/share/apache-tomcat-7.0.19/bin&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;case $1 in&lt;br /&gt;start)&lt;br /&gt;/bin/su tomcat $TOMCAT_HOME/startup.sh&lt;br /&gt;;; &lt;br /&gt;stop)   &lt;br /&gt;/bin/su tomcat $TOMCAT_HOME/shutdown.sh&lt;br /&gt;;; &lt;br /&gt;restart)&lt;br /&gt;/bin/su tomcat $TOMCAT_HOME/shutdown.sh&lt;br /&gt;/bin/su tomcat $TOMCAT_HOME/startup.sh&lt;br /&gt;;; &lt;br /&gt;esac    &lt;br /&gt;exit 0&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;b&gt;Step 6 (Optional): How to Run Tomcat on Port 80 as Non-Root User.&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;Note: the following applies when you are running Tomcat in "stand alone" mode with Tomcat running under the minimally privileged user Tomcat we created in the previous step. &lt;br /&gt;&lt;br /&gt;To run services below port 1024 as a user other than root, you can add the following to your IP tables:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@srv6 ~]# iptables -t nat -A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080  &lt;br /&gt;[root@srv6 ~]# iptables -t nat -A PREROUTING -p udp -m udp --dport 80 -j REDIRECT --to-ports 8080  &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Be sure to save and restart your iptables for the above change to take affect.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.enciva.com/tomcat-hosting.htm" target="_blank"&gt;&lt;img border="0" src="http://www.davidghedini.com/images/banners/EncivaTomcatHosting.png" alt="Tomcat 7 Hosting" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Related Posts: &lt;br /&gt;&lt;a href="http://davidghedini.blogspot.com/2010/12/tomcat-oracle-jdbc-connection-using.html"&gt;Tomcat Oracle JDBC Connection&lt;/a&gt;&lt;br /&gt;&lt;a href="http://davidghedini.blogspot.com/2010/07/tomcat-manager-password.html"&gt;Tomcat Manager Password&lt;/a&gt;&lt;br /&gt;&lt;a href="http://davidghedini.blogspot.com/2010/10/tomcat-custom-404-page.html"&gt;Tomcat Custom 404 Page&lt;/a&gt;&lt;br /&gt;&lt;a href="http://davidghedini.blogspot.com/2010/07/install-tomcat-6-on-centos.html"&gt;Install Tomcat 6 on CentOS&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Learn More About Apache Tomcat 7&lt;br /&gt;&lt;br /&gt;&lt;a href="http://tomcat.apache.org/" target="_blank"&gt;Apache Tomcat Foundation&lt;/a&gt;&lt;br /&gt;&lt;a href="http://tomcat.apache.org/tomcat-7.0-doc/index.html" target="_blank"&gt;Tomcat 7&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4739427765174521248-2903577252258790317?l=davidghedini.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://davidghedini.blogspot.com/feeds/2903577252258790317/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4739427765174521248&amp;postID=2903577252258790317&amp;isPopup=true' title='29 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/2903577252258790317'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/2903577252258790317'/><link rel='alternate' type='text/html' href='http://davidghedini.blogspot.com/2011/02/install-tomcat-7-on-centos-rhel.html' title='Install Tomcat 7 on CentOS / RHEL'/><author><name>David Ghedini</name><uri>http://www.blogger.com/profile/17216036360922714725</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='20' src='http://3.bp.blogspot.com/_9kl8kmes6FE/TRZtxgi0R0I/AAAAAAAAAGY/plAxLyonZ_U/S220/TheWholeGang.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_9kl8kmes6FE/TUcwA18AARI/AAAAAAAAAHE/aI_eoXu9JAs/s72-c/TomcatManager.jpg' height='72' width='72'/><thr:total>29</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4739427765174521248.post-5541868319701967341</id><published>2010-12-26T06:37:00.000-08:00</published><updated>2011-01-01T14:28:54.315-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JNDI'/><category scheme='http://www.blogger.com/atom/ns#' term='JDBC'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><category scheme='http://www.blogger.com/atom/ns#' term='Tomcat'/><title type='text'>Tomcat Oracle JDBC Connection using JNDI Resource</title><content type='html'>This post will cover connecting your Tomcat web application to Oracle via JDBC using Tomcat's JNDI emulation ability.&lt;br /&gt;&lt;br /&gt;We'll be creating this example using Tomcat 6.0.29 on CentOS 5.5&lt;br /&gt;&lt;br /&gt;In our example, we'll create a connection for an application in the Tomcat/webapps/ROOT directory. &lt;br /&gt;&lt;br /&gt;We'll also do the same for an application in a directory other than ROOT (e.g. Tomcat/webapps/myapp).&lt;br /&gt;&lt;br /&gt;In our examples below, I have installed Tomcat at /usr/share/apache-tomcat-6.0.29.&lt;br /&gt;&lt;br /&gt;Adjust this to your Tomcat installation as required.&lt;br /&gt;&lt;br /&gt;First, let's create a simple test table in Oracle.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;CREATE TABLE&amp;nbsp; DEMO_CUSTOMERS &lt;br /&gt;&amp;nbsp;&amp;nbsp; (&amp;nbsp;&amp;nbsp;&amp;nbsp; CUSTOMER_ID NUMBER, &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CUST_FIRST_NAME VARCHAR2(20), &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CUST_LAST_NAME VARCHAR2(20) &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp; )&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Now, let's populate it with some data.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;INSERT INTO DEMO_CUSTOMERS VALUES (1, 'John ', 'Dulles');&lt;br /&gt;INSERT INTO DEMO_CUSTOMERS VALUES (2, 'William ', 'Hartsfield');&lt;br /&gt;INSERT INTO DEMO_CUSTOMERS VALUES (3, 'Edward', 'Logan');&lt;br /&gt;INSERT INTO DEMO_CUSTOMERS VALUES (4, 'Edward "Butch"', 'OHAare');&lt;br /&gt;INSERT INTO DEMO_CUSTOMERS VALUES (5, 'Fiorello', 'Lambert');&lt;br /&gt;INSERT INTO DEMO_CUSTOMERS VALUES (6, 'Albert', 'Hartsfield');&lt;br /&gt;INSERT INTO DEMO_CUSTOMERS VALUES (7, 'Eugene', 'Bradley');&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;b&gt;1. Download the required drivers&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;You will need to download the required &lt;a href="http://www.oracle.com/technetwork/database/features/jdbc/index-091264.html" target="_blank"&gt;Oracle JDBC drivers from the OTN&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Both ojdbc6.jar and ojdbc14.jar will work for this example.&lt;br /&gt;&lt;br /&gt;Additionally, since I will be using JSP Standard Tag Library (or JSTL), I will also need to download standard.jar and jstl.jar, &lt;a href="http://jakarta.apache.org/site/downloads/downloads_taglibs.html" target="_blank"&gt;which you can download here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;b&gt;2. Move the drivers above to: /usr/share/apache-tomcat-6.0.29/lib&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 ~]# mv ojdbc14.jar /usr/share/apache-tomcat-6.0.29/lib/ojdbc14.jar&lt;br /&gt;[root@sv2 ~]# mv standard.jar /usr/share/apache-tomcat-6.0.29/lib/standard.jar&lt;br /&gt;[root@sv2 ~]# mv jstl.jar /usr/share/apache-tomcat-6.0.29/lib/jstl.jar&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;By placing the drivers in the TOMCAT_HOME/lib directory, we are making them available to all applications.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;b&gt;&lt;span style="color: #990000;"&gt;3. Create the JDBC JNDI resource for our default context&lt;/span&gt;&lt;/b&gt;&amp;nbsp;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;/div&gt;Since we are using the ROOT directory, we will be using /usr/share/apache-tomcat-6.0.29/conf/context.xml.&lt;br /&gt;&lt;br /&gt;Add the following:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&amp;lt;Resource name="jdbc/oradb"&lt;br /&gt;          auth="Container"&lt;br /&gt;          type="javax.sql.DataSource"&lt;br /&gt;          driverClassName="oracle.jdbc.OracleDriver"&lt;br /&gt;          url="jdbc:oracle:thin:@host:1521:sid"&lt;br /&gt;          username="username"&lt;br /&gt;          password="password"&lt;br /&gt;          maxActive="20"&lt;br /&gt;          maxIdle="30"&lt;br /&gt;          maxWait="-1"&lt;br /&gt;/&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Replace the url, username, and password above with your own. &lt;br /&gt;&lt;br /&gt;I've used 'oradb' as my resource name. You can use whatever you like.&lt;br /&gt;&lt;br /&gt;For an explanation of maxActive, maxIdle, and maxWait, and other attributes, please see the Context Configuration section of the &lt;a href="http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html" target="_blank"&gt;Tomcat JNDI Datasource HOW-TO&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;b&gt;4. Add a Resource-Ref to our web.xml file.&amp;nbsp;&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;Again, we are using the ROOT directory so we'll add our resource-ref to /usr/share/apache-tomcat-6.0.29/webapps/ROOT/WEB-INF/web.xml&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&lt;resource-ref&gt;&lt;br /&gt;&lt;res-ref-name&gt;jdbc/oradb&lt;/res-ref-name&gt;&lt;br /&gt;&lt;res-type&gt;javax.sql.DataSource&lt;/res-type&gt;&lt;br /&gt;&lt;res-auth&gt;Container&lt;/res-auth&gt;&lt;/resource-ref&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;b&gt;5. Create a JSP page to test our set up.&amp;nbsp;&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;I'll call the file mytest.jsp and place it into the ROOT directory (/usr/share/apache-tomcat-6.0.29/webapps/ROOT)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&amp;lt;%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %&amp;gt;&lt;br /&gt;&amp;lt;%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;html&amp;gt;&lt;br /&gt;  &amp;lt;head&amp;gt;&lt;br /&gt;&lt;br /&gt;    &lt;sql:query datasource="jdbc/oradb" var="democusts"&gt;&lt;br /&gt;       select * from DEMO_CUSTOMERS&lt;br /&gt;    &lt;/sql:query&gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;/head&amp;gt;&lt;br /&gt;  &amp;lt;body&amp;gt;&lt;br /&gt;    &amp;lt;h1&amp;gt;Testing JDBC JINDI Oracle&amp;lt;/h1&amp;gt;&lt;br /&gt;    &amp;lt;table width='500' border='1'&amp;gt;&lt;br /&gt;      &amp;lt;tr&amp;gt;&lt;br /&gt;        &amp;lt;th align='left'&amp;gt;Customer Id&amp;lt;/th&amp;gt;&lt;br /&gt;        &amp;lt;th align='left'&amp;gt;Customer First Name&amp;lt;/th&amp;gt;&lt;br /&gt;        &amp;lt;th align='left'&amp;gt;Customer Last Name&amp;lt;/th&amp;gt;&lt;br /&gt;      &amp;lt;/tr&amp;gt;&lt;br /&gt;      &amp;lt;c:forEach var="democusts" items="${democusts.rows}"&amp;gt;&lt;br /&gt;        &amp;lt;tr&amp;gt;&lt;br /&gt;           &amp;lt;td&amp;gt; ${democusts.CUSTOMER_ID}&amp;lt;/td&amp;gt;&lt;br /&gt;           &amp;lt;td&amp;gt; ${democusts.CUST_FIRST_NAME} &amp;lt;/td&amp;gt;&lt;br /&gt;           &amp;lt;td&amp;gt; ${democusts.CUST_LAST_NAME} &amp;lt;/td&amp;gt;&lt;br /&gt;       &amp;lt;/tr&amp;gt;&lt;br /&gt;      &amp;lt;/c:forEach&amp;gt;&lt;br /&gt;    &amp;lt;/table&amp;gt;&lt;br /&gt;  &amp;lt;/body&amp;gt;&lt;br /&gt;  &amp;lt;/html&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now start (or restart) Tomcat to allow it to read the changes to our configuration files&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 ~]# service tomcat start&lt;br /&gt;Using CATALINA_BASE:   /usr/share/apache-tomcat-6.0.29&lt;br /&gt;Using CATALINA_HOME:   /usr/share/apache-tomcat-6.0.29&lt;br /&gt;Using CATALINA_TMPDIR: /usr/share/apache-tomcat-6.0.29/temp&lt;br /&gt;Using JRE_HOME:        /usr/java/jdk1.6.0_23&lt;br /&gt;Using CLASSPATH:       /usr/share/apache-tomcat-6.0.29/bin/bootstrap.jar &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;We can now navigate to http://YourDomain.com:8080/mytest.jsp and we should see the following:&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_9kl8kmes6FE/TRc1cKkY54I/AAAAAAAAAG4/AgVR0wQyUQ0/s1600/JDBCTest.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="183" src="http://2.bp.blogspot.com/_9kl8kmes6FE/TRc1cKkY54I/AAAAAAAAAG4/AgVR0wQyUQ0/s320/JDBCTest.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;b&gt;6. Locations when using directory outside of ROOT.&amp;nbsp;&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;If you web application does not live in the ROOT directory, you can apply the above to using the following locations within your application.&lt;br /&gt;&lt;br /&gt;For an application called "MyApp", for example, you could use the following locations.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;JDBC JNDI Resource:&lt;/b&gt;  Webapps&gt;MyApp&gt;META-INF/context.xml&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Resource-Ref:&lt;/b&gt;        Webapps&gt;MyApp&gt;WEB-INF/web.xml&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Drivers:&lt;/b&gt;             Webapps&gt;MyApp&gt;WEB-INF/lib/{ojdbc14.jar, standard.jar, jstl.jar}&lt;br /&gt;&lt;br /&gt;If any of the directories or files above do not exist, you will need to create them.&lt;br /&gt;&lt;br /&gt;Again, you can leave the drivers under Tomcat/lib if you want them to be available to all applications.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;For more information, see &lt;a href="http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html" target="_blank"&gt;Apache Tomcat JNDI Datasource HOW-TO&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Related Posts: &lt;br /&gt;&lt;a href="http://davidghedini.blogspot.com/2010/07/install-tomcat-6-on-centos.html"&gt;Install Tomcat 6 on CentOS&lt;/a&gt;&lt;br /&gt;&lt;a href="http://davidghedini.blogspot.com/2010/07/tomcat-manager-password.html"&gt;Tomcat Manager Password&lt;/a&gt;&lt;br /&gt;&lt;a href="http://davidghedini.blogspot.com/2010/10/tomcat-custom-404-page.html"&gt;Tomcat Custom 404 Page&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4739427765174521248-5541868319701967341?l=davidghedini.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://davidghedini.blogspot.com/feeds/5541868319701967341/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4739427765174521248&amp;postID=5541868319701967341&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/5541868319701967341'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/5541868319701967341'/><link rel='alternate' type='text/html' href='http://davidghedini.blogspot.com/2010/12/tomcat-oracle-jdbc-connection-using.html' title='Tomcat Oracle JDBC Connection using JNDI Resource'/><author><name>David Ghedini</name><uri>http://www.blogger.com/profile/17216036360922714725</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='20' src='http://3.bp.blogspot.com/_9kl8kmes6FE/TRZtxgi0R0I/AAAAAAAAAGY/plAxLyonZ_U/S220/TheWholeGang.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_9kl8kmes6FE/TRc1cKkY54I/AAAAAAAAAG4/AgVR0wQyUQ0/s72-c/JDBCTest.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4739427765174521248.post-4506882974950005218</id><published>2010-12-23T16:46:00.000-08:00</published><updated>2011-03-18T06:38:30.131-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CentOS'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='Glassfish'/><title type='text'>Install GlassFish 3 on CentOS</title><content type='html'>This post will cover installing GlassFish 3.0.1 on CentOS 5.x.&lt;br /&gt;&lt;br /&gt;We'll also see how to run GlassFish as a service, how to access the Admin Console, and how to run GlassFish under a minimally privileged user.&lt;br /&gt;&lt;br /&gt;GlassFish 3.0.1 is available two editions.  &lt;br /&gt;&lt;br /&gt;GlassFish Server Open Source Edition 3.0.1 (free) and Oracle GlassFish Server 3.0.1 (supported and requires paid subscription). &lt;br /&gt;&lt;br /&gt;I installed both using the same process below on CentOS 5.5.&lt;br /&gt;&lt;br /&gt;This post is intended to get a basic installation of GlassFish 3.0.1 up and running. Please consult the documentation.&lt;br /&gt;&lt;br /&gt;If you do not already have the Java Development Kit (JDK) installed on your machine, you will need to download and install the required JDK for your platform.&lt;br /&gt;&lt;br /&gt;If you do have the JDK installed, you can skip to: Step 2: Download and Install the GlassFish 3.0.1 Server:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Step 1: Install the JDK&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;You can download the JDK here: &lt;a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html" target="_blank"&gt;http://www.oracle.com/technetwork/java/javase/downloads/index.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I'm using the latest, which is JDK 6, update 24. The JDK is specific to 32 and 64 bit versions. &lt;br /&gt;&lt;br /&gt;My CentOS box is 64 bit, so I'll need: jdk-6u24-linux-x64.bin.  &lt;br /&gt;&lt;br /&gt;If you are on 32 bit, you'll need: jdk-6u24-linux-i586.bin&lt;br /&gt;&lt;br /&gt;Download the appropriate JDK and save it to a directory. I'm saving it to /root.&lt;br /&gt;&lt;br /&gt;Move (mv) or copy (cp) the file to the /opt directory:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 ~]# mv jdk-6u24-linux-x64.bin /opt/jdk-6u24-linux-x64.bin&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Create the directory /usr/java.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 ~]# mkdir /usr/java&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Change to the /usr/java directory we created and install the JDK using 'sh /opt/jdk-6u24-linux-x64.bin'&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 ~]# cd /usr/java&lt;br /&gt;[root@sv2 java]# sh /opt/jdk-6u24-linux-x64.bin&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Set the JAVA_HOME path. This is where we installed the JDK above.&lt;br /&gt;&lt;br /&gt;To do this for your current session, you can issue the following:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 java]# JAVA_HOME=/usr/java/jdk1.6.0_24&lt;br /&gt;[root@sv2 java]# export JAVA_HOME&lt;br /&gt;[root@sv2 java]# PATH=$JAVA_HOME/bin:$PATH&lt;br /&gt;[root@sv2 java]# export PATH&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;To set the JAVA_HOME for users, we add this to the user ~/.bashrc or ~/.bash_profile of the user. We can also add it /etc/profile and then source it to give to all users.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;JAVA_HOME=/usr/java/jdk1.6.0_24 &lt;br /&gt;export JAVA_HOME &lt;br /&gt;PATH=$JAVA_HOME/bin:$PATH &lt;br /&gt;export PATH&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Once you have added the above to ~/.bash_profile or ~/.bashrc, you should log out, then log back in and check that the JAVA_HOME is set correctly.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 ~]#  echo $JAVA_HOME&lt;br /&gt;/usr/java/jdk1.6.0_24&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Step 2: Download and Install the GlassFish 3.0.1 Server:&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;You can download both the GlassFish Server Open Source Edition 3.0.1 and Oracle GlassFish Server 3.0.1 at &lt;a href="http://glassfish.java.net/" target="_blank"&gt;http://glassfish.java.net/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Once you have downloaded the desired file, move (mv) or copy (cp) the file to /usr/share/glassfish-3.0.1.zip (or /usr/share/ogs-3.0.1.zip for Oracle GlassFish).&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 ~]# mv glassfish-3.0.1.zip /usr/share/glassfish-3.0.1.zip&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Change to the /usr/share directory and unzip the file:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 ~]# cd /usr/share&lt;br /&gt;[root@sv2 share]# unzip -q glassfish-3.0.1.zip&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The unzip will create the following directory:  /usr/share/glassfishv3&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Note: Both GlassFish editions will create the same directory when unzipped: glassfishv3&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;At this point, we should be able to start and stop GlassFish using:&lt;br /&gt;&lt;br /&gt;/usr/share/glassfishv3/glassfish/bin/asadmin start-domain domain1&lt;br /&gt;&lt;br /&gt;and&lt;br /&gt;&lt;br /&gt;/usr/share/glassfishv3/glassfish/bin/asadmin stop-domain domain1&lt;br /&gt;&lt;br /&gt;Start GlassFish:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 share]# /usr/share/glassfishv3/glassfish/bin/asadmin start-domain domain1&lt;br /&gt;Waiting for DAS to start ...&lt;br /&gt;Started domain: domain1&lt;br /&gt;Domain location: /usr/share/glassfishv3/glassfish/domains/domain1&lt;br /&gt;Log file: /usr/share/glassfishv3/glassfish/domains/domain1/logs/server.log&lt;br /&gt;Admin port for the domain: 4848&lt;br /&gt;Command start-domain executed successfully.&lt;br /&gt;[root@sv2 share]#&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Stop GlassFish:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 share]# /usr/share/glassfishv3/glassfish/bin/asadmin stop-domain domain1&lt;br /&gt;Waiting for the domain to stop ....&lt;br /&gt;Command stop-domain executed successfully.&lt;br /&gt;[root@sv2 share]#&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Note: If you did not set the JAVA_HOME and PATH for the user you are logged in as, or for your current session, when you attempt to start the GlassFish server it will complain it cannot find Java with the following:&lt;br /&gt;&lt;br /&gt;error: /usr/share/glassfishv3/glassfish/bin/asadmin: line 19: exec: java: not found&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Step 3: Running GlassFish as a Service&lt;/b&gt;.&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;To run GlassFish as a service and enable start up at boot, we'll now create a Start/Stop/Restart script.&lt;br /&gt;&lt;br /&gt;We'll create the script as /etc/init.d/glassfish, make the script executable, and then add our new glassfish service to chkconfig.&lt;br /&gt;&lt;br /&gt;Create our glassfish script:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 ~]# cd /etc/init.d&lt;br /&gt;[root@sv2 init.d]# vi glassfish&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;#!/bin/bash&lt;br /&gt;# description: Glassfish Start Stop Restart&lt;br /&gt;# processname: glassfish&lt;br /&gt;# chkconfig: 234 20 80&lt;br /&gt;JAVA_HOME=/usr/java/jdk1.6.0_24&lt;br /&gt;export JAVA_HOME&lt;br /&gt;PATH=$JAVA_HOME/bin:$PATH&lt;br /&gt;export PATH&lt;br /&gt;GLASSFISH_HOME=/usr/share/glassfishv3/glassfish&lt;br /&gt;&lt;br /&gt;case $1 in&lt;br /&gt;start)&lt;br /&gt;sh $GLASSFISH_HOME/bin/asadmin start-domain domain1&lt;br /&gt;;;&lt;br /&gt;stop)&lt;br /&gt;sh $GLASSFISH_HOME/bin/asadmin stop-domain domain1&lt;br /&gt;;;&lt;br /&gt;restart)&lt;br /&gt;sh $GLASSFISH_HOME/bin/asadmin stop-domain domain1&lt;br /&gt;sh $GLASSFISH_HOME/bin/asadmin start-domain domain1&lt;br /&gt;;;&lt;br /&gt;esac&lt;br /&gt;exit 0&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;If you do not set the JAVA_HOME and PATH in the GlassFish script, when you attempt to start the GlassFish server it will complain it cannot find Java with the following:&lt;br /&gt;&lt;br /&gt;error: /usr/share/glassfishv3/glassfish/bin/asadmin: line 19: exec: java: not found&lt;br /&gt;&lt;br /&gt;Now, make the script executable and add it to our chkconfig so it starts at boot.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 init.d]# chmod 755 glassfish&lt;br /&gt;[root@sv2 init.d]# chkconfig --add glassfish&lt;br /&gt;[root@sv2 init.d]# chkconfig --level 234 glassfish on&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;We should now be able to Start, Stop, and Restart GlassFish as a service.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Start GlassFish:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 init.d]# service glassfish start&lt;br /&gt;Waiting for DAS to start .....&lt;br /&gt;Started domain: domain1&lt;br /&gt;Domain location: /usr/share/glassfishv3/glassfish/domains/domain1&lt;br /&gt;Log file: /usr/share/glassfishv3/glassfish/domains/domain1/logs/server.log&lt;br /&gt;Admin port for the domain: 4848&lt;br /&gt;Command start-domain executed successfully.&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;b&gt;Stop GlassFish:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 init.d]# service glassfish stop&lt;br /&gt;Waiting for the domain to stop ....&lt;br /&gt;Command stop-domain executed successfully.&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Step 4: Access GlassFish Admin Console&lt;/b&gt;.&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;You should now be able to access the GlassFish Admin Console at:&lt;br /&gt;&lt;br /&gt;http://yourdomain.com:4848 or http://yourip:4848&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_9kl8kmes6FE/TROqKs6WCYI/AAAAAAAAAE8/ZOsmcjcIPNo/s1600/AdminConsole.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="248" src="http://2.bp.blogspot.com/_9kl8kmes6FE/TROqKs6WCYI/AAAAAAAAAE8/ZOsmcjcIPNo/s320/AdminConsole.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;On accessing the GlassFish Admin Console for the first time, you will find that no user name or password is required.&lt;br /&gt;&lt;br /&gt;Previous to 3.0.1, a default password 'adminadmin' was used.&lt;br /&gt;&lt;br /&gt;You can set (or change) the admin password within the GlassFish Admin console.&lt;br /&gt;&lt;br /&gt;1. Click "Enterprise Server" on the tree. &lt;br /&gt;&lt;br /&gt;2. Click the Administrator Password tab.&lt;br /&gt;&lt;br /&gt;3. Enter and confirm your password and click Save.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_9kl8kmes6FE/TROqj7ZroGI/AAAAAAAAAFE/9QzbcP0_d7s/s1600/AdminPassword.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="214" src="http://4.bp.blogspot.com/_9kl8kmes6FE/TROqj7ZroGI/AAAAAAAAAFE/9QzbcP0_d7s/s320/AdminPassword.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;The first password save will create a file,.asadminpass, in the home directory of the user you are running the service under.&lt;br /&gt;&lt;br /&gt;Alternatively, you can set the admin password via the CLI using.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 bin]# $GLASSFISH_HOME/bin/asadmin change-admin-password&lt;br /&gt;Enter admin user name [default: admin]&amp;gt;&lt;br /&gt;Enter admin password&amp;gt;&lt;br /&gt;Enter new admin password&amp;gt;&lt;br /&gt;Enter new admin password again&amp;gt;&lt;br /&gt;&lt;br /&gt;Command change-admin-password executed successfully.&lt;br /&gt;[root@sv2 bin]#&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Note: to make using the CLI easier, I've added the following lines to my ~/.bashrc (or ~/.bash_profile):&lt;br /&gt;&lt;br /&gt;GLASSFISH_HOME=/usr/share/glassfishv3/glassfish&lt;br /&gt;export GLASSFISH_HOME&lt;br /&gt;&lt;br /&gt;So your ~/.bashrc or ~/.bash_profile will look like this:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;JAVA_HOME=/usr/java/jdk1.6.0_24&lt;br /&gt;export JAVA_HOME&lt;br /&gt;PATH=$JAVA_HOME/bin:$PATH&lt;br /&gt;export PATH&lt;br /&gt;GLASSFISH_HOME=/usr/share/glassfishv3/glassfish&lt;br /&gt;export GLASSFISH_HOME&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;As you can see above, I can now use $GLASSFISH_HOME rather than the full path of /usr/share/glassfishv3/glassfish.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Step 5: Running GlassFish with Minimally Privileged (non-root) User&lt;/b&gt;.&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Since I am installing this on my development machine, I am running GlassFish as root above. &lt;br /&gt;&lt;br /&gt;In production, you will want to run GlassFish as a non-root user with minimal privileges.&lt;br /&gt;&lt;br /&gt;To do this, we can need to the following.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;1. Create the user, glassfish, who will own the files.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Create the new group, glassfish, and add the user glassfish to the group:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 ~]# groupadd glassfish&lt;br /&gt;[root@sv2 ~]# useradd -s /bin/bash -g glassfish glassfish&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;2. Change ownership of the GlassFish files to the user glassfish we created.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;We'll change ownership of the files under /usr/share/glassfishv3 from root to the user glassfish we created above:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 ~]# chown -Rf glassfish.glassfish /usr/share/glassfishv3/&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;3. Update our glassfish script.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Finally, we update the glassfish start/stop/restart script we created above so we su to user glassfish:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;#!bin/bash&lt;br /&gt;# description: Glassfish Start Stop Restart&lt;br /&gt;# processname: glassfish&lt;br /&gt;# chkconfig: 234 20 80&lt;br /&gt;JAVA_HOME=/usr/java/jdk1.6.0_24&lt;br /&gt;export JAVA_HOME&lt;br /&gt;PATH=$JAVA_HOME/bin:$PATH&lt;br /&gt;export PATH&lt;br /&gt;GLASSFISH_HOME=/usr/share/glassfishv3/glassfish&lt;br /&gt;GLASSFISH_USER=glassfish&lt;br /&gt;&lt;br /&gt;case $1 in&lt;br /&gt;start)&lt;br /&gt;su $GLASSFISH_USER -c "$GLASSFISH_HOME/bin/asadmin start-domain domain1"&lt;br /&gt;;;&lt;br /&gt;stop)&lt;br /&gt;su $GLASSFISH_USER -c "$GLASSFISH_HOME/bin/asadmin stop-domain domain1"&lt;br /&gt;;;&lt;br /&gt;restart)&lt;br /&gt;su $GLASSFISH_USER -c "$GLASSFISH_HOME/bin/asadmin stop-domain domain1"&lt;br /&gt;su $GLASSFISH_USER -c "$GLASSFISH_HOME/bin/asadmin start-domain domain1"&lt;br /&gt;;;&lt;br /&gt;esac&lt;br /&gt;exit 0&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Step 6: Running GlassFish on Port 80 as Non-Root User&lt;/b&gt;.&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;To run services below port 1024 as user other than root, you will need to use port forwarding.&lt;br /&gt;&lt;br /&gt;You can do this by adding the following to your IP tables:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@sv2 ~]# iptables -t nat -A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080&lt;br /&gt;[root@sv2 ~]# iptables -t nat -A PREROUTING -p udp -m udp --dport 80 -j REDIRECT --to-ports 8080&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Note: GlassFish 3.1 has now been released.&lt;/b&gt; &lt;i&gt;For GlassFish 3.1 installation, you can view my tutorial here: &lt;/i&gt; &lt;br /&gt;&lt;a href="http://www.davidghedini.com/pg/entry/install_glassfish_3_1_on" target="blank"&gt;http://www.davidghedini.com/pg/entry/install_glassfish_3_1_on&lt;/a&gt;&lt;br /&gt;It is basically the same procedure as GlassFish 3.0.1, with some minor changes.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://docs.sun.com/app/docs/doc/821-1757/aboaa?a=view" target="_blank"&gt;GlassFish Quick Start Guide&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://glassfish.java.net/" target="_blank"&gt;http://glassfish.java.net/ &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://docs.sun.com/app/docs/coll/1343.13" target="_blank"&gt;Oracle GlassFish Docs&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4739427765174521248-4506882974950005218?l=davidghedini.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://davidghedini.blogspot.com/feeds/4506882974950005218/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4739427765174521248&amp;postID=4506882974950005218&amp;isPopup=true' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/4506882974950005218'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/4506882974950005218'/><link rel='alternate' type='text/html' href='http://davidghedini.blogspot.com/2010/12/install-glassfish-3-on-centos.html' title='Install GlassFish 3 on CentOS'/><author><name>David Ghedini</name><uri>http://www.blogger.com/profile/17216036360922714725</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='20' src='http://3.bp.blogspot.com/_9kl8kmes6FE/TRZtxgi0R0I/AAAAAAAAAGY/plAxLyonZ_U/S220/TheWholeGang.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_9kl8kmes6FE/TROqKs6WCYI/AAAAAAAAAE8/ZOsmcjcIPNo/s72-c/AdminConsole.jpg' height='72' width='72'/><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4739427765174521248.post-4552568574203336890</id><published>2010-10-30T16:29:00.000-07:00</published><updated>2011-03-21T05:37:32.196-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='404 page'/><category scheme='http://www.blogger.com/atom/ns#' term='Tomcat'/><title type='text'>Tomcat Custom 404 Page</title><content type='html'>This post will cover creating a custom 404 Error page for Tomcat.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;By default, if a requested page does not exist, a 404 Error is raised and the user is served Tomcat's default 404 error page as below:&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://3.bp.blogspot.com/_9kl8kmes6FE/TLRfcugKWmI/AAAAAAAAAEc/j1_FHsxyXhA/s1600/404.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="156" src="http://3.bp.blogspot.com/_9kl8kmes6FE/TLRfcugKWmI/AAAAAAAAAEc/j1_FHsxyXhA/s320/404.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Above, I requested a page called 'david' which does not exist.&lt;br /&gt;&lt;br /&gt;To make your 404 page a bit more presentable, provide the user with a link back into your site, as well as hide the Tomcat version in use, you can easily add a custom 404 error page.&lt;br /&gt;&lt;br /&gt;Start by creating the page you wish to use. In my case, I am creating a page called 'NotFound.jsp'&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Add the 404 page you crated to your site directory.&lt;br /&gt;&lt;br /&gt;Now, in your $CATALINA_HOME/conf directory, edit your web.xml file.&lt;br /&gt;&lt;br /&gt;Add the following &lt;error-page&gt; entry &lt;/error-page&gt;just beneath the welcome-file-list entry as shown below:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&amp;lt;welcome-file-list&amp;gt;&lt;br /&gt;        &amp;lt;welcome-file&gt;index.html&amp;lt;/welcome-file&amp;gt;&lt;br /&gt;        &amp;lt;welcome-file&gt;index.htm&amp;lt;/welcome-file&amp;gt;&lt;br /&gt;        &amp;lt;welcome-file&gt;index.jsp&amp;lt;/welcome-file&amp;gt;&lt;br /&gt;    &amp;lt;/welcome-file-list&amp;gt;&lt;br /&gt;&lt;br /&gt;   &amp;lt;error-page&amp;gt;&lt;br /&gt;       &amp;lt;error-code&gt;404&amp;lt;/error-code&gt;&lt;br /&gt;         &amp;lt;location&amp;gt;/NotFound.jsp&amp;lt;/location&amp;gt;&lt;br /&gt;   &amp;lt;/error-page&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now, when someone goes to a page that does not exist, they get the custom 404 page we created.&lt;br /&gt;&lt;br /&gt;for example: &lt;a href="http://www.davidghedini.com/YadaYadaYada.jsp" target="_blank"&gt;http://www.davidghedini.com/YadaYadaYada.jsp&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;i&gt;SEO Disclaimer: I've called my page NotFound.jsp page and have added a meta-tag:&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;meta content="noindex" name="robots"&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;i&gt;I did this as it (supposedly), the tag will stop search engined from indexing my 404 page.&amp;nbsp; I'm not an SEO guy so whether this is necessary&amp;nbsp; (or even a good idea), I don't know.&amp;nbsp; You could, of course, place your 404 page within a sub directory (e.g. '404') and adjust the location in your web.xml from /404/NotFound.jsp to /NotFound.jsp. You could then add a robots.txt file to prevent crawling of the directory.&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Related Posts: &lt;br /&gt;&lt;a href="http://davidghedini.blogspot.com/2010/07/install-tomcat-6-on-centos.html"&gt;Install Tomcat 6 on CentOS&lt;/a&gt;&lt;br /&gt;&lt;a href="http://davidghedini.blogspot.com/2010/12/tomcat-oracle-jdbc-connection-using.html"&gt;Tomcat Oracle JDBC Connection&lt;/a&gt;&lt;br /&gt;&lt;a href="http://davidghedini.blogspot.com/2010/07/tomcat-manager-password.html"&gt;Tomcat Manager Password&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;script language="JavaScript"&gt;var pStart = '&lt;a href="http://porter.davidghedini.com/birt/frameset?__report=GhediniBlogSpot.rptdesign&amp;getTitle=';var pTitle = $('.post-title').html();var pStop = '&amp;__format=pdf&amp;__pageoverflow=0&amp;__asattachment=true&amp;__overwrite=false"title="Export Post to PDF"&gt;&lt;img src="http://www.davidghedini.com/images/pdf.jpg" border="none"&gt;&lt;/a&gt; 'var pSpace = ' | ';document.write(pStart+pTitle+pStop);&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;script language="JavaScript"&gt;var pStart = '&lt;a href="http://porter.davidghedini.com/birt/frameset?__report=GhediniBlogSpot.rptdesign&amp;getTitle=';var pTitle = $('.post-title').html();var pStop = '&amp;__format=doc&amp;__pageoverflow=0&amp;__asattachment=true&amp;__overwrite=false"title="Export Post to PDF"&gt;&lt;img src="http://www.davidghedini.com/images/word.gif" border="none"&gt;&lt;/a&gt; 'var pSpace = ' | ';document.write(pStart+pTitle+pStop);&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4739427765174521248-4552568574203336890?l=davidghedini.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://davidghedini.blogspot.com/feeds/4552568574203336890/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4739427765174521248&amp;postID=4552568574203336890&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/4552568574203336890'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/4552568574203336890'/><link rel='alternate' type='text/html' href='http://davidghedini.blogspot.com/2010/10/tomcat-custom-404-page.html' title='Tomcat Custom 404 Page'/><author><name>David Ghedini</name><uri>http://www.blogger.com/profile/17216036360922714725</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='20' src='http://3.bp.blogspot.com/_9kl8kmes6FE/TRZtxgi0R0I/AAAAAAAAAGY/plAxLyonZ_U/S220/TheWholeGang.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_9kl8kmes6FE/TLRfcugKWmI/AAAAAAAAAEc/j1_FHsxyXhA/s72-c/404.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4739427765174521248.post-4229730495892211213</id><published>2010-10-30T13:58:00.000-07:00</published><updated>2011-12-25T05:45:58.854-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CentOS'/><category scheme='http://www.blogger.com/atom/ns#' term='PostgreSQL 9'/><category scheme='http://www.blogger.com/atom/ns#' term='Postgre'/><category scheme='http://www.blogger.com/atom/ns#' term='Webmin'/><title type='text'>Install PostgreSQL 9 on CentOS</title><content type='html'>&lt;pre&gt;&lt;/pre&gt;&lt;pre&gt;This post will cover installing PostgreSQL 9 on CentOS.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;b&gt;PLEASE NOTE: I have created an updated and expanded installation guide covering PostgreSQL 9.1 here:&lt;/b&gt;&lt;/div&gt;&lt;/pre&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a href="http://www.davidghedini.com/pg/entry/install_postgresql_9_on_centos" target="_blank"&gt;http://www.davidghedini.com/pg/entry/install_postgresql_9_on_centos&lt;/a&gt;   &lt;/div&gt;&lt;pre&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;b&gt;PLEASE USE THE ABOVE GUIDE.&lt;/b&gt;&lt;/div&gt;PostgreSQL 9 is the first major release from PostgreSQL in some time and the directory structure has changed. &lt;br /&gt;&lt;br /&gt;If you are using Webmin, we will also show how to configure Webmin to manage PostgreSQL 9.&lt;br /&gt;&lt;br /&gt;PLEASE NOTE: If you are looking to install PostgreSQL 9 on cPanel, please see my step-by-step guide here: &lt;br /&gt;&lt;a href="http://www.davidghedini.com/pg/entry/installing_postgresql_9_on_cpanel" target="_blank"&gt;http://www.davidghedini.com/pg/entry/installing_postgresql_9_on_cpanel&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;We'll use the simplest method to install, which is the postrgres repo rpms. &lt;/pre&gt;&lt;pre&gt;Begin by locating the appropriate one here:&lt;br /&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;a href="http://yum.pgrpms.org/reporpms/repoview/pgdg-centos.html" target="-blank"&gt;http://yum.pgrpms.org/reporpms/repoview/pgdg-centos.html&lt;/a&gt; &lt;/pre&gt;&lt;pre&gt;There is a 9.1.1 Alpha version available, but I am going to install 9.0.2&lt;br /&gt;&lt;br /&gt;For CentOS I will need:&lt;br /&gt;&lt;br /&gt;http://yum.pgrpms.org/reporpms/9.0/pgdg-centos-9.0-2.noarch.rpm&lt;br /&gt;&lt;br /&gt;So, using wget: &lt;/pre&gt;&lt;pre&gt;&lt;i&gt;wget http://yum.pgrpms.org/reporpms/9.0/pgdg-centos-9.0-2.noarch.rpm&lt;/i&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/pre&gt;&lt;pre&gt;&lt;pre class="js" name="code"&gt;[root@server1 ~]# wget http://yum.pgrpms.org/reporpms/9.0/pgdg-centos-9.0-2.noarch.rpm&lt;br /&gt;--2010-10-29 15:38:15--  http://yum.pgrpms.org/reporpms/9.0/pgdg-centos-9.0-2.noarch.rpm&lt;br /&gt;Resolving yum.pgrpms.org... 77.79.103.58&lt;br /&gt;Connecting to yum.pgrpms.org|77.79.103.58|:80... connected.&lt;br /&gt;HTTP request sent, awaiting response... 200 OK&lt;br /&gt;Length: 4623 (4.5K) [application/x-rpm]&lt;br /&gt;Saving to: `pgdg-centos-9.0-2.noarch.rpm'&lt;br /&gt;&lt;br /&gt;100%[======================================&amp;gt;] 4,623       --.-K/s   in 0s&lt;br /&gt;&lt;br /&gt;2010-10-29 15:38:15 (259 MB/s) - `pgdg-centos-9.0-2.noarch.rpm' saved [4623/4623]&lt;/pre&gt;Now install the repo....&lt;pre class="js" name="code"&gt;[root@server1 ~]# rpm -i pgdg-centos-9.0-2.noarch.rpm&lt;/pre&gt;We now need to edit the CentOS-Base.repo to exclude postgre.To do, so we simply edit CentOS-Base.repo and add 'exclude=postgresql*'  to the [base] and [updates] sections:&lt;pre class="js" name="code"&gt;[root@server1 ~]# cd /etc/yum.repos.d&lt;br /&gt;[root@server1 yum.repos.d]# vi CentOS-Base.repo&lt;/pre&gt;&lt;/pre&gt;&lt;pre&gt;&lt;pre class="js" name="code"&gt;[base]&lt;br /&gt;name=CentOS-$releasever - Base&lt;br /&gt;mirrorlist=http://mirrorlist.centos.org/?release=$releasever&amp;amp;arch=$basearch&amp;amp;repo=os&lt;br /&gt;#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/&lt;br /&gt;gpgcheck=1&lt;br /&gt;gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5&lt;br /&gt;exclude=postgresql*&lt;br /&gt;&lt;br /&gt;#released updates&lt;br /&gt;[updates]&lt;br /&gt;name=CentOS-$releasever - Updates&lt;br /&gt;mirrorlist=http://mirrorlist.centos.org/?release=$releasever&amp;amp;arch=$basearch&amp;amp;repo=updates&lt;br /&gt;#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/&lt;br /&gt;gpgcheck=1&lt;br /&gt;gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5&lt;br /&gt;exclude=postgresql* &lt;/pre&gt;Now, let's use 'yum list' to check the packages that are now available.&lt;pre class="js" name="code"&gt;[root@server1 yum.repos.d]# yum list postgres*&lt;br /&gt;Loaded plugins: fastestmirror&lt;br /&gt;Loading mirror speeds from cached hostfile&lt;br /&gt; * addons: mirrors.seas.harvard.edu&lt;br /&gt; * base: centos.mirror.choopa.net&lt;br /&gt; * extras: centos.mirror.nac.net&lt;br /&gt; * updates: mirror.net.cen.ct.gov&lt;br /&gt;pgdg90                                                   | 2.8 kB     00:00&lt;br /&gt;pgdg90/primary_db                                        |  57 kB     00:00&lt;br /&gt;Excluding Packages from CentOS-5 - Base&lt;br /&gt;Finished&lt;br /&gt;Excluding Packages from CentOS-5 - Updates&lt;br /&gt;Finished&lt;br /&gt;Installed Packages&lt;br /&gt;postgresql-libs.x86_64                    8.1.18-2.el5_4.1             installed&lt;br /&gt;Available Packages&lt;br /&gt;postgresql-jdbc90.x86_64                  9.0.801-1PGDG.rhel5          pgdg90&lt;br /&gt;postgresql-jdbc90-debuginfo.x86_64        9.0.801-1PGDG.rhel5          pgdg90&lt;br /&gt;postgresql90.x86_64                       9.0.4-1PGDG.rhel5            pgdg90&lt;br /&gt;postgresql90-contrib.x86_64               9.0.4-1PGDG.rhel5            pgdg90&lt;br /&gt;postgresql90-debuginfo.x86_64             9.0.4-1PGDG.rhel5            pgdg90&lt;br /&gt;postgresql90-devel.x86_64                 9.0.4-1PGDG.rhel5            pgdg90&lt;br /&gt;postgresql90-docs.x86_64                  9.0.4-1PGDG.rhel5            pgdg90&lt;br /&gt;postgresql90-jdbc.x86_64                  9.0.801-1PGDG.rhel5          pgdg90&lt;br /&gt;postgresql90-jdbc-debuginfo.x86_64        9.0.801-1PGDG.rhel5          pgdg90&lt;br /&gt;postgresql90-libs.i386                    9.0.4-1PGDG.rhel5            pgdg90&lt;br /&gt;postgresql90-libs.x86_64                  9.0.4-1PGDG.rhel5            pgdg90&lt;br /&gt;postgresql90-odbc.x86_64                  09.00.0200-1PGDG.rhel5       pgdg90&lt;br /&gt;postgresql90-odbc-debuginfo.x86_64        09.00.0200-1PGDG.rhel5       pgdg90&lt;br /&gt;postgresql90-plperl.x86_64                9.0.4-1PGDG.rhel5            pgdg90&lt;br /&gt;postgresql90-plpython.x86_64              9.0.4-1PGDG.rhel5            pgdg90&lt;br /&gt;postgresql90-pltcl.x86_64                 9.0.4-1PGDG.rhel5            pgdg90&lt;br /&gt;postgresql90-python.x86_64                4.0-2PGDG.rhel5              pgdg90&lt;br /&gt;postgresql90-python-debuginfo.x86_64      4.0-2PGDG.rhel5              pgdg90&lt;br /&gt;postgresql90-server.x86_64                9.0.4-1PGDG.rhel5            pgdg90&lt;br /&gt;postgresql90-test.x86_64                  9.0.4-1PGDG.rhel5            pgdg90&lt;br /&gt;postgresql_autodoc.noarch                 1.40-1.rhel5                 pgdg90&lt;br /&gt;[root@server1 yum.repos.d]#&lt;br /&gt;&lt;/pre&gt;We can now install PostgreSQL 9 using yum:&lt;i&gt;yum install postgresql90 postgresql90-devel postgresql90-server postgresql90-libs&lt;/i&gt;&lt;pre class="js" name="code"&gt;[root@server1 ~]# yum install postgresql90 postgresql90-devel postgresql90-server postgresql90-libs&lt;br /&gt;Loaded plugins: fastestmirror&lt;br /&gt;Loading mirror speeds from cached hostfile&lt;br /&gt; * addons: mirrors.seas.harvard.edu&lt;br /&gt; * base: centos.mirror.choopa.net&lt;br /&gt; * extras: centos.mirror.nac.net&lt;br /&gt; * updates: mirror.net.cen.ct.gov&lt;br /&gt;Excluding Packages from CentOS-5 - Base&lt;br /&gt;Finished&lt;br /&gt;Excluding Packages from CentOS-5 - Updates&lt;br /&gt;Finished&lt;br /&gt;Setting up Install Process&lt;br /&gt;Resolving Dependencies&lt;br /&gt;--&amp;gt; Running transaction check&lt;br /&gt;---&amp;gt; Package postgresql90.x86_64 0:9.0.4-1PGDG.rhel5 set to be updated&lt;br /&gt;--&amp;gt; Processing Dependency: libxslt.so.1()(64bit) for package: postgresql90&lt;br /&gt;---&amp;gt; Package postgresql90-devel.x86_64 0:9.0.4-1PGDG.rhel5 set to be updated&lt;br /&gt;---&amp;gt; Package postgresql90-libs.i386 0:9.0.4-1PGDG.rhel5 set to be updated&lt;br /&gt;--&amp;gt; Processing Dependency: libldap_r-2.3.so.0 for package: postgresql90-libs&lt;br /&gt;---&amp;gt; Package postgresql90-libs.x86_64 0:9.0.4-1PGDG.rhel5 set to be updated&lt;br /&gt;---&amp;gt; Package postgresql90-server.x86_64 0:9.0.4-1PGDG.rhel5 set to be updated&lt;br /&gt;--&amp;gt; Running transaction check&lt;br /&gt;---&amp;gt; Package libxslt.x86_64 0:1.1.17-2.el5_2.2 set to be updated&lt;br /&gt;---&amp;gt; Package openldap.i386 0:2.3.43-12.el5_6.7 set to be updated&lt;br /&gt;--&amp;gt; Processing Dependency: libsasl2.so.2 for package: openldap&lt;br /&gt;---&amp;gt; Package openldap.x86_64 0:2.3.43-12.el5_6.7 set to be updated&lt;br /&gt;--&amp;gt; Running transaction check&lt;br /&gt;---&amp;gt; Package cyrus-sasl-lib.i386 0:2.1.22-5.el5_4.3 set to be updated&lt;br /&gt;--&amp;gt; Finished Dependency Resolution&lt;br /&gt;&lt;br /&gt;Dependencies Resolved&lt;br /&gt;&lt;br /&gt;================================================================================&lt;br /&gt; Package                  Arch        Version                Repository    Size&lt;br /&gt;================================================================================&lt;br /&gt;Installing:&lt;br /&gt; postgresql90             x86_64      9.0.4-1PGDG.rhel5      pgdg90       1.4 M&lt;br /&gt; postgresql90-devel       x86_64      9.0.4-1PGDG.rhel5      pgdg90       1.6 M&lt;br /&gt; postgresql90-libs        i386        9.0.4-1PGDG.rhel5      pgdg90       220 k&lt;br /&gt; postgresql90-libs        x86_64      9.0.4-1PGDG.rhel5      pgdg90       218 k&lt;br /&gt; postgresql90-server      x86_64      9.0.4-1PGDG.rhel5      pgdg90       4.8 M&lt;br /&gt;Installing for dependencies:&lt;br /&gt; cyrus-sasl-lib           i386        2.1.22-5.el5_4.3       base         127 k&lt;br /&gt; libxslt                  x86_64      1.1.17-2.el5_2.2       base         488 k&lt;br /&gt; openldap                 i386        2.3.43-12.el5_6.7      updates      296 k&lt;br /&gt;Updating for dependencies:&lt;br /&gt; openldap                 x86_64      2.3.43-12.el5_6.7      updates      304 k&lt;br /&gt;&lt;br /&gt;Transaction Summary&lt;br /&gt;================================================================================&lt;br /&gt;Install      8 Package(s)&lt;br /&gt;Update       1 Package(s)&lt;br /&gt;Remove       0 Package(s)&lt;br /&gt;&lt;br /&gt;Total download size: 9.4 M&lt;br /&gt;Is this ok [y/N]: y&lt;br /&gt;Downloading Packages:&lt;br /&gt;(1/9): cyrus-sasl-lib-2.1.22-5.el5_4.3.i386.rpm          | 127 kB     00:00&lt;br /&gt;(2/9): postgresql90-libs-9.0.4-1PGDG.rhel5.x86_64.rpm    | 218 kB     00:00&lt;br /&gt;(3/9): postgresql90-libs-9.0.4-1PGDG.rhel5.i386.rpm      | 220 kB     00:00&lt;br /&gt;(4/9): openldap-2.3.43-12.el5_6.7.i386.rpm               | 296 kB     00:00&lt;br /&gt;(5/9): openldap-2.3.43-12.el5_6.7.x86_64.rpm             | 304 kB     00:00&lt;br /&gt;(6/9): libxslt-1.1.17-2.el5_2.2.x86_64.rpm               | 488 kB     00:00&lt;br /&gt;(7/9): postgresql90-9.0.4-1PGDG.rhel5.x86_64.rpm         | 1.4 MB     00:01&lt;br /&gt;(8/9): postgresql90-devel-9.0.4-1PGDG.rhel5.x86_64.rpm   | 1.6 MB     00:01&lt;br /&gt;(9/9): postgresql90-server-9.0.4-1PGDG.rhel5.x86_64.rpm  | 4.8 MB     00:03&lt;br /&gt;--------------------------------------------------------------------------------&lt;br /&gt;Total                                           978 kB/s | 9.4 MB     00:09&lt;br /&gt;Running rpm_check_debug&lt;br /&gt;Running Transaction Test&lt;br /&gt;Finished Transaction Test&lt;br /&gt;Transaction Test Succeeded&lt;br /&gt;Running Transaction&lt;br /&gt;  Updating       : openldap                                                1/10&lt;br /&gt;  Installing     : postgresql90-libs                                       2/10&lt;br /&gt;  Installing     : libxslt                                                 3/10&lt;br /&gt;  Installing     : postgresql90                                            4/10&lt;br /&gt;  Installing     : cyrus-sasl-lib                                          5/10&lt;br /&gt;  Installing     : postgresql90-server                                     6/10&lt;br /&gt;  Installing     : postgresql90-devel                                      7/10&lt;br /&gt;  Installing     : openldap                                                8/10&lt;br /&gt;  Installing     : postgresql90-libs                                       9/10&lt;br /&gt;  Cleanup        : openldap                                               10/10&lt;br /&gt;&lt;br /&gt;Installed:&lt;br /&gt;  postgresql90.x86_64 0:9.0.4-1PGDG.rhel5&lt;br /&gt;  postgresql90-devel.x86_64 0:9.0.4-1PGDG.rhel5&lt;br /&gt;  postgresql90-libs.i386 0:9.0.4-1PGDG.rhel5&lt;br /&gt;  postgresql90-libs.x86_64 0:9.0.4-1PGDG.rhel5&lt;br /&gt;  postgresql90-server.x86_64 0:9.0.4-1PGDG.rhel5&lt;br /&gt;&lt;br /&gt;Dependency Installed:&lt;br /&gt;  cyrus-sasl-lib.i386 0:2.1.22-5.el5_4.3    libxslt.x86_64 0:1.1.17-2.el5_2.2&lt;br /&gt;  openldap.i386 0:2.3.43-12.el5_6.7&lt;br /&gt;&lt;br /&gt;Dependency Updated:&lt;br /&gt;  openldap.x86_64 0:2.3.43-12.el5_6.7&lt;br /&gt;&lt;br /&gt;Complete!&lt;br /&gt;[root@server1 ~]#&lt;/pre&gt;We can now initialize Postgre&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;i&gt;*note: when using Webmin, please see 'Configuring Webmin to Manage PostgreSQL9 below)&lt;/i&gt;:&lt;/pre&gt;&lt;pre&gt;&lt;pre class="js" name="code"&gt;[root@server1 ~]# service postgresql-9.0 initdb&lt;/pre&gt;Start the Postgre server:&lt;pre class="js" name="code"&gt;[root@server1 ~]# service postgresql-9.0 start&lt;/pre&gt;&lt;b style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: large;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/pre&gt;&lt;pre&gt;&lt;b style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: large;"&gt;Configuring Webmin to Manage PostegreSQL 9&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Due to the directory structure of PostgreSQL 9, you will need to make a few changes to the Webmin management interface it let Webmin know where the Postgre files are located.&lt;br /&gt;&lt;br /&gt;Under Servers&amp;gt;PostgreSQL Database Server&lt;br /&gt;&lt;br /&gt;Click on Module Configuration.&lt;br /&gt;&lt;br /&gt;Make the following substitutions in the System Configuration Section:&lt;br /&gt;&lt;br /&gt;&lt;b style="color: #990000;"&gt;&lt;span style="color: #990000;"&gt;1. &lt;/span&gt;Path to psql command:&lt;/b&gt;&lt;b&gt;&lt;span style="color: #990000;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;Original:&lt;/span&gt;  /usr/bin/psql&lt;br /&gt;&lt;span style="color: blue;"&gt;Change to:&lt;/span&gt; /usr/pgsql-9.0/bin/psql&lt;br /&gt;&lt;br /&gt;&lt;b style="color: #990000;"&gt;&lt;span style="color: #990000;"&gt;2. &lt;/span&gt;Command to start PostgreSQL&lt;/b&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;Original: &lt;/span&gt;&lt;pre class="js" name="code"&gt;if [ -r /etc/rc.d/init.d/rhdb ]; then /etc/rc.d/init.d/rhdb start; else /etc/rc.d/init.d/postgresql start; fi&lt;/pre&gt;&lt;span style="color: blue;"&gt;Change to:&lt;/span&gt;  &lt;pre class="js" name="code"&gt;if [ -r /etc/rc.d/init.d/rhdb ]; then /etc/rc.d/init.d/rhdb start; else /etc/rc.d/init.d/postgresql-9.0 start; fi&lt;/pre&gt;&lt;span style="color: #990000;"&gt;&lt;b&gt;3. Command to stop PostgreSQL&lt;/b&gt;&lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span style="color: blue;"&gt;Original:&lt;/span&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;if [ -r /etc/rc.d/init.d/rhdb ]; then /etc/rc.d/init.d/rhdb stop; else /etc/rc.d/init.d/postgresql stop; fi&lt;/pre&gt;&lt;span style="color: blue;"&gt;Change to:&lt;/span&gt; &lt;pre class="js" name="code"&gt;if [ -r /etc/rc.d/init.d/rhdb ]; then /etc/rc.d/init.d/rhdb stop; else /etc/rc.d/init.d/postgresql-9.0 stop; fi&lt;/pre&gt;&lt;span style="color: #990000;"&gt;&lt;b&gt;4. Command to initialize PostgreSQL&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;Original:&lt;/span&gt;&lt;pre class="js" name="code"&gt;if [ -r /etc/rc.d/init.d/rhdb ]; then /etc/rc.d/init.d/rhdb start; else /etc/rc.d/init.d/postgresql initdb ; /etc/rc.d/init.d/postgresql start; fi&lt;/pre&gt;&lt;span style="color: blue;"&gt;Change to:&lt;/span&gt;  &lt;pre class="js" name="code"&gt;if [ -r /etc/rc.d/init.d/rhdb ]; then /etc/rc.d/init.d/rhdb start; else /etc/rc.d/init.d/postgresql-9.0 initdb ; /etc/rc.d/init.d/postgresql-9.0 start; fi&lt;/pre&gt;&lt;span style="color: #990000;"&gt;&lt;b&gt;5. Path to postmaster PID file&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;Original:&lt;/span&gt; /var/run/postmaster.pid&lt;span style="color: blue;"&gt;Change to:&lt;/span&gt; /var/run/postmaster-9.0.pid&lt;b&gt;&lt;span style="color: #990000;"&gt;6. Paths to host access config file&lt;/span&gt;&lt;/b&gt;&lt;span style="color: blue;"&gt;Original:&lt;/span&gt; /var/lib/pgsql/data/pg_hba.conf&lt;span style="color: blue;"&gt;Change to:&lt;/span&gt; /var/lib/pgsql/9.0/data/pg_hba.conf&lt;b&gt;&lt;span style="color: #990000;"&gt;7. Default backup repository directory&lt;/span&gt;&lt;/b&gt;&lt;span style="color: blue;"&gt;Original:&lt;/span&gt; /home/db_repository&lt;span style="color: blue;"&gt;Change to:&lt;/span&gt; /var/lib/pgsql/9.0/backupsSave the configuration.If you have not alreay initialized the database, do so now by clicking the initialize database button.&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_9kl8kmes6FE/TMmVvj4H86I/AAAAAAAAAE4/oJjHLVnAjiM/s1600/OriginalWebmin.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;/a&gt;&lt;/div&gt;&lt;a href="http://www.acugis.com/postgresql-hosting.htm" target="_blank"&gt;&lt;img border="0" src="http://www.davidghedini.com/images/banners/AcuGISPg9Hosting.png" alt="PostgreSQL 9 Hosting" /&gt;&lt;/a&gt;&lt;a href="http://www.acugis.com/postgis-hosting.htm" target="_blank"&gt;&lt;img border="0" src="http://www.davidghedini.com/images/banners/AcuGISHosting.png" alt="PostGIS Hosting" /&gt;&lt;/a&gt;Additional information and references:&lt;a href="http://people.planetpostgresql.org/devrim/index.php?/archives/43-How-to-install-PostgreSQL-9.0-Beta-1-to-FedoraCentOSRHEL.html" target="-blank"&gt;http://people.planetpostgresql.org/devrim/index.php?/archives/43-How-to-install-PostgreSQL-9.0-Beta-1-to-FedoraCentOSRHEL.html&lt;/a&gt;&lt;a href="http://www.postgresonline.com/journal/index.php?/archives/45-An-Almost-Idiots-Guide-to-PostgreSQL-YUM.html" target="-blank"&gt;http://www.postgresonline.com/journal/index.php?/archives/45-An-Almost-Idiots-Guide-to-PostgreSQL-YUM.html&lt;/a&gt;&lt;a href="http://www.postgresql.org/" target="-blank"&gt;http://www.postgresql.org/&lt;/a&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4739427765174521248-4229730495892211213?l=davidghedini.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://davidghedini.blogspot.com/feeds/4229730495892211213/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4739427765174521248&amp;postID=4229730495892211213&amp;isPopup=true' title='13 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/4229730495892211213'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/4229730495892211213'/><link rel='alternate' type='text/html' href='http://davidghedini.blogspot.com/2010/10/install-postgresql-9-on-centos.html' title='Install PostgreSQL 9 on CentOS'/><author><name>David Ghedini</name><uri>http://www.blogger.com/profile/17216036360922714725</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='20' src='http://3.bp.blogspot.com/_9kl8kmes6FE/TRZtxgi0R0I/AAAAAAAAAGY/plAxLyonZ_U/S220/TheWholeGang.jpg'/></author><thr:total>13</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4739427765174521248.post-1834344907079405054</id><published>2010-07-18T13:31:00.000-07:00</published><updated>2010-12-26T06:41:25.369-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tomcat Manager Password'/><category scheme='http://www.blogger.com/atom/ns#' term='MD5'/><category scheme='http://www.blogger.com/atom/ns#' term='SHA'/><category scheme='http://www.blogger.com/atom/ns#' term='Tomcat'/><title type='text'>Tomcat Manager Password</title><content type='html'>This post will cover basic set up and configuration to access the Tomcat Manager interface.&lt;br /&gt;&lt;br /&gt;After installing Tomcat 6, as shown in my &lt;a href="http://davidghedini.blogspot.com/2010/07/install-tomcat-6-on-centos.html" target="_blank"&gt;previous post&lt;/a&gt;, you can navigate to http://yourdomain.com:8080 to access the Tomcat Manager.&lt;br /&gt;&lt;br /&gt;With some variation, which we will note, the procedure is the same for Tomcat 5, 6, and 7 (Beta).&lt;br /&gt;&lt;br /&gt;By default, no users or passwords are created for the Tomcat manager role.&lt;br /&gt;&lt;br /&gt;To set a user name and password, we need to configure the tomcat-users.xml file located at $CATALINA_HOME/conf/tomcat-users.xml.&lt;br /&gt;&lt;br /&gt;In the case of our installation, $CATALINA_HOME is located at /usr/share/apache-tomcat-6.0.26.&lt;br /&gt;&lt;br /&gt;By default the Tomcat 6 tomcat-users.xml file will look as below.&lt;br /&gt;&lt;br /&gt;Note that while examples are provided, the elements between the &amp;lt;tomcat-users&amp;gt; and &amp;lt;/tomcat-users&amp;gt; tags have been commented-out using &amp;lt;!-- --&amp;gt;&lt;br /&gt;&lt;br /&gt;Most of what you need is explained in the file itself.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&lt;?xml version='1.0' encoding='utf-8'?&gt;&lt;br /&gt;&lt;!--&lt;br /&gt;  Licensed to the Apache Software Foundation (ASF) under one or more&lt;br /&gt;  contributor license agreements.  See the NOTICE file distributed with&lt;br /&gt;  this work for additional information regarding copyright ownership.&lt;br /&gt;  The ASF licenses this file to You under the Apache License, Version 2.0&lt;br /&gt;  (the "License"); you may not use this file except in compliance with&lt;br /&gt;  the License.  You may obtain a copy of the License at&lt;br /&gt;&lt;br /&gt;      http://www.apache.org/licenses/LICENSE-2.0&lt;br /&gt;&lt;br /&gt;  Unless required by applicable law or agreed to in writing, software&lt;br /&gt;  distributed under the License is distributed on an "AS IS" BASIS,&lt;br /&gt;  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&lt;br /&gt;  See the License for the specific language governing permissions and&lt;br /&gt;  limitations under the License.&lt;br /&gt;--&gt;&lt;br /&gt;&lt;tomcat-users&gt;&lt;br /&gt;&lt;!--&lt;br /&gt;  NOTE:  By default, no user is included in the "manager" role required&lt;br /&gt;  to operate the "/manager" web application.  If you wish to use this app,&lt;br /&gt;  you must define such a user - the username and password are arbitrary.&lt;br /&gt;--&gt;&lt;br /&gt;&lt;!--&lt;br /&gt;  NOTE:  The sample user and role entries below are wrapped in a comment&lt;br /&gt;  and thus are ignored when reading this file. Do not forget to remove&lt;br /&gt;  &lt;!.. ..&gt; that surrounds them.&lt;br /&gt;--&gt;&lt;br /&gt;&lt;!--&lt;br /&gt;  &lt;role rolename="tomcat"/&gt;&lt;br /&gt;  &lt;role rolename="role1"/&gt;&lt;br /&gt;  &lt;user username="tomcat" password="tomcat" roles="tomcat"/&gt;&lt;br /&gt;  &lt;user username="both" password="tomcat" roles="tomcat,role1"/&gt;&lt;br /&gt;  &lt;user username="role1" password="tomcat" roles="role1"/&gt;&lt;br /&gt;--&gt;&lt;br /&gt;&lt;/tomcat-users&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now, in order to access Tomcat Manager we simply need to add a role, manager, and then add a user name with password and assign the user to the manager role.&lt;br /&gt;&lt;br /&gt;I'll create a user 'david' with password 'BlogPost', and I'll assign 'david' to the manager role.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&lt;?xml version='1.0' encoding='utf-8'?&gt;&lt;br /&gt;&lt;!--&lt;br /&gt;  Licensed to the Apache Software Foundation (ASF) under one or more&lt;br /&gt;  contributor license agreements.  See the NOTICE file distributed with&lt;br /&gt;  this work for additional information regarding copyright ownership.&lt;br /&gt;  The ASF licenses this file to You under the Apache License, Version 2.0&lt;br /&gt;  (the "License"); you may not use this file except in compliance with&lt;br /&gt;  the License.  You may obtain a copy of the License at&lt;br /&gt;&lt;br /&gt;      http://www.apache.org/licenses/LICENSE-2.0&lt;br /&gt;&lt;br /&gt;  Unless required by applicable law or agreed to in writing, software&lt;br /&gt;  distributed under the License is distributed on an "AS IS" BASIS,&lt;br /&gt;  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&lt;br /&gt;  See the License for the specific language governing permissions and&lt;br /&gt;  limitations under the License.&lt;br /&gt;--&gt;&lt;br /&gt;&lt;tomcat-users&gt;&lt;br /&gt;&lt;role rolename="manager"/&gt;&lt;br /&gt;&lt;user username="david" password="BlogSpot" roles="manager"/&gt; &lt;br /&gt;&lt;/tomcat-users&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;That's it! Very simple.&lt;br /&gt;&lt;br /&gt;We added the role 'manager', and then created the username 'david' with password 'BlogSpot' and assigned the user to manager role.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;IMPORTANT NOTE:&lt;/b&gt; &lt;i&gt;For Tomcat 7.0, which is now in Beta Release, the role name is manager-gui. If configuring Tomcat 7.0, use this in place of 'manager':&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&lt;?xml version='1.0' encoding='utf-8'?&gt;&lt;br /&gt;&lt;!--&lt;br /&gt;For TOMCAT 7 we use the role manager-gui instead of manager&lt;br /&gt;--&gt;&lt;br /&gt;&lt;tomcat-users&gt;&lt;br /&gt;&lt;role rolename="manager-gui"/&gt;&lt;br /&gt;&lt;user username="davidg" password="BlogSpot" roles="manager-gui"/&gt; &lt;br /&gt;&lt;/tomcat-users&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now, restart your Tomcat instance, and verify that you are able to access the Tomcat Manager at http://yourdomain.com:8080.&lt;br /&gt;&lt;br /&gt;Click on the Tomcat Manager link on the Administration menu and enter the user name and password you created above.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Securing Your Tomcat Manager Password: Creating an SHA or MD5 Digest Password&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;You could stop here, but since the password is stored in plain text in the tomcat-users.xml file, it's a good idea to encrypt your password.&lt;br /&gt;&lt;br /&gt;By default, Tomcat employs a simple, file based UserDatabase Realm for security. In this case, passwords are stored in plain text in the tomcat-users.xml file we configured above.&lt;br /&gt;&lt;br /&gt;There are much stronger security Realms that can be used such as JNDI and JDBC, but we'll start with the simplest and create a Digested version of our password we created above.&lt;br /&gt;&lt;br /&gt;For our Digest algorithm we can use SHA or MD5.  &lt;br /&gt;&lt;br /&gt;We can do this in a few simple steps.&lt;br /&gt;&lt;br /&gt;First, we create a Digest version of our password using the digest.sh script located at $CATALINA_HOME/bin/digest.sh&lt;br /&gt;&lt;br /&gt;For SHA, we use issue ./digest.sh -a sha BlogSpot as shown below.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@server1 bin]# ./digest.sh -a sha BlogSpot&lt;br /&gt;BlogSpot:89fc9f60780695d50b5cf5b0598957fc88c91487&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;We then copy the output, 89fc9f60780695d50b5cf5b0598957fc88c91487, which is our SHA Digest password. Copy it somewhere safe, you will need it in a moment.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Similarly, for MD5, we issue ./digest.sh -a md5 BlogSpot as shown below.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@server1 bin]# ./digest.sh -a md5 BlogSpot&lt;br /&gt;BlogSpot:f105429be7c7a3518f9376b3de4f0f1d&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;We then copy the output, f105429be7c7a3518f9376b3de4f0f1d, which is our MD5 Digest password. Copy it somewhere safe, you will need it in a moment.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now, in our tomcat-users.xml file, replace the plain text password we created 'BlogSpot' (or whatever you used) with the SHA or MD5 Digest password you generated above. I'm going to use SHA.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;[root@server1 conf]# vi tomcat-users.xml&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&lt;?xml version='1.0' encoding='utf-8'?&gt;&lt;br /&gt;&lt;!--&lt;br /&gt;  Licensed to the Apache Software Foundation (ASF) under one or more&lt;br /&gt;  contributor license agreements.  See the NOTICE file distributed with&lt;br /&gt;  this work for additional information regarding copyright ownership.&lt;br /&gt;  The ASF licenses this file to You under the Apache License, Version 2.0&lt;br /&gt;  (the "License"); you may not use this file except in compliance with&lt;br /&gt;  the License.  You may obtain a copy of the License at&lt;br /&gt;&lt;br /&gt;      http://www.apache.org/licenses/LICENSE-2.0&lt;br /&gt;&lt;br /&gt;  Unless required by applicable law or agreed to in writing, software&lt;br /&gt;  distributed under the License is distributed on an "AS IS" BASIS,&lt;br /&gt;  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&lt;br /&gt;  See the License for the specific language governing permissions and&lt;br /&gt;  limitations under the License.&lt;br /&gt;--&gt;&lt;br /&gt;&lt;tomcat-users&gt;&lt;br /&gt;&lt;role rolename="manager"/&gt;&lt;br /&gt;&lt;user username="david" password="89fc9f60780695d50b5cf5b0598957fc88c91487" roles="manager"/&gt;&lt;br /&gt;&lt;/tomcat-users&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Finally, we need to make an adjustment to our server.xml file, located in the Tomcat conf directory, so Tomcat knows we are using a Digest password as well as the Digest algorithm we selected (SHA or MD5).&lt;br /&gt;&lt;br /&gt;In your server.xml file, look for this section:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&lt;!-- This Realm uses the UserDatabase configured in the global JNDI&lt;br /&gt;  resources under the key "UserDatabase".  Any edits&lt;br /&gt;  that are performed against this UserDatabase are immediately&lt;br /&gt;  available for use by the Realm.  --&gt;&lt;br /&gt; &lt;realm className="org.apache.catalina.realm.UserDatabaseRealm"&lt;br /&gt;  resourceName="UserDatabase"/&gt;&lt;/realm&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;At the end of the entry, we add: digest="sha" as shown below if we used the SHA Digest Algorithm. &lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&lt;!-- This Realm uses the UserDatabase configured in the global JNDI&lt;br /&gt;  resources under the key "UserDatabase".  Any edits&lt;br /&gt;  that are performed against this UserDatabase are immediately&lt;br /&gt;  available for use by the Realm.  --&gt;&lt;br /&gt;&lt;realm className="org.apache.catalina.realm.UserDatabaseRealm"&lt;br /&gt;resourceName="UserDatabase" digest="sha" /&gt;&lt;/realm&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;If we used the MD5, we add digest="md5" as shown below.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&lt;!-- This Realm uses the UserDatabase configured in the global JNDI&lt;br /&gt;  resources under the key "UserDatabase".  Any edits&lt;br /&gt;  that are performed against this UserDatabase are immediately&lt;br /&gt;  available for use by the Realm.  --&gt;&lt;br /&gt;&lt;realm className="org.apache.catalina.realm.UserDatabaseRealm"&lt;br /&gt;resourceName="UserDatabase" digest="md5" /&gt;&lt;/realm&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;We have now created the manager role, added a user with password to the manager role, as well as encrypted our user password using MD5 or SHA Digest.&lt;br /&gt;&lt;br /&gt;Later we'll look at JDBC and JNDI security Realms, as well as other measures for securing your Tomcat installation.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Related Posts: &lt;br /&gt;&lt;a href="http://davidghedini.blogspot.com/2010/07/install-tomcat-6-on-centos.html"&gt;Install Tomcat 6 on CentOS&lt;/a&gt;&lt;br /&gt;&lt;a href="http://davidghedini.blogspot.com/2010/12/tomcat-oracle-jdbc-connection-using.html"&gt;Tomcat Oracle JDBC Connection&lt;/a&gt;&lt;br /&gt;&lt;a href="http://davidghedini.blogspot.com/2010/10/tomcat-custom-404-page.html"&gt;Tomcat Custom 404 Page&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4739427765174521248-1834344907079405054?l=davidghedini.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://davidghedini.blogspot.com/feeds/1834344907079405054/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4739427765174521248&amp;postID=1834344907079405054&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/1834344907079405054'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/1834344907079405054'/><link rel='alternate' type='text/html' href='http://davidghedini.blogspot.com/2010/07/tomcat-manager-password.html' title='Tomcat Manager Password'/><author><name>David Ghedini</name><uri>http://www.blogger.com/profile/17216036360922714725</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='20' src='http://3.bp.blogspot.com/_9kl8kmes6FE/TRZtxgi0R0I/AAAAAAAAAGY/plAxLyonZ_U/S220/TheWholeGang.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4739427765174521248.post-5727064943964497681</id><published>2010-07-06T06:20:00.000-07:00</published><updated>2010-07-06T06:20:34.618-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tomcat7'/><category scheme='http://www.blogger.com/atom/ns#' term='Tomcat'/><title type='text'>Tomcat 7 Beta Release</title><content type='html'>Tomcat 7.0.0 Beta was released on June 29th.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://tomcat.apache.org/tomcat-7.0-doc/index.html" target="_blank"&gt;http://tomcat.apache.org/tomcat-7.0-doc/index.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;"The Apache Tomcat Project is proud to announce the release of version 7.0.0 beta of Apache Tomcat. This release is the first Apache Tomcat release to support the Servlet 3.0, JSP 2.2 and EL 2.2 specifications. In addition, it includes numerous other improvements such as web application memory leak detection and prevention, extensive internal code clean-up and support for including external content directly in a web application (aliases)."&lt;br /&gt;&lt;br /&gt;The list of improvements and additional features looks like exciting stuff.&lt;br /&gt;&lt;br /&gt;I just got started playing with it a few days ago, the baseline installation is as Tomcat 6 (&lt;a href="http://davidghedini.blogspot.com/2010/07/install-tomcat-6-on-centos.html"&gt;see my previous post here&lt;/a&gt;).&lt;br /&gt;&lt;br /&gt;One configuration change I came across off the bat is the need to use the role of manager-gui, replacing the old manager role:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;&lt;tomcat-users&gt;&lt;br /&gt;&lt;role rolename="manager-gui"/&gt;&lt;br /&gt;&lt;user username="tomcat" password="password" roles="manager-gui"/&gt;&lt;br /&gt;&lt;/tomcat-users&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Well, I hope to be posting much more soon......&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4739427765174521248-5727064943964497681?l=davidghedini.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://davidghedini.blogspot.com/feeds/5727064943964497681/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4739427765174521248&amp;postID=5727064943964497681&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/5727064943964497681'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/5727064943964497681'/><link rel='alternate' type='text/html' href='http://davidghedini.blogspot.com/2010/07/tomcat-7-beta-release.html' title='Tomcat 7 Beta Release'/><author><name>David Ghedini</name><uri>http://www.blogger.com/profile/17216036360922714725</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='20' src='http://3.bp.blogspot.com/_9kl8kmes6FE/TRZtxgi0R0I/AAAAAAAAAGY/plAxLyonZ_U/S220/TheWholeGang.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4739427765174521248.post-688962971849767442</id><published>2010-07-04T16:00:00.000-07:00</published><updated>2011-12-25T05:47:14.737-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tomcat 6'/><category scheme='http://www.blogger.com/atom/ns#' term='Tomcat'/><category scheme='http://www.blogger.com/atom/ns#' term='Tomcat Start Script'/><category scheme='http://www.blogger.com/atom/ns#' term='Install Tomcat'/><title type='text'>Install Tomcat 6 on CentOS</title><content type='html'>This post will cover installation and configuration of Tomcat 6 on CentOS 5.&lt;br /&gt;&lt;br /&gt;We will also show how to run Tomcat as a service, create a start/stop script, and configure Tomcat to run under a non-root user.&lt;br /&gt;&lt;br /&gt;This post has been updated for Tomcat 6.0.32.&lt;br /&gt;&lt;br /&gt;This post below will work with any Tomcat 6.x version, but I have been keeping it updated to keep the links consistent and to make it as "copying-and-paste" as possible. &lt;br /&gt;&lt;br /&gt;If you are looking for our tutorial on installing Tomcat 7 on CentOS/RHEL, you can find it &lt;a href="http://davidghedini.blogspot.com/2011/02/install-tomcat-7-on-centos-rhel.html" target="_blank"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;This installation of Tomcat 6.0.32 was done on CentOS 5.5, but any CentOS 5.x should work, as well as RHEL and Fedora.&lt;br /&gt;&lt;br /&gt;If you do not already have the Java Development Kit (JDK) installed on your machine, you will need to download and install the required JDK for your platform.&lt;br /&gt;&lt;br /&gt;If you do have the JDK installed, you can skip to: Step 2: Download and Install the Tomcat 6.0.32:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;b&gt;Step 1: Install the JDK&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;You can download the JDK here: &lt;a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html" target="_blank"&gt;http://www.oracle.com/technetwork/java/javase/downloads/index.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I'm using the latest, which is JDK 6, update 24. The JDK is specific to 32 and 64 bit versions.&lt;br /&gt;&lt;br /&gt;My CentOS box is 64 bit, so I'll need: jdk-6u24-linux-x64.bin.&lt;br /&gt;&lt;br /&gt;If you are on 32 bit, you'll need: jdk-6u24-linux-i586.bin&lt;br /&gt;&lt;br /&gt;Download the appropriate JDK and save it to a directory. I'm saving it to /root.&lt;br /&gt;&lt;br /&gt;Move (mv) or copy (cp) the file to the /opt directory:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@blanche ~]# mv jdk-6u24-linux-x64.bin /opt/jdk-6u24-linux-x64.bin  &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Create a new directory /usr/java.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@blanche ~]# mkdir /usr/java  &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Change to the /usr/java directory we created and install the JDK using 'sh /opt/jdk-6u24-linux-x64.bin'&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@blanche ~]# cd /usr/java&lt;br /&gt;[root@blanche java]# sh /opt/jdk-6u24-linux-x64.bin&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Set the JAVA_HOME path. This is where we installed our JDK above.&lt;br /&gt;&lt;br /&gt;To set it for your current session, you can issue the following from the CLI:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@blanche java]# JAVA_HOME=/usr/java/jdk1.6.0_24&lt;br /&gt;[root@blanche java]# export JAVA_HOME&lt;br /&gt;[root@blanche java]# PATH=$JAVA_HOME/bin:$PATH&lt;br /&gt;[root@blanche java]# export PATH&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;To set the JAVA_HOME for users, we add below to the user ~/.bashrc or ~/.bash_profile of the user. We can also add it /etc/profile and then source it to give to all users.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;JAVA_HOME=/usr/java/jdk1.6.0_24&lt;br /&gt;export JAVA_HOME&lt;br /&gt;PATH=$JAVA_HOME/bin:$PATH&lt;br /&gt;export PATH&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Once you have added the above to ~/.bash_profile or ~/.bashrc, you should log out, then log back in and check that the JAVA_HOME is set correctly.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@blanche ~]#  echo $JAVA_HOME&lt;br /&gt;/usr/java/jdk1.6.0_24&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;b&gt;Step 2: Download and Install Tomcat 6.0.32:&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;Download apache-tomcat-6.0.32.tar.gz &lt;a href="http://tomcat.apache.org/download-60.cgi" target="_blank"&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Save the file to a directory. I'm saving it to /root/apache-tomcat-6.0.32.tar.gz&lt;br /&gt;&lt;br /&gt;Before proceeding, you should verify the MD5 Checksum for your Tomcat download (or any other download).&lt;br /&gt;&lt;br /&gt;Since we saved the Tomcat download to /root/apache-tomcat-6.0.32.tar.gz, we'll go to the /root directory and use the md5sum command.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@blanche ~]# md5sum apache-tomcat-6.0.32.tar.gz&lt;br /&gt;082a0707985b6c029920d4d6d5ec11cd&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Compare the output above to the MD5 Checksum provided by &lt;a apache-tomcat-6.0.32.tar.gz.md5="" bin="" dist="" href="http://www.apache.org/dist/tomcat/tomcat-6/v6.0.32/bin/apache-tomcat-6.0.32.zip.md5" http:="" target="_blank" tomcat-6="" tomcat="" v6.0.32="" www.apache.org=""&gt;the Apache Tomcat MD5 page&lt;/a&gt; and insure that they match exactly. (There is also a link to display the MD5 checksum located just to the right off the download link).&lt;br /&gt;&lt;br /&gt;Now, move (mv) or copy (cp) the file to the /usr/share directory:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@blanche ~]# mv apache-tomcat-6.0.32.tar.gz /usr/share/apache-tomcat-6.0.32.tar.gz&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Change to the /usr/share directory and unpack the file using tar -xzf:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@blanche ~]# cd /usr/share&lt;br /&gt;[root@sv2 blanche ]# tar -xzf apache-tomcat-6.0.32.tar.gz  &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This will create the directory /usr/share/apache-tomcat-6.0.32&lt;br /&gt;&lt;br /&gt;At this point, you could start Tomcat via the Tomcat bin directory using the Tomcat startup.sh script located at /usr/share/apache-tomcat-6.0.32/bin.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@blanche share]# cd /usr/share/apache-tomcat-6.0.32/bin&lt;br /&gt;[root@blanche bin]# ./startup.sh&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;b&gt;Step 3: How to Run Tomcat as a Service.&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;We will now see how to run Tomcat as a service and create a simple Start/Stop/Restart script, as well as to start Tomcat at boot.&lt;br /&gt;&lt;br /&gt;Change to the /etc/init.d directory and create a script called 'tomcat' as shown below.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@blanche share]# cd /etc/init.d&lt;br /&gt;[root@blanche init.d]# vi tomcat&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;#!/bin/bash&lt;br /&gt;# description: Tomcat Start Stop Restart&lt;br /&gt;# processname: tomcat&lt;br /&gt;# chkconfig: 234 20 80&lt;br /&gt;JAVA_HOME=/usr/java/jdk1.6.0_24&lt;br /&gt;export JAVA_HOME&lt;br /&gt;PATH=$JAVA_HOME/bin:$PATH&lt;br /&gt;export PATH&lt;br /&gt;CATALINA_HOME=/usr/share/apache-tomcat-6.0.32&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;case $1 in&lt;br /&gt;start)&lt;br /&gt;sh $CATALINA_HOME/bin/startup.sh&lt;br /&gt;;; &lt;br /&gt;stop)   &lt;br /&gt;sh $CATALINA_HOME/bin/shutdown.sh&lt;br /&gt;;; &lt;br /&gt;restart)&lt;br /&gt;sh $CATALINA_HOME/bin/shutdown.sh&lt;br /&gt;sh $CATALINA_HOME/bin/startup.sh&lt;br /&gt;;; &lt;br /&gt;esac    &lt;br /&gt;exit 0&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The above script is simple and contains all of the basic elements you will need to get going. &lt;br /&gt;&lt;br /&gt;As you can see, we are simply calling the startup.sh and shutdown.sh scripts located in the Tomcat bin directory (/usr/share/apache-tomcat-6.0.32/bin). &lt;br /&gt;&lt;br /&gt;You can adjust your script according to your needs and, in subsequent posts, we'll look at additional examples.&lt;br /&gt;&lt;br /&gt;CATALINA_HOME is the Tomcat home directory (/usr/share/apache-tomcat-6.0.32)&lt;br /&gt;&lt;br /&gt;Now, set the permissions for your script to make it executable:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@blanche init.d]# chmod 755 tomcat&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;We now use the chkconfig utility to have Tomcat start at boot time. In my script above, I am using chkconfig: 244 20 80. 2445 are the run levels and 20 and 80 are the stop and start priorities respectively. You can adjust as needed.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@blanche init.d]# chkconfig --add tomcat&lt;br /&gt;[root@blanche init.d]# chkconfig --level 234 tomcat on&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Verify it:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@blanche init.d]# chkconfig --list tomcat&lt;br /&gt;tomcat          0:off   1:off   2:on    3:on    4:on    5:off   6:off&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Now, let's test our script.&lt;br /&gt;&lt;br /&gt;Start Tomcat:&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@blanche ~]# service tomcat start&lt;br /&gt;Using CATALINA_BASE:   /usr/share/apache-tomcat-6.0.32&lt;br /&gt;Using CATALINA_HOME:   /usr/share/apache-tomcat-6.0.32&lt;br /&gt;Using CATALINA_TMPDIR: /usr/share/apache-tomcat-6.0.32/temp&lt;br /&gt;Using JRE_HOME:        /usr/java/jdk1.6.0_24&lt;br /&gt;Using CLASSPATH:       /usr/share/apache-tomcat-6.0.32/bin/bootstrap.jar&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Stop Tomcat:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@blanche ~]# service tomcat stop&lt;br /&gt;Using CATALINA_BASE:   /usr/share/apache-tomcat-6.0.32&lt;br /&gt;Using CATALINA_HOME:   /usr/share/apache-tomcat-6.0.32&lt;br /&gt;Using CATALINA_TMPDIR: /usr/share/apache-tomcat-6.0.32/temp&lt;br /&gt;Using JRE_HOME:        /usr/java/jdk1.6.0_24&lt;br /&gt;Using CLASSPATH:       /usr/share/apache-tomcat-6.0.32/bin/bootstrap.jar&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Restarting Tomcat (Must be started first):&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@blanche ~]# service tomcat restart&lt;br /&gt;Using CATALINA_BASE:   /usr/share/apache-tomcat-6.0.32&lt;br /&gt;Using CATALINA_HOME:   /usr/share/apache-tomcat-6.0.32&lt;br /&gt;Using CATALINA_TMPDIR: /usr/share/apache-tomcat-6.0.32/temp&lt;br /&gt;Using JRE_HOME:        /usr/java/jdk1.6.0_24&lt;br /&gt;Using CLASSPATH:       /usr/share/apache-tomcat-6.0.32/bin/bootstrap.jar&lt;br /&gt;Using CATALINA_BASE:   /usr/share/apache-tomcat-6.0.32&lt;br /&gt;Using CATALINA_HOME:   /usr/share/apache-tomcat-6.0.32&lt;br /&gt;Using CATALINA_TMPDIR: /usr/share/apache-tomcat-6.0.32/temp&lt;br /&gt;Using JRE_HOME:        /usr/java/jdk1.6.0_24&lt;br /&gt;Using CLASSPATH:       /usr/share/apache-tomcat-6.0.32/bin/bootstrap.jar&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;We should review the Catalina.out log located at /usr/share/apache-tomcat-6.0.32/logs/catalina.out and check for any errors.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@blanche init.d]# more /usr/share/apache-tomcat-6.0.32/logs/catalina.out&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;We can now access the Tomcat Manager page at:&lt;br /&gt;&lt;br /&gt;http://yourdomain.com:8080 or http://yourIPaddress:8080 and we should see the Tomcat home page.&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;b&gt;Step 5 (Optional): How to Run Tomcat using Minimally Privileged (non-root) User.&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;In our Tomcat configuration above, we are running Tomcat as Root.&lt;br /&gt;&lt;br /&gt;For security reasons, it is always best to run services with the only those privileges that are necessary. &lt;br /&gt;&lt;br /&gt;There are some who make a strong case that this is not required, but it's always best to err on the side of caution.&lt;br /&gt;&lt;br /&gt;To run Tomcat as non-root user, we need to do the following:&lt;br /&gt;&lt;br /&gt;1. Create the group 'tomcat':&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@blanche ~]# groupadd tomcat&lt;br /&gt;[root@blanche ~]# useradd -s /bin/bash -g tomcat tomcat&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;2. Create the user 'tomcat' and add this user to the tomcat group we created above.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@blanche ~]# groupadd tomcat&lt;br /&gt;[root@blanche ~]# useradd -s /bin/bash -g tomcat tomcat&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The above will create a home directory for the user tomcat in the default user home as /home/tomcat&lt;br /&gt;&lt;br /&gt;If we want the home directory to be elsewhere, we simply specify so using the -d switch.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@blanche ~]# useradd -g tomcat -d /usr/share/apache-tomcat-6.0.32/tomcat tomcat&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The above will create the user tomcat's home directory as /usr/share/apache-tomcat-6.0.32/tomcat&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;3. Change ownership of the tomcat files to the user we created above:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@blanche ~]# chown -Rf tomcat.tomcat /usr/share/apache-tomcat-6.0.32/&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Note: it is possible to enhance our security still further by making certain files and directory read-only. This will not be covered in this post and care should be used when setting such permissions.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;4. Adjust the start/stop service script we created above. In our new script, we need to su to the user tomcat:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;#!/bin/bash&lt;br /&gt;# description: Tomcat Start Stop Restart&lt;br /&gt;# processname: tomcat&lt;br /&gt;# chkconfig: 234 20 80&lt;br /&gt;JAVA_HOME=/usr/java/jdk1.6.0_24&lt;br /&gt;export JAVA_HOME&lt;br /&gt;PATH=$JAVA_HOME/bin:$PATH&lt;br /&gt;export PATH&lt;br /&gt;TOMCAT_HOME=/usr/share/apache-tomcat-6.0.32/bin&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;case $1 in&lt;br /&gt;start)&lt;br /&gt;/bin/su tomcat $TOMCAT_HOME/startup.sh&lt;br /&gt;;; &lt;br /&gt;stop)   &lt;br /&gt;/bin/su tomcat $TOMCAT_HOME/shutdown.sh&lt;br /&gt;;; &lt;br /&gt;restart)&lt;br /&gt;/bin/su tomcat $TOMCAT_HOME/shutdown.sh&lt;br /&gt;/bin/su tomcat $TOMCAT_HOME/startup.sh&lt;br /&gt;;; &lt;br /&gt;esac    &lt;br /&gt;exit 0&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000; text-align: center;"&gt;&lt;b&gt;Step 6 (Optional): How to Run Tomcat on Port 80 as Non-Root User.&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;Note: the following applies when you are running Tomcat in "stand alone"  mode. That is, you are running Tomcat without Apache in front of it. &lt;br /&gt;&lt;br /&gt;To run services below port 1024 as a user other than root, you can add the following to your IP tables:&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@blanche ~]# iptables -t nat -A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080  &lt;br /&gt;[root@blanche ~]# iptables -t nat -A PREROUTING -p udp -m udp --dport 80 -j REDIRECT --to-ports 8080  &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.enciva.com/tomcat-hosting.htm" target="_blank"&gt;&lt;img border="0" src="http://www.davidghedini.com/images/banners/EncivaTomcat6Hosting.png" alt="Tomcat 6 Hosting" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Related Posts: &lt;br /&gt;&lt;a href="http://davidghedini.blogspot.com/2010/12/tomcat-oracle-jdbc-connection-using.html"&gt;Tomcat Oracle JDBC Connection&lt;/a&gt;&lt;br /&gt;&lt;a href="http://davidghedini.blogspot.com/2010/07/tomcat-manager-password.html"&gt;Tomcat Manager Password&lt;/a&gt;&lt;br /&gt;&lt;a href="http://davidghedini.blogspot.com/2010/10/tomcat-custom-404-page.html"&gt;Tomcat Custom 404 Page&lt;/a&gt;&lt;br /&gt;&lt;a href="http://davidghedini.blogspot.com/2011/02/install-tomcat-7-on-centos-rhel.html"&gt;Install Tomcat 7 on CentOS/RHEL&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Learn More About Apache Tomcat&lt;br /&gt;&lt;br /&gt;&lt;a href="http://tomcat.apache.org/" target="_blank"&gt;Apache Tomcat Foundation&lt;/a&gt;&lt;br /&gt;&lt;a href="http://tomcat.apache.org/download-60.cgi" target="_blank"&gt;Tomcat 6&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4739427765174521248-688962971849767442?l=davidghedini.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://davidghedini.blogspot.com/feeds/688962971849767442/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4739427765174521248&amp;postID=688962971849767442&amp;isPopup=true' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/688962971849767442'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/688962971849767442'/><link rel='alternate' type='text/html' href='http://davidghedini.blogspot.com/2010/07/install-tomcat-6-on-centos.html' title='Install Tomcat 6 on CentOS'/><author><name>David Ghedini</name><uri>http://www.blogger.com/profile/17216036360922714725</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='20' src='http://3.bp.blogspot.com/_9kl8kmes6FE/TRZtxgi0R0I/AAAAAAAAAGY/plAxLyonZ_U/S220/TheWholeGang.jpg'/></author><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4739427765174521248.post-4194775740002344290</id><published>2010-06-28T13:39:00.000-07:00</published><updated>2010-12-25T14:15:55.211-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CentOS'/><category scheme='http://www.blogger.com/atom/ns#' term='Hostname'/><title type='text'>How to Set Hostname on CentOS (RHEL)</title><content type='html'>Setting the hostname on CentOS (RHEL).&lt;br /&gt;&lt;br /&gt;Well, I could have sworn when I ordered this VPS that I entered the hostname I wanted in the order form.  I guess I must have been hallucinating.... &lt;br /&gt;&lt;br /&gt;Begin by checking the existing hostname using the hostname command.&lt;br /&gt;&lt;pre class="js" name="code"&gt;login as: root&lt;br /&gt;root@vps12's password:&lt;br /&gt;Last login: Mon Jun 28 16:21:53 2010&lt;br /&gt;[root@vps12 ~]# hostname&lt;br /&gt;vps12&lt;br /&gt;&lt;/pre&gt;We can also check via sysctl kernel.hostname&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@vps12 ~]# sysctl kernel.hostname&lt;br /&gt;kernel.hostname = vps12&lt;br /&gt;&lt;/pre&gt;The actual hostname I need to set for this server is blanche.mydomain.net&lt;br /&gt;&lt;br /&gt;I can set the hostname initially using the hostname command followed by the desired hostname.&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@vps12 ~]# hostname blanche.mydomain.net&lt;br /&gt;&lt;/pre&gt;This will set the hostname:&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@vps12 ~]# hostname&lt;br /&gt;blanche.mydomain.net&lt;br /&gt;&lt;/pre&gt;However, once the server is rebooted, the hostname will revert to it's previous setting (vps12).&lt;br /&gt;&lt;br /&gt;To permanently change the hostname, I need to edit the network file at /etc/sysconfig/network.&lt;br /&gt;&lt;br /&gt;So,&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@vps12 ~]# cd /etc/sysconfig&lt;br /&gt;[root@vps12 sysconfig]# vi network&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The Network file will look as so.&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;NETWORKING=yes&lt;br /&gt;HOSTNAME=vps12&lt;br /&gt;GATEWAYDEV=eth0&lt;br /&gt;GATEWAY=192.168.0.1&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Hit 'i' to insert and change the HOSTNAME value to your FQDN, in my case, blanche.mydomain.net&lt;br /&gt;&lt;br /&gt;Hit Escape, then :wq to save and exit.&lt;br /&gt;&lt;br /&gt;Check that the hostname is properly set:&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@vps12 sysconfig]# hostname&lt;br /&gt;blanche.mydomain.net&lt;br /&gt;[root@vps12 sysconfig]# sysctl kernel.hostname&lt;br /&gt;kernel.hostname = blanche.mydomain.net&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Finally, if we log out, and log back in using a new session, we see I am now root@blanche: &lt;br /&gt;&lt;pre class="js" name="code"&gt;login as: root&lt;br /&gt;root@blanche's password:&lt;br /&gt;Last login: Mon Jun 28 16:21:53 2010&lt;br /&gt;[root@blanche ~]#  &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;To properly check, you may wish to reboot the server.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4739427765174521248-4194775740002344290?l=davidghedini.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://davidghedini.blogspot.com/feeds/4194775740002344290/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4739427765174521248&amp;postID=4194775740002344290&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/4194775740002344290'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/4194775740002344290'/><link rel='alternate' type='text/html' href='http://davidghedini.blogspot.com/2010/06/how-to-set-hostname-on-centos-rhel.html' title='How to Set Hostname on CentOS (RHEL)'/><author><name>David Ghedini</name><uri>http://www.blogger.com/profile/17216036360922714725</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='20' src='http://3.bp.blogspot.com/_9kl8kmes6FE/TRZtxgi0R0I/AAAAAAAAAGY/plAxLyonZ_U/S220/TheWholeGang.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4739427765174521248.post-5762698062316864601</id><published>2010-06-28T11:05:00.000-07:00</published><updated>2010-07-03T13:08:19.925-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CentOS'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='Enable Root Login'/><title type='text'>How to Enable Root Login (CentOS / RHEL)</title><content type='html'>Disclaimer: It's always best practice that any machine on the internet not allow direct Root login via SSH.&lt;br /&gt;&lt;br /&gt;To allow Root to log in, we need to update our sshd_config file located at /etc/ssh/sshd_config. &lt;br /&gt;&lt;br /&gt;To update this file, we need to switch over to Root:&lt;br /&gt;&lt;pre name="code" class="js"&gt;[admin@blanche ~]$ su root&lt;br /&gt;Password:&lt;br /&gt;[root@blanche ~]#&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Go to the /ect/ssh directory:&lt;br /&gt;&lt;pre name="code" class="js"&gt;[root@blanche ~]# cd /etc/ssh&lt;br /&gt;[root@blanche ssh]#&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Now, let's edit our sshd_config file using vi:&lt;br /&gt;&lt;pre name="code" class="js"&gt;[root@blanche ssh]# vi sshd_config&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Look for the following section (about 1/3 of the way down):&lt;br /&gt;&lt;pre name="code" class="js"&gt;#LoginGraceTime 2m&lt;br /&gt;PermitRootLogin no&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Hit "i" to insert and then change the value for PermitRootLogin from no to yes.&lt;br /&gt;&lt;br /&gt;Hit Escape and then :wq! to save changes and close the file.&lt;br /&gt;&lt;br /&gt;Finally, still as Root, we need to restart SSHD using /etc/init.d/sshd restart.&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="js"&gt;[root@blanche ssh]# /etc/init.d/sshd restart&lt;br /&gt;Stopping sshd:                                             [  OK  ]&lt;br /&gt;Starting sshd:                                             [  OK  ]&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Exit your session, open a new terminal and confirm you are now able to login as Root:&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="js"&gt;login as: root&lt;br /&gt;root@blanche's password:&lt;br /&gt;Last login: Mon Jun 28 16:21:53 2010&lt;br /&gt;[root@blanche ~]#&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4739427765174521248-5762698062316864601?l=davidghedini.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://davidghedini.blogspot.com/feeds/5762698062316864601/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4739427765174521248&amp;postID=5762698062316864601&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/5762698062316864601'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/5762698062316864601'/><link rel='alternate' type='text/html' href='http://davidghedini.blogspot.com/2010/06/how-to-enable-root-login-centos-rhel.html' title='How to Enable Root Login (CentOS / RHEL)'/><author><name>David Ghedini</name><uri>http://www.blogger.com/profile/17216036360922714725</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='20' src='http://3.bp.blogspot.com/_9kl8kmes6FE/TRZtxgi0R0I/AAAAAAAAAGY/plAxLyonZ_U/S220/TheWholeGang.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4739427765174521248.post-1705264371315879177</id><published>2010-06-05T22:13:00.000-07:00</published><updated>2010-07-29T17:22:01.900-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CentOS'/><category scheme='http://www.blogger.com/atom/ns#' term='Webmin'/><title type='text'>Install Webmin on CentOS 5</title><content type='html'>Some months ago, the download url for Webmin was updated.&lt;br /&gt;&lt;br /&gt;You can find the latest release at: &lt;a href="http://www.webmin.com/download.html" target="_blank"&gt;http://www.webmin.com/download.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;SSH to your server.&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@server7]# yum -y install perl-Net-SSLeay&lt;br /&gt;&lt;/pre&gt;Get the rpm.&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@server7]# wget http://prdownloads.sourceforge.net/webadmin/webmin-1.510-1.noarch.rpm&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Verify using MD5 - Webmin also offers PGP Verification.&lt;br /&gt;&lt;br /&gt;To do this, use the md5sum command&lt;br /&gt;&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@server7]# md5sum webmin-1.510-1.noarch.rpm&lt;br /&gt;7d7167b0f62e7f0a5578a6117581c46f  webmin-1.510-1.noarch.rpm&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Compare the output above to the official MD5 Checksum on the &lt;a href="http://www.webmin.com/download.html" target="_blank"&gt;Webmin Site&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The MD5 Checksum listed on the Webmin site, 7d7167b0f62e7f0a5578a6117581c46f, matches our output above, so we are ready to install.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Install the rpm.&lt;br /&gt;&lt;pre class="js" name="code"&gt;[root@server7]# rpm -i webmin-1.510-1.noarch.rpm &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;You should get a message at the end of the install informing you that you can reach the installation at:&lt;br /&gt;&lt;br /&gt;https://hostname(or server IP):10000&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4739427765174521248-1705264371315879177?l=davidghedini.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://davidghedini.blogspot.com/feeds/1705264371315879177/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4739427765174521248&amp;postID=1705264371315879177&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/1705264371315879177'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/1705264371315879177'/><link rel='alternate' type='text/html' href='http://davidghedini.blogspot.com/2010/06/install-webmin-on-centos-5.html' title='Install Webmin on CentOS 5'/><author><name>David Ghedini</name><uri>http://www.blogger.com/profile/17216036360922714725</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='20' src='http://3.bp.blogspot.com/_9kl8kmes6FE/TRZtxgi0R0I/AAAAAAAAAGY/plAxLyonZ_U/S220/TheWholeGang.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4739427765174521248.post-2188955673475744918</id><published>2010-05-24T15:57:00.000-07:00</published><updated>2011-12-25T05:50:45.018-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='expdp'/><category scheme='http://www.blogger.com/atom/ns#' term='Bash Script'/><category scheme='http://www.blogger.com/atom/ns#' term='MUTT'/><category scheme='http://www.blogger.com/atom/ns#' term='Datapump'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><title type='text'>Bash Script for Oracle Data Pump Export (with FTP and Email)</title><content type='html'>Red Hat Linux 5.4 or CentOS 5.4&lt;br /&gt;Oracle 11g or 10g&lt;br /&gt;SID = orcl &lt;br /&gt;&lt;br /&gt;This post covers creating a basic bash script to produce a Data Pump export file (.dmp) file which we can then FTP to a remote server or mail the file using MUTT.&lt;br /&gt;&lt;br /&gt;We'll also generate a log file of the export and write the output of the log file into the body of an email notification.&lt;br /&gt;&lt;br /&gt;In the first scenario, we want to email the export file as an attachment, so we''ll need to do the following:&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Export the Scott schema on a daily basis using Data Pump.&lt;/li&gt;&lt;li&gt;Create a log file of the Data Pump export &lt;/li&gt;&lt;li&gt;Add the date and hour of the export to to the file name and log file in the forms of : scott-yyyymmddhh.dmp. and scottLOG-yyyymmddhh.log&lt;/li&gt;&lt;li&gt;Use zip or gzip to compress the dump file for easier FTP and/or mailing&lt;/li&gt;&lt;li&gt;Write the contents of the log file into the body of an email.&lt;/li&gt;&lt;li&gt;FTP the file or attach the file to the email and send it.&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;br /&gt;To begin, you will need to create an Oracle directory to export the file to and then grant read and write on the directory for the schema. &lt;br /&gt;&lt;br /&gt;&lt;pre class="python" name="code"&gt;SQL&amp;gt; CREATE OR REPLACE DIRECTORY backdir AS /home/app/oracle/admin/orcl/dpdump&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; GRANT READ, WRITE ON DIRECTORY backdir TO scott;&lt;br /&gt;&lt;/pre&gt;If not already installed, install &lt;a href="http://www.mutt.org/" target="_blank"&gt;MUTT&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;&lt;pre class="python" name="code"&gt;[root@server1]# yum install mutt&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Create your bash script.&lt;br /&gt;&lt;br /&gt;In the first example, we'll zip the export, attach it to an email and place the export log into the body of the email.&lt;br /&gt;&lt;br /&gt;I'm creating mine in /usr/lib/myscripts and the file name will be scottscript.sh &lt;br /&gt;&lt;br /&gt;&lt;pre class="python" name="code"&gt;[root@server1]# cd /usr/lib/myscripts&lt;br /&gt;[root@server1]# vi scottscript.sh &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;pre class="python" name="code"&gt;#!/bin/sh&lt;br /&gt;ORACLE_HOME=/home/app/oracle/product/11.2.0/dbhome_1&lt;br /&gt;export ORACLE_HOME&lt;br /&gt;export PATH=$ORACLE_HOME/bin:$PATH&lt;br /&gt;ORACLE_SID=orcl; export ORACLE_SID&lt;br /&gt;expdp scott/tiger DIRECTORY=backdir DUMPFILE=scott-$(date +%Y%m%d%H) VERSION=10.2 LOGFILE=scottLOG-$(date +%Y%m%d%H).log&lt;br /&gt;zip -r /home/app/oracle/admin/orcl/dpdump/scott-$(date +%Y%m%d%H).zip /home/app/oracle/admin/orcl/dpdump/scott-$(date +%Y%m%d%H).dmp&lt;br /&gt;cat /home/app/oracle/admin/orcl/dpdump/scottLOG-$(date +%Y%m%d%H).log | mutt -s "scott Backup" -a /home/app/oracle/admin/orcl/dpdump/scott-$(date +%Y%m%d%H).zip scott@tiger.com&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;What is in the script:&lt;br /&gt;&lt;br /&gt;&lt;div style="color: black;"&gt;In the first part of the script, we set the required environment. &lt;/div&gt;&lt;div style="color: black;"&gt;&lt;pre class="python" name="code"&gt;ORACLE_HOME=/home/app/oracle/product/11.2.0/dbhome_1&lt;br /&gt;export ORACLE_HOME&lt;br /&gt;export PATH=$ORACLE_HOME/bin:$PATH&lt;br /&gt;ORACLE_SID=orcl; export ORACLE_SID&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: black;"&gt;In the next bit, we do our export. In this case, I want to import my file into a local XE instance on my laptop so I'm going to specify VERSION=10.2. Additionally, because I will be doing this daily, I am appending the date in the form of YYYYMMDDHH to the file name:&lt;/div&gt;&lt;div style="color: black;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;pre class="python" name="code"&gt;expdp scott/tiger DIRECTORY=backdir DUMPFILE=scott-$(date +%Y%m%d%H) VERSION=10.2&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;div style="color: black;"&gt;Create a log file of our export to see if there were any issues:&lt;/div&gt;&lt;pre class="python" name="code"&gt;LOGFILE=scottLOG-$(date +%Y%m%d%H).log&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: black;"&gt;Compress the .dmp file to make it easier to mail:&lt;/div&gt;&lt;pre class="python" name="code"&gt;zip -r scott-$(date +%Y%m%d%H).zip /home/app/oracle/admin/orcl/dpdump/scott-$(date +%Y%m%d%H).dmp &lt;br /&gt;&lt;/pre&gt;&lt;div style="color: black;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: black;"&gt;Finally, we use MUTT to attach our export file to our email as well as write the log file contents to the body of the email:&lt;/div&gt;&lt;div style="color: black;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;pre class="python" name="code"&gt;cat /home/app/oracle/admin/orcl/dpdump/scottLOG-$(date +%Y%m%d%H).log |  mutt -s "Scott Backup" -a  /home/app/oracle/admin/orcl/dpdump/scott-$(date +%Y%m%d%H).zip scott@tiger.com  &lt;/pre&gt;&lt;div style="color: black;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;In the last bit above:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;cat /home/app/oracle/admin/orcl/dpdump/scottLOG-$(date +%Y%m%d%H).log writes the contents of the log file into the body of the email.&amp;nbsp;&lt;/li&gt;&lt;li&gt;"Scott Backup" is the email subject line.&lt;/li&gt;&lt;li&gt;-a  /home/app/oracle/admin/orcl/dpdump/scott-$(date +%Y%m%d%H).zip attaches our file to the email.&lt;/li&gt;&lt;li&gt;scott@tiger.com is the recipient address.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;From here, you can set a cron job to automate running the script at whatever interval you require.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;u&gt;&lt;b&gt;Now, instead of emailing the zip file, let's FTP the file to a remote server.&lt;/b&gt;&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;In this case, we want to FTP the file, so we'll need to do the following:&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Export the Scott schema on a daily basis using Data Pump.&lt;/li&gt;&lt;li&gt;Create a log file of the Data Pump export &lt;/li&gt;&lt;li&gt;Add the date and hour of the export to to the file name and log file  in the forms of : scott-yyyymmddhh.dmp. and scottLOG-yyyymmddhh.log&lt;/li&gt;&lt;li&gt;Use zip or gzip to compress the dump file for easier FTP&lt;/li&gt;&lt;li&gt;Write the contents of the log file into the body of an email notification.&lt;/li&gt;&lt;li&gt;FTP the file.&lt;/li&gt;&lt;/ol&gt;&lt;u&gt;&lt;b&gt; &lt;/b&gt;&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="python" name="code"&gt;#!/bin/sh&lt;br /&gt;ORACLE_HOME=/home/app/oracle/product/11.2.0/dbhome_1&lt;br /&gt;export ORACLE_HOME&lt;br /&gt;export PATH=$ORACLE_HOME/bin:$PATH&lt;br /&gt;ORACLE_SID=orcl; export ORACLE_SID&lt;br /&gt;HOST='192.168.0.2'&lt;br /&gt;USER='ftpuser'&lt;br /&gt;PASSWD='password'&lt;br /&gt;expdp scott/tiger DIRECTORY=backdir DUMPFILE=scott-$(date +%Y%m%d%H) VERSION=10.2 LOGFILE=scottLOG-$(date +%Y%m%d%H).log&lt;br /&gt;zip -r /home/app/oracle/admin/orcl/dpdump/scott-$(date +%Y%m%d%H).zip /home/app/oracle/admin/orcl/dpdump/scott-$(date +%Y%m%d%H).dmp&lt;br /&gt;cat /home/app/oracle/admin/orcl/dpdump/scottLOG-$(date +%Y%m%d%H).log | mutt -s "scott Backup" scott@tiger.com&lt;br /&gt;cd /home/app/oracle/admin/orcl/dpdump&lt;br /&gt;ftp -n -v $HOST &amp;lt;&amp;lt; EOT&lt;br /&gt;binary&lt;br /&gt;user $USER $PASSWD&lt;br /&gt;prompt&lt;br /&gt;put scott-$(date +%Y%m%d%H).zip&lt;br /&gt;bye&lt;br /&gt;EOT&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;What is in the script:  &lt;br /&gt;&lt;div style="color: black;"&gt;&lt;br /&gt;In the first part of the script, we set the required environment. &lt;/div&gt;&lt;div style="color: black;"&gt;&lt;pre class="python" name="code"&gt;ORACLE_HOME=/home/app/oracle/product/11.2.0/dbhome_1&lt;br /&gt;export ORACLE_HOME&lt;br /&gt;export PATH=$ORACLE_HOME/bin:$PATH&lt;br /&gt;ORACLE_SID=orcl; export ORACLE_SID&amp;nbsp;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Next, we set our FTP information:&lt;br /&gt;&lt;pre class="python" name="code"&gt;HOST='192.168.0.2'&lt;br /&gt;USER='ftpuser'&lt;br /&gt;PASSWD='password'&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: black;"&gt;&lt;b&gt;&lt;/b&gt;&lt;br /&gt;In the next bit, we do our export. Again, I want to import my file into a local XE instance on my laptop so I'm going to specify VERSION=10.2. Additionally, because I will be doing this daily, I am appending the date in the form of YYYYMMDDHH to the file name:&lt;/div&gt;&lt;div style="color: black;"&gt;&lt;/div&gt;&lt;pre class="python" name="code"&gt;expdp scott/tiger DIRECTORY=backdir DUMPFILE=scott-$(date +%Y%m%d%H) VERSION=10.2&lt;br /&gt;&lt;/pre&gt;&lt;div style="color: black;"&gt;&lt;br /&gt;Create a log file of our export to see if there were any issues:&lt;/div&gt;&lt;pre class="python" name="code"&gt;LOGFILE=scottLOG-$(date +%Y%m%d%H).log&lt;br /&gt;&lt;/pre&gt;&lt;div style="color: black;"&gt;&lt;br /&gt;Compress the .dmp file to make it easier to FTP: &lt;/div&gt;&lt;pre class="python" name="code"&gt;zip -r scott-$(date +%Y%m%d%H).zip /home/app/oracle/admin/orcl/dpdump/scott-$(date +%Y%m%d%H).dmp &lt;br /&gt;&lt;/pre&gt;&lt;div style="color: black;"&gt;&lt;/div&gt;&lt;div style="color: black;"&gt;&lt;br /&gt;Now, we use MUTT to write the log file contents to the body of an email notification:&lt;/div&gt;&lt;div style="color: black;"&gt;&lt;/div&gt;&lt;pre class="python" name="code"&gt;cat /home/app/oracle/admin/orcl/dpdump/scottLOG-$(date +%Y%m%d%H).log | mutt -s "Scott Backup"&amp;nbsp; scott@tiger.com  &lt;/pre&gt;&lt;div style="color: black;"&gt;&lt;/div&gt;&lt;div style="color: black;"&gt;&lt;br /&gt;In the bit above: &lt;br /&gt;&lt;ul&gt;&lt;li&gt;cat /home/app/oracle/admin/orcl/dpdump/scottLOG-$(date +%Y%m%d%H).log writes the contents of the log file into the body of the email. &lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div style="color: black;"&gt;&lt;ul&gt;&lt;li&gt;"Scott Backup" is the email subject line. &lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div style="color: black;"&gt;&lt;ul&gt;&lt;li&gt;scott@tiger.com is the recipient address.&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Finally, we go our backup directory and FTP the file in binary mode. &lt;br /&gt;&lt;pre class="python" name="code"&gt;cd /home/app/oracle/admin/orcl/dpdump&lt;br /&gt;ftp -n -v $HOST &amp;lt;&amp;lt; EOT&lt;br /&gt;binary&lt;br /&gt;user $USER $PASSWD&lt;br /&gt;prompt&lt;br /&gt;put scott-$(date +%Y%m%d%H).zip&lt;br /&gt;bye&lt;br /&gt;EOT&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Again, you now create a cron job to automate running the script at whatever interval you require.&lt;br /&gt;&lt;br /&gt;&lt;u&gt;&lt;b&gt;What if I want to use tar/gzip instead of zip?&lt;/b&gt;&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;Simply make the substitutions as below:&lt;br /&gt;&lt;pre class="python" name="code"&gt;#!/bin/sh&lt;br /&gt;ORACLE_HOME=/home/app/oracle/product/11.2.0/dbhome_1&lt;br /&gt;export ORACLE_HOME&lt;br /&gt;export PATH=$ORACLE_HOME/bin:$PATH&lt;br /&gt;ORACLE_SID=orcl; export ORACLE_SID&lt;br /&gt;HOST='192.168.0.2'&lt;br /&gt;USER='ftpuser'&lt;br /&gt;PASSWD='password'&lt;br /&gt;expdp scott/tiger DIRECTORY=backdir DUMPFILE=scott-$(date +%Y%m%d%H) VERSION=10.2 LOGFILE=scottLOG-$(date +%Y%m%d%H).log &lt;br /&gt;tar -cvzf /home/app/oracle/admin/orcl/dpdump/scott-$(date +%Y%m%d%H).tar.gz home/app/oracle/admin/orcl/dpdump/scott-$(date +%Y%m%d%H).dmp&lt;br /&gt;cat /home/app/oracle/admin/orcl/dpdump/scottLOG-$(date +%Y%m%d%H).log | mutt -s "scott Backup" scott@tiger.com&lt;br /&gt;cd /home/app/oracle/admin/orcl/dpdump&lt;br /&gt;ftp -n -v $HOST &amp;lt;&amp;lt; EOT&lt;br /&gt;binary&lt;br /&gt;user $USER $PASSWD&lt;br /&gt;prompt&lt;br /&gt;put scott-$(date +%Y%m%d%H).tar.gz&lt;br /&gt;bye&lt;br /&gt;EOT&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;ul&gt;&lt;/ul&gt;You can also execute it on-demand as well via command line:  [root@server1]# cd /usr/lib/myscripts [root@server1]# . /scottscript.sh&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.oracle-base.com/articles/10g/OracleDataPump10g.php" target="_blank"&gt;More About Oracle Datapump &lt;/a&gt;&lt;br /&gt;&lt;ul&gt;&lt;/ul&gt;&lt;a href="http://www.mutt.org/" target="_blank"&gt;More about MUTT&lt;/a&gt;&lt;/div&gt;&lt;div style="color: black;"&gt;&lt;/div&gt;&lt;div style="color: black;"&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.enciva.com/hosting-oracle-apex.htm" target="_blank"&gt;&lt;img border="0" src="http://www.davidghedini.com/images/banners/EncivaOracleHosting.png" alt="Oracle APEX Hosting" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4739427765174521248-2188955673475744918?l=davidghedini.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://davidghedini.blogspot.com/feeds/2188955673475744918/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4739427765174521248&amp;postID=2188955673475744918&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/2188955673475744918'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/2188955673475744918'/><link rel='alternate' type='text/html' href='http://davidghedini.blogspot.com/2010/05/bash-script-for-oracle-data-pump-export.html' title='Bash Script for Oracle Data Pump Export (with FTP and Email)'/><author><name>David Ghedini</name><uri>http://www.blogger.com/profile/17216036360922714725</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='20' src='http://3.bp.blogspot.com/_9kl8kmes6FE/TRZtxgi0R0I/AAAAAAAAAGY/plAxLyonZ_U/S220/TheWholeGang.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4739427765174521248.post-453593420503674367</id><published>2009-12-19T17:17:00.000-08:00</published><updated>2010-07-03T13:19:17.929-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CentOS'/><category scheme='http://www.blogger.com/atom/ns#' term='Grub'/><category scheme='http://www.blogger.com/atom/ns#' term='PAE'/><title type='text'>Install PAE Kernel and Update Grub CentOS 5.x</title><content type='html'>On my new 32-bit CentOS 5.3 server with 4GIG of RAM only 3+ GIG are visible:&lt;br /&gt;&lt;br /&gt;[root@server1 ~]# free -m&lt;br /&gt;total used free shared buffers cached&lt;br /&gt;Mem: 3280 275 3005 0 15 106&lt;br /&gt;-/+ buffers/cache: 154 3126&lt;br /&gt;Swap: 1788 0 1788&lt;br /&gt;[root@server1 ~]# top&lt;br /&gt;top - 19:19:01 up 4 min, 1 user, load average: 0.07, 0.27, 0.14&lt;br /&gt;Tasks: 117 total, 2 running, 115 sleeping, 0 stopped, 0 zombie&lt;br /&gt;Cpu(s): 0.0%us, 0.0%sy, 0.0%ni, 99.8%id, 0.2%wa, 0.0%hi, 0.0%si, 0.0%st&lt;br /&gt;Mem: 3359720k total, 282788k used, 3076932k free, 15580k buffers&lt;br /&gt;Swap: 1831400k total, 0k used, 1831400k free, 108888k cached &lt;br /&gt;&lt;br /&gt;For x86 systems that support PAE, you will need to install the kernel-PAE package to see your RAM.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://wiki.centos.org/FAQ/CentOS5#head-d70935212ce3b7b072b0075c1807a4bd3ea175b7" target="_blank"&gt;From CentOS 5 FAQ:&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;kernel-PAE (x86-only): Contains a kernel with support for 64GB of memory on x86 systems through Physical Address Extensions (PAE). Only x86 CPUs that support PAE can run this kernel. This kernel is provided because x86 systems can't address more than 4GB of memory without PAE extensions.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;1. Install kernel-PAE:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;[root@server1 ~]# yum install kernel-PAE&lt;br /&gt;&lt;br /&gt;&lt;b&gt;2. Update grub.conf to boot from PAE kernel.&lt;/b&gt; After installing, vi /boot/grub/grub.conf and look for the line "default=..". &lt;br /&gt;&lt;br /&gt;The value determines the default boot kernel and the sequence begins with 0. Review the kernel titles and update the default to the PAE kernel you installed (0 in my case below) and :wq&lt;br /&gt;&lt;br /&gt;[root@server1 ~]# vi /boot/grub/grub.conf&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="python"&gt;grub.conf generated by anaconda&lt;br /&gt;#&lt;br /&gt;# Note that you do not have to rerun grub after making changes to this file&lt;br /&gt;# NOTICE:  You do not have a /boot partition.  This means that&lt;br /&gt;#          all kernel and initrd paths are relative to /, eg.&lt;br /&gt;#          root (hd0,0)&lt;br /&gt;#          kernel /boot/vmlinuz-version ro root=/dev/md0&lt;br /&gt;#          initrd /boot/initrd-version.img&lt;br /&gt;#boot=/dev/md0&lt;br /&gt;&lt;b&gt;default=0&lt;/b&gt;&lt;br /&gt;timeout=5&lt;br /&gt;splashimage=(hd0,0)/boot/grub/splash.xpm.gz&lt;br /&gt;hiddenmenu&lt;br /&gt;&lt;b&gt;title CentOS (2.6.18-164.9.1.el5PAE)&lt;/b&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; root (hd0,0)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; kernel /boot/vmlinuz-2.6.18-164.9.1.el5PAE ro root=/dev/md0&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; initrd /boot/initrd-2.6.18-164.9.1.el5PAE.img&lt;br /&gt;title CentOS (2.6.18-8.el5)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; root (hd0,0)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; kernel /boot/vmlinuz-2.6.18-8.el5 ro root=/dev/md0&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; initrd /boot/initrd-2.6.18-8.el5.img&lt;br /&gt;~&lt;br /&gt;~&lt;br /&gt;"/boot/grub/grub.conf" 21L, 742C&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;3. Reboot and check:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;[root@server1 ~]# free -m&lt;br /&gt;total       used       free     shared    buffers     cached&lt;br /&gt;Mem:          4042        955       3087          0        175        583&lt;br /&gt;-/+ buffers/cache:        196       3846&lt;br /&gt;Swap:         4000          0       4000&lt;br /&gt;[root@server1 ~]# top&lt;br /&gt;top - 01:04:22 up 2 days,  2:34,  1 user,  load average: 0.05, 0.16, 0.15&lt;br /&gt;Tasks: 121 total,   1 running, 120 sleeping,   0 stopped,   0 zombie&lt;br /&gt;Cpu(s):  6.1%us,  9.2%sy,  0.0%ni, 68.1%id,  0.8%wa,  0.4%hi, 15.3%si,  0.0%st&lt;br /&gt;Mem:   4139764k total,   978236k used,  3161528k free,   179280k buffers&lt;br /&gt;Swap:  4096440k total,        0k used,  4096440k free,   597708k cached&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4739427765174521248-453593420503674367?l=davidghedini.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://davidghedini.blogspot.com/feeds/453593420503674367/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4739427765174521248&amp;postID=453593420503674367&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/453593420503674367'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/453593420503674367'/><link rel='alternate' type='text/html' href='http://davidghedini.blogspot.com/2009/12/install-pae-kernel-and-update-grub.html' title='Install PAE Kernel and Update Grub CentOS 5.x'/><author><name>David Ghedini</name><uri>http://www.blogger.com/profile/17216036360922714725</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='20' src='http://3.bp.blogspot.com/_9kl8kmes6FE/TRZtxgi0R0I/AAAAAAAAAGY/plAxLyonZ_U/S220/TheWholeGang.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4739427765174521248.post-3130456915608088368</id><published>2009-10-18T15:25:00.000-07:00</published><updated>2009-10-18T15:40:36.715-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='iReport'/><category scheme='http://www.blogger.com/atom/ns#' term='Jasper Reports'/><category scheme='http://www.blogger.com/atom/ns#' term='Union Query'/><title type='text'>Jasper Reports Create a Union Query in iReport</title><content type='html'>This is a simple, step by step guide to creating a union query using Jasper's iReport.&lt;br /&gt;&lt;br /&gt;For my sample, I am using a single table, "BookList", that contains data for a local library.&lt;br /&gt;&lt;br /&gt;In my sample table, regular book titles have an ISBN number, but the library also has unpublished material that have an internal reference number called "LocalFileNumber". &lt;br /&gt;&lt;br /&gt;For my Union Query, I want to select from this table the Author, Title, ISBN &lt;i&gt;if available&lt;/i&gt;, and LocalFileNumber &lt;i&gt;where ISBN is null&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Here is my sample data:&lt;br /&gt;&lt;br /&gt;-- --------------------------------------------------------&lt;br /&gt;&lt;br /&gt;--&lt;br /&gt;-- Table structure for table `BookList`&lt;br /&gt;--&lt;br /&gt;&lt;br /&gt;CREATE TABLE IF NOT EXISTS `BookList` (&lt;br /&gt;`id` int(11) NOT NULL auto_increment,&lt;br /&gt;`Author` varchar(50) default NULL,&lt;br /&gt;`Title` varchar(50) default NULL,&lt;br /&gt;`ISBN` varchar(50) default NULL,&lt;br /&gt;`LocalFileNumber` varchar(50) default NULL,&lt;br /&gt;PRIMARY KEY  (`id`)&lt;br /&gt;) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;&lt;br /&gt;&lt;br /&gt;--&lt;br /&gt;-- Data for table `BookList`&lt;br /&gt;--&lt;br /&gt;&lt;br /&gt;INSERT INTO `BookList` (`id`, `Author`, `Title`, `ISBN`, `LocalFileNumber`) VALUES&lt;br /&gt;(1, 'Henry James', 'The Portrait of a Lady', '0141439637', NULL),&lt;br /&gt;(2, 'T.S. Eliot', 'Collected Poems', '0151189781', NULL),&lt;br /&gt;(3, 'William Gaddis', 'The Recognitions', '0844667404', NULL),&lt;br /&gt;(4, 'John Smith', 'History of Our Library', NULL, 'JS12345678'),&lt;br /&gt;(5, 'James Merrill', 'The Changing Light at Sandover', '0307263215', NULL),&lt;br /&gt;(6, 'Wendy Jones', 'Library Policy Manual', NULL, 'WJ12345678');&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;So, we have 4 titles with ISBN numbers, and 2 titles that use the libraries internal reference number (highlighted in bold below):&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;mysql&amp;gt; select * from BookList;&lt;br /&gt;+----+----------------+--------------------------------+------------+-----------&lt;br /&gt;------+&lt;br /&gt;| id | Author&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | Title&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | ISBN&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | LocalFileNumber |&lt;br /&gt;+----+----------------+--------------------------------+------------+-----------&lt;br /&gt;------+&lt;br /&gt;|&amp;nbsp; 1 | Henry James&amp;nbsp;&amp;nbsp;&amp;nbsp; | The Portrait of a Lady&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | 0141439637 | NULL&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&lt;br /&gt;|&amp;nbsp; 2 | T.S. Eliot&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | Collected Poems&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | 0151189781 | NULL&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&lt;br /&gt;|&amp;nbsp; 3 | William Gaddis | The Recognitions&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | 0844667404 | NULL&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&lt;br /&gt;|&amp;nbsp; &lt;b&gt;4 | John Smith&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | History of Our Library&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | NULL&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | JS12345678&lt;/b&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&lt;br /&gt;|&amp;nbsp; 5 | James Merrill&amp;nbsp; | The Changing Light at Sandover | 0307263215 | NULL&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&lt;br /&gt;|&amp;nbsp; &lt;b&gt;6 | Wendy Jones&amp;nbsp;&amp;nbsp;&amp;nbsp; | Library Policy Manual&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | NULL&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | WJ12345678&lt;/b&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&lt;br /&gt;+----+----------------+--------------------------------+------------+-----------&lt;br /&gt;------+&lt;br /&gt;6 rows in set (0.00 sec)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;1. Start up iReport and create your connection.&lt;br /&gt;&lt;br /&gt;2. At the Query section, add the 'BookList' table into the viewer and select Author, Title, and IBSN:&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_9kl8kmes6FE/StpOdM2eEgI/AAAAAAAAACE/H0jVjwZmYmI/s1600-h/2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_9kl8kmes6FE/StpOdM2eEgI/AAAAAAAAACE/H0jVjwZmYmI/s400/2.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;3.&amp;nbsp; Right click on WHERE and select Add a Condition: &lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&amp;nbsp;&lt;a href="http://4.bp.blogspot.com/_9kl8kmes6FE/StpOoGpnxTI/AAAAAAAAACM/BW51bhCtcE8/s1600-h/3.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_9kl8kmes6FE/StpOoGpnxTI/AAAAAAAAACM/BW51bhCtcE8/s400/3.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;4. The WHERE clause in our first select will be ISBN IS NOT NULL&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_9kl8kmes6FE/StpOqXyGB-I/AAAAAAAAACU/ov0gBU1c3wQ/s1600-h/4.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_9kl8kmes6FE/StpOqXyGB-I/AAAAAAAAACU/ov0gBU1c3wQ/s400/4.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;5. Now that we have our first select with our WHERE clause, right click on ROOTQUERY and select UNION &lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&amp;nbsp;&lt;a href="http://4.bp.blogspot.com/_9kl8kmes6FE/StpOs2r8NiI/AAAAAAAAACc/v12dxUQ3RLY/s1600-h/5.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_9kl8kmes6FE/StpOs2r8NiI/AAAAAAAAACc/v12dxUQ3RLY/s400/5.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;6. Note that the UNION node now appears in the query explorer pane (just above the ORDER BY node).&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&amp;nbsp;&lt;a href="http://2.bp.blogspot.com/_9kl8kmes6FE/StpOt4oG71I/AAAAAAAAACk/sweqaLddPqY/s1600-h/6.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_9kl8kmes6FE/StpOt4oG71I/AAAAAAAAACk/sweqaLddPqY/s400/6.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;7. Highlight the SELECT node under Union. &lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&amp;nbsp;&lt;a href="http://1.bp.blogspot.com/_9kl8kmes6FE/StpOvB4ImnI/AAAAAAAAACs/xBpqDNrhZ08/s1600-h/7.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_9kl8kmes6FE/StpOvB4ImnI/AAAAAAAAACs/xBpqDNrhZ08/s400/7.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;8. Double click on the BookList table to add it into the pane. This time we will select Author, Title, and LocalFileNumber.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_9kl8kmes6FE/StpQ0gaZH5I/AAAAAAAAAC0/d_llsfNF53I/s1600-h/8.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_9kl8kmes6FE/StpQ0gaZH5I/AAAAAAAAAC0/d_llsfNF53I/s400/8.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;9. Right click on the WHERE node for the query and select Add Condition:&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_9kl8kmes6FE/StpQ2RNZWOI/AAAAAAAAAC8/F2NwShS0raE/s1600-h/9.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_9kl8kmes6FE/StpQ2RNZWOI/AAAAAAAAAC8/F2NwShS0raE/s400/9.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;9. For our condition on this select, we will now enter WHERE ISBN IS NULL&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_9kl8kmes6FE/StpQ4eG3L2I/AAAAAAAAADE/w63Y4zXToMw/s1600-h/10.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_9kl8kmes6FE/StpQ4eG3L2I/AAAAAAAAADE/w63Y4zXToMw/s400/10.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;10. Expand all of the relevant nodes so we can see our query:&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_9kl8kmes6FE/StpSSXHvOVI/AAAAAAAAADM/faLwXz7k8Ug/s1600-h/11.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_9kl8kmes6FE/StpSSXHvOVI/AAAAAAAAADM/faLwXz7k8Ug/s400/11.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;11. Now, at the bottom of the Query Builder, select the SQL tab:&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_9kl8kmes6FE/StpSUuU_eUI/AAAAAAAAADU/ADbVpkP8mP4/s1600-h/12.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_9kl8kmes6FE/StpSUuU_eUI/AAAAAAAAADU/ADbVpkP8mP4/s400/12.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;12. From here, we can edit our query so that both ISBN from the first select and LocalFileNumber from the second select are selected as "BookCode" as shown below: &lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_9kl8kmes6FE/StpTGJLBDNI/AAAAAAAAADc/7kZ8tC9d70k/s1600-h/13.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_9kl8kmes6FE/StpTGJLBDNI/AAAAAAAAADc/7kZ8tC9d70k/s400/13.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;SELECT&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; booklist.`Author` AS booklist_Author,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; booklist.`Title` AS booklist_Title,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; booklist.`ISBN` AS BookCode&lt;br /&gt;FROM&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; `booklist` booklist&lt;br /&gt;WHERE&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ISBN IS NOT NULL&lt;br /&gt;UNION&lt;br /&gt;SELECT&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; booklist.`Author` AS booklist_Author,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; booklist.`Title` AS booklist_Title,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; booklist.`LocalFileNumber` AS&amp;nbsp; BookCode&lt;br /&gt;FROM&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; `booklist` booklist&lt;br /&gt;WHERE&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ISBN IS NULL &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;So we now have a query that will return Author, Title, and BookCode (ISBN or LocalFileNumber when ISBN is null).&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;One item you may note above is that we did not need to qualify our alias BookCode with quotation marks. &lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;13. Click OK and review your query:&amp;nbsp; &lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_9kl8kmes6FE/StpTIftU_1I/AAAAAAAAADk/wG3esuU0cc0/s1600-h/14.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_9kl8kmes6FE/StpTIftU_1I/AAAAAAAAADk/wG3esuU0cc0/s320/14.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4739427765174521248-3130456915608088368?l=davidghedini.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://davidghedini.blogspot.com/feeds/3130456915608088368/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4739427765174521248&amp;postID=3130456915608088368&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/3130456915608088368'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/3130456915608088368'/><link rel='alternate' type='text/html' href='http://davidghedini.blogspot.com/2009/10/jasper-reports-create-union-query-in.html' title='Jasper Reports Create a Union Query in iReport'/><author><name>David Ghedini</name><uri>http://www.blogger.com/profile/17216036360922714725</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='20' src='http://3.bp.blogspot.com/_9kl8kmes6FE/TRZtxgi0R0I/AAAAAAAAAGY/plAxLyonZ_U/S220/TheWholeGang.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_9kl8kmes6FE/StpOdM2eEgI/AAAAAAAAACE/H0jVjwZmYmI/s72-c/2.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4739427765174521248.post-6468189584796776238</id><published>2009-10-18T15:21:00.000-07:00</published><updated>2009-10-18T15:38:54.449-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='Union Query'/><title type='text'>PHP MySQL Union Query</title><content type='html'>Union Query with PHP and MySQL&lt;br /&gt;&lt;br /&gt;For deailed explanation of MySQL sample data and logic, &lt;a href="http://davidghedini.blogspot.com/2009/10/jasper-reports-create-union-query-in.html" target="_balnk"&gt;please see my Jasper Reports Query post&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;-- --------------------------------------------------------&lt;br /&gt;&lt;br /&gt;--&lt;br /&gt;-- Table structure for table `BookList`&lt;br /&gt;--&lt;br /&gt;&lt;br /&gt;CREATE TABLE IF NOT EXISTS `BookList` (&lt;br /&gt;`id` int(11) NOT NULL auto_increment,&lt;br /&gt;`Author` varchar(50) default NULL,&lt;br /&gt;`Title` varchar(50) default NULL,&lt;br /&gt;`ISBN` varchar(50) default NULL,&lt;br /&gt;`LocalFileNumber` varchar(50) default NULL,&lt;br /&gt;PRIMARY KEY  (`id`)&lt;br /&gt;) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;&lt;br /&gt;&lt;br /&gt;--&lt;br /&gt;-- Data for table `BookList`&lt;br /&gt;--&lt;br /&gt;&lt;br /&gt;INSERT INTO `BookList` (`id`, `Author`, `Title`, `ISBN`, `LocalFileNumber`) VALUES&lt;br /&gt;(1, 'Henry James', 'The Portrait of a Lady', '0141439637', NULL),&lt;br /&gt;(2, 'T.S. Eliot', 'Collected Poems', '0151189781', NULL),&lt;br /&gt;(3, 'William Gaddis', 'The Recognitions', '0844667404', NULL),&lt;br /&gt;(4, 'John Smith', 'History of Our Library', NULL, 'JS12345678'),&lt;br /&gt;(5, 'James Merrill', 'The Changing Light at Sandover', '0307263215', NULL),&lt;br /&gt;(6, 'Wendy Jones', 'Library Policy Manual', NULL, 'WJ12345678');&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;&amp;lt;?php&lt;br /&gt;&lt;span style="color: #351c75;"&gt;$myconn&lt;/span&gt; = &lt;span style="color: blue;"&gt;mysql_connect&lt;/span&gt;(&lt;span style="color: red;"&gt;"localhost"&lt;span style="color: #666666;"&gt;,&lt;/span&gt;"username"&lt;span style="color: #666666;"&gt;,&lt;/span&gt;"password"&lt;/span&gt;);&lt;br /&gt;&lt;span style="color: #274e13;"&gt;if (!&lt;/span&gt;&lt;span style="color: #20124d;"&gt;$myconn&lt;/span&gt;&lt;span style="color: #274e13;"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &lt;span style="color: #274e13;"&gt;{&lt;/span&gt;&lt;br style="color: #274e13;" /&gt;&lt;span style="color: #274e13;"&gt;&amp;nbsp; die(&lt;span style="color: red;"&gt;'Could not connect: '&lt;/span&gt; . &lt;span style="color: #38761d;"&gt;mysql_error())&lt;/span&gt;;&lt;/span&gt;&lt;br style="color: #274e13;" /&gt;&lt;span style="color: #274e13;"&gt;&amp;nbsp; }&lt;/span&gt;&lt;br style="color: #274e13;" /&gt;&lt;br style="color: #274e13;" /&gt;&lt;span style="color: #274e13;"&gt;&lt;span style="color: blue;"&gt;mysql_select_db&lt;/span&gt;(&lt;span style="color: red;"&gt;"Books"&lt;/span&gt;, &lt;span style="color: #20124d;"&gt;$myconn&lt;/span&gt;);&lt;/span&gt;&lt;br style="color: #274e13;" /&gt;&lt;br style="color: #274e13;" /&gt;&lt;br style="color: #274e13;" /&gt;&lt;span style="color: #274e13;"&gt;&lt;span style="color: #20124d;"&gt;$result&lt;/span&gt; = &lt;span style="color: blue;"&gt;mysql_query&lt;/span&gt;&lt;/span&gt;&lt;br style="color: #274e13;" /&gt;&lt;span style="color: #274e13;"&gt;(&lt;span style="color: red;"&gt;'select Author, Title, ISBN as "BookCode" &lt;/span&gt;&lt;/span&gt;&lt;br style="color: #274e13;" /&gt;&lt;span style="color: red;"&gt;FROM BookList where ISBN is not null &lt;/span&gt;&lt;br style="color: red;" /&gt;&lt;span style="color: red;"&gt;UNION &lt;/span&gt;&lt;br style="color: red;" /&gt;&lt;span style="color: red;"&gt;select Author, Title, LocalFileNumber as "BookCode" &lt;/span&gt;&lt;br style="color: red;" /&gt;&lt;span style="color: red;"&gt;FROM BookList where ISBN is null')&lt;/span&gt;&lt;br style="color: #274e13;" /&gt;&lt;span style="color: #38761d;"&gt;or die(mysql_error());&lt;/span&gt;&lt;br style="color: #274e13;" /&gt;&lt;br style="color: #274e13;" /&gt;&lt;span style="color: #274e13;"&gt;&lt;span style="color: #38761d;"&gt;while&lt;/span&gt;(&lt;span style="color: #20124d;"&gt;$row&lt;/span&gt; = &lt;span style="color: #38761d;"&gt;mysql_fetch_array&lt;/span&gt;(&lt;span style="color: #20124d;"&gt;$result&lt;/span&gt;))&lt;/span&gt;&lt;br style="color: #274e13;" /&gt;&lt;span style="color: #274e13;"&gt;&amp;nbsp; {&lt;/span&gt;&lt;br style="color: #274e13;" /&gt;&lt;span style="color: #274e13;"&gt;&amp;nbsp; &lt;span style="color: #38761d;"&gt;echo&lt;/span&gt; &lt;span style="color: #073763;"&gt;$row&lt;/span&gt;[&lt;span style="color: red;"&gt;'Author'&lt;/span&gt;] . &lt;span style="color: red;"&gt;" "&lt;/span&gt; . &lt;span style="color: #20124d;"&gt;$row&lt;/span&gt;[&lt;span style="color: red;"&gt;'Title']&lt;/span&gt; . &lt;span style="color: red;"&gt;" "&lt;/span&gt; .&lt;span style="color: #20124d;"&gt;$row&lt;/span&gt;[&lt;span style="color: red;"&gt;'BookCode'&lt;/span&gt;];&lt;/span&gt;&lt;br style="color: #274e13;" /&gt;&lt;span style="color: #274e13;"&gt;&amp;nbsp; &lt;span style="color: #38761d;"&gt;echo&lt;/span&gt; &lt;span style="color: red;"&gt;"&amp;lt;/br&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: #274e13;"&gt;&lt;span style="color: red;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: #274e13;"&gt;&lt;span style="color: red;"&gt;"&lt;/span&gt;;&lt;/span&gt;&lt;br style="color: #274e13;" /&gt;&lt;span style="color: #274e13;"&gt;&amp;nbsp; }&lt;/span&gt;&lt;br style="color: #274e13;" /&gt;&lt;br style="color: #274e13;" /&gt;&lt;span style="color: #274e13;"&gt;&lt;span style="color: blue;"&gt;mysql_close&lt;/span&gt;(&lt;span style="color: #20124d;"&gt;$myconn&lt;/span&gt;);&lt;/span&gt;&lt;br style="color: #274e13;" /&gt;&lt;span style="color: black;"&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: black;"&gt;(and with a bit formatting.........&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: black;"&gt; &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&amp;lt;?php&lt;br /&gt;$myconn = mysql_connect("localhost","username","password");&lt;br /&gt;if (!$myconn)&lt;br /&gt;&amp;nbsp; {&lt;br /&gt;&amp;nbsp; die('Could not connect: ' . mysql_error());&lt;br /&gt;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;mysql_select_db("Books", $myconn);&lt;br /&gt;&lt;br /&gt;$result = mysql_query('select Author, Title, ISBN as "BookCode"&lt;br /&gt;FROM BookList where ISBN is not null&lt;br /&gt;UNION&lt;br /&gt;select Author, Title, LocalFileNumber as "BookCode"&lt;br /&gt;FROM BookList where ISBN is null')&lt;br /&gt;or die(mysql_error());&lt;br /&gt;&lt;br /&gt;echo "&amp;lt;table border='1'&amp;gt;&lt;br /&gt;&amp;lt;tr&amp;gt;&lt;br /&gt;&amp;lt;th&amp;gt;Author&amp;lt;/th&amp;gt;&lt;br /&gt;&amp;lt;th&amp;gt;Title&amp;lt;/th&amp;gt;&lt;br /&gt;&amp;lt;th&amp;gt;BookCode&amp;lt;/th&amp;gt;&lt;br /&gt;&amp;lt;/tr&amp;gt;";&lt;br /&gt;&lt;br /&gt;while($row = mysql_fetch_array($result))&lt;br /&gt;&amp;nbsp; {&lt;br /&gt;&amp;nbsp; echo "&amp;lt;tr&amp;gt;";&lt;br /&gt;&amp;nbsp; echo "&amp;lt;td&amp;gt;" . $row['Author'] . "&amp;lt;/td&amp;gt;";&lt;br /&gt;&amp;nbsp; echo "&amp;lt;td&amp;gt;" . $row['Title'] . "&amp;lt;/td&amp;gt;";&lt;br /&gt;&amp;nbsp; echo "&amp;lt;td&amp;gt;" . $row['BookCode'] . "&amp;lt;/td&amp;gt;";&lt;br /&gt;&amp;nbsp; echo "&amp;lt;/tr&amp;gt;";&lt;br /&gt;&amp;nbsp; }&lt;br /&gt;echo "&amp;lt;/table&amp;gt;";&lt;br /&gt;&lt;br /&gt;mysql_close($myconn);&lt;br /&gt;?&amp;gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4739427765174521248-6468189584796776238?l=davidghedini.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://davidghedini.blogspot.com/feeds/6468189584796776238/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4739427765174521248&amp;postID=6468189584796776238&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/6468189584796776238'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/6468189584796776238'/><link rel='alternate' type='text/html' href='http://davidghedini.blogspot.com/2009/10/php-mysql-union-query.html' title='PHP MySQL Union Query'/><author><name>David Ghedini</name><uri>http://www.blogger.com/profile/17216036360922714725</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='20' src='http://3.bp.blogspot.com/_9kl8kmes6FE/TRZtxgi0R0I/AAAAAAAAAGY/plAxLyonZ_U/S220/TheWholeGang.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4739427765174521248.post-2069336463853525519</id><published>2009-10-10T12:22:00.000-07:00</published><updated>2009-10-10T12:29:01.908-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CentOS'/><category scheme='http://www.blogger.com/atom/ns#' term='Install Group Office RHEL'/><category scheme='http://www.blogger.com/atom/ns#' term='Install Group Office Centos'/><category scheme='http://www.blogger.com/atom/ns#' term='Group Office'/><title type='text'>Install Group Office on CentOS 5.3</title><content type='html'>Install Group Office on CentOS 5.3&lt;br /&gt;&lt;br /&gt;Start Here: &lt;a href="http://www.group-office.com/wiki/Installation" target="_blank"&gt;http://www.group-office.com/wiki/Installation&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The server is going to be used primarily for Group Office, so I stayed with the script and unpacked the tar file to /var/www/html/groupoffice-pro-3.2.37&lt;br /&gt;&lt;br /&gt;Overall, this was fairly straight forward, with the exception of having to upgrade PHP and a some brief scrounging for some rpms.&lt;br /&gt;&lt;br /&gt;The installation package includes a test file in the root directory, gotest.php, that provides a useful summary of required items that your server is lacking. So if you don't have php configured, that should be the first order of business.&lt;br /&gt;&lt;br /&gt;One of the reasons I use CentOS whenever possible is it's stability and it's conservative approach.&lt;br /&gt;&lt;br /&gt;Unfortunately, this means that php &gt;=5.2, one of the prerequisites for Group Office, was not available from the repo.&lt;br /&gt;&lt;br /&gt;Not wanting to recompile PHP, it meant having to avail myself of Jason Litka's repository.&lt;br /&gt;&lt;br /&gt;[root@server4 ~]# rpm --import http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka&lt;br /&gt;[root@server4 ~]# vi /etc/yum.repos.d/utterramblings.repo&lt;br /&gt;[utterramblings]&lt;br /&gt;&lt;br /&gt;Enter the following and then :wq&lt;br /&gt;&lt;blockquote&gt;[utterramblings]&lt;br /&gt;name=Jason's Utter Ramblings Repo&lt;br /&gt;baseurl=http://www.jasonlitka.com/media/EL$releasever/$basearch/&lt;br /&gt;enabled=1&lt;br /&gt;gpgcheck=1&lt;br /&gt;gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka&lt;/blockquote&gt;&lt;br /&gt;[root@server4 ~]# yum update php&lt;br /&gt;[root@server4 ~]# yum update mysqlat &lt;br /&gt;&lt;br /&gt;After upgarding php, simply consult the gotest.php script to find missing prerequisites. In my case:&lt;br /&gt;&lt;br /&gt;[root@server4 ~]# yum install php-imap php-xml php-mbstring php-devel&lt;br /&gt;[root@server4 ~]# service httpd restart&lt;br /&gt;&lt;br /&gt;Install Zend Ion Cube&lt;br /&gt;&lt;br /&gt;[root@server4 ~]# wget http://downloads2.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz&lt;br /&gt;[root@server4 ~]# tar -zxvf ioncube_loaders*&lt;br /&gt;[root@server4 ~]# mv ioncube /var/www/html/ioncube&lt;br /&gt;[root@server4 ~]# service httpd restart&lt;br /&gt;&lt;br /&gt;After installing ion cube above, add the Zend extension in bold below to your php.ini file under Language Options before the Zend references:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;; Language Options ;&lt;br /&gt;;;;;;;;;;;;;;;;;;;;;&lt;br /&gt;&lt;br /&gt;; Enable the PHP scripting language engine under Apache.&lt;br /&gt;engine = On&lt;br /&gt;&lt;br /&gt;&lt;b&gt;zend_extension = /var/www/html/ioncube/ioncube_loader_lin_5.2.so&lt;/b&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Restart Apache:&lt;br /&gt;[root@server4 ~]# service httpd restart &lt;br /&gt;&lt;br /&gt;Check your php version is now updated and ion cube installed:&lt;br /&gt;&lt;br /&gt;[root@server4 ~]# php -v&lt;br /&gt;PHP 5.2.11 (cli) (built: Sep 21 2009 14:49:09)&lt;br /&gt;Copyright (c) 1997-2009 The PHP Group&lt;br /&gt;Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies&lt;br /&gt;with the ionCube PHP Loader v3.1.34, Copyright (c) 2002-2009, by ionCube Ltd.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Install libwbxml: &lt;br /&gt;&lt;br /&gt;[root@server4 ~]# rpm -Uvh http://dl.atrpms.net/all/wbxml2-0.9.2-5.el4.at.i386.rpm&lt;br /&gt;&lt;br /&gt;Install TNEF:&lt;br /&gt;&lt;br /&gt;For whatever reason, I could not pull down tnef-1.3.3-1.2.el4.rf.i386.rpm from dag.wieers.com, even searching manually.&lt;br /&gt;&lt;br /&gt;I grabbed it here: &lt;a href="http://www.rpmfind.net/linux/rpm2html/search.php?query=tnef" target="_balnk"&gt;http://www.rpmfind.net/linux/rpm2html/search.php?query=tnef&lt;/a&gt;&lt;br /&gt;saved it to temp and installed:&lt;br /&gt;&lt;br /&gt;[root@server4 ~]# cd /var/tmp&lt;br /&gt;[root@server4 ~]# rpm -Uvh tnef-1.3.3-1.2.el4.rf.i386.rpm&lt;br /&gt;&lt;br /&gt;That was about it.&lt;br /&gt;&lt;br /&gt;Once you cleared all of the gotest.php prerequisites, you can then start the installation via the home directory, which will walk you through the installation. Keep putty open as you will need to do some mkdir's as some chmod's.&lt;br /&gt;&lt;br /&gt;Add your virtual host entry in your Apache httpd.conf file.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;VirtualHost *:80&amp;gt;&lt;br /&gt;ServerAdmin david@mydomain.com&lt;br /&gt;DocumentRoot /var/www/html/groupoffice-pro-3.2.37&lt;br /&gt;ServerName mycal.mydomain.com&lt;br /&gt;ErrorLog logs/mycal.mydomain.com-error_log&lt;br /&gt;CustomLog logs/mycal.mydomain.com-access_log common&lt;br /&gt;&amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;&lt;br /&gt;Tune Apache according to requirements.&lt;br /&gt;&lt;br /&gt;I originally tested using the Community Edition, groupoffice-com-2.18-stable-21, and the procedure is identical. &lt;br /&gt;&lt;br /&gt;If you will be using the CE, the items you can skip are indicated in the gotest.php file.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4739427765174521248-2069336463853525519?l=davidghedini.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://davidghedini.blogspot.com/feeds/2069336463853525519/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4739427765174521248&amp;postID=2069336463853525519&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/2069336463853525519'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/2069336463853525519'/><link rel='alternate' type='text/html' href='http://davidghedini.blogspot.com/2009/10/install-group-office-on-centos-53.html' title='Install Group Office on CentOS 5.3'/><author><name>David Ghedini</name><uri>http://www.blogger.com/profile/17216036360922714725</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='20' src='http://3.bp.blogspot.com/_9kl8kmes6FE/TRZtxgi0R0I/AAAAAAAAAGY/plAxLyonZ_U/S220/TheWholeGang.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4739427765174521248.post-2663737050462414823</id><published>2009-09-30T00:08:00.000-07:00</published><updated>2009-09-30T00:13:10.734-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JasperServer'/><category scheme='http://www.blogger.com/atom/ns#' term='Install Jasper'/><category scheme='http://www.blogger.com/atom/ns#' term='Jasper Reports'/><title type='text'>Install JasperServer 3.5 on CentOS 5.3</title><content type='html'>Using the bin installer, this could not have been easier.&lt;br /&gt;&lt;br /&gt;The JasperServer 3.5 bin installer allows you the option of installing with the bundled MySQL and Tomcat server or use your own.&lt;br /&gt;&lt;br /&gt;I used my own and also left off the optional iReport installation as I have iReport on my XP.&lt;br /&gt;&lt;br /&gt;The last option is to install the sample data. &lt;br /&gt;&lt;br /&gt;Just chmod 755 the installer and install:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;-bash-3.2# chmod 755 jasperserver-3.5.0-linux-installer.bin&lt;br /&gt;-bash-3.2# ./jasperserver-3.5.0-linux-installer.bin&lt;br /&gt;----------------------------------------------------------------------------&lt;br /&gt;Welcome to the JasperServer 3.5.0 Setup Wizard.&lt;br /&gt;&lt;br /&gt;----------------------------------------------------------------------------&lt;br /&gt;Please read the following License Agreement. You must accept the terms of this&lt;br /&gt;agreement before continuing with the installation.&lt;br /&gt;&lt;br /&gt;Press [Enter] to continue :&lt;br /&gt;&lt;br /&gt;NOTICE TO USER:&lt;br /&gt;&lt;br /&gt;PLEASE READ THIS AGREEMENT CAREFULLY. BY DOWNLOADING,&lt;br /&gt;COPYING, INSTALLING OR USING ALL OR ANY PORTION&lt;br /&gt;OF THIS PROGRAM YOU ACCEPT ALL THE TERMS AND CONDITIONS&lt;br /&gt;OF THIS AGREEMENT, INCLUDING WITHOUT LIMITATION THE GNU&lt;br /&gt;GENERAL PUBLIC LICENSE VERSION 2. YOU AGREE THAT THIS AGREEMENT&lt;br /&gt;IS LIKE ANY WRITTEN NEGOTIATED AGREEMENT SIGNED BY YOU.&lt;br /&gt;THIS AGREEMENT IS ENFORCEABLE AGAINST YOU AND ANY LEGAL ENTITY&lt;br /&gt;THAT OBTAINED THIS PROGRAM AND ON WHOSE BEHALF IT IS USED: FOR&lt;br /&gt;EXAMPLE, IF APPLICABLE, YOUR EMPLOYER.  IF YOU DO NOT AGREE TO&lt;br /&gt;THE TERMS OF THIS AGREEMENT, DO NOT USE THIS PROGRAM. VISIT&lt;br /&gt;http://www.jaspersoft.com AND http://www.gnu.org/licenses/ FOR&lt;br /&gt;TERMS AND CONDITIONS.&lt;br /&gt;&lt;br /&gt;IF YOU HAVE PURCHASED A COMMERCIAL LICENSE AGREEMENT FROM&lt;br /&gt;JASPERSOFT, YOU MAY HAVE ANOTHER WRITTEN AGREEMENT DIRECTLY WITH&lt;br /&gt;JASPERSOFT THAT SUPERSEDES ALL OR PORTIONS OF THIS AGREEMENT.&lt;br /&gt;&lt;br /&gt;JASPERSOFT PERMITS YOU TO DOWNLOAD, COPY, INSTALL, USE, OR&lt;br /&gt;OTHERWISE BENEFIT FROM THE FUNCTIONALITY OR INTELLECTUAL PROPERTY&lt;br /&gt;OF THIS PROGRAM ONLY IN ACCORDANCE WITH THE TERMS OF THIS&lt;br /&gt;Press [Enter] to continue :&lt;br /&gt;AGREEMENT.  USE OF SOME THIRD PARTY MATERIALS AND SERVICES&lt;br /&gt;INCLUDED IN OR ACCESSED THROUGH THIS PROGRAM MAY BE SUBJECT TO&lt;br /&gt;OTHER TERMS AND CONDITIONS TYPICALLY FOUND IN A SEPARATE LICENSE&lt;br /&gt;AGREEMENT, TERMS OF USE OR "READ ME" FILE LOCATED WITHIN OR NEAR&lt;br /&gt;SUCH MATERIALS AND SERVICES.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Copyright (C) 2005 - 2009 Jaspersoft Corporation.  All rights&lt;br /&gt;reserved.&lt;br /&gt;&lt;br /&gt;Unless you have purchased a commercial license agreement from&lt;br /&gt;Jaspersoft, the following license terms apply:&lt;br /&gt;&lt;br /&gt;This program is free software; you can redistribute it and/or&lt;br /&gt;modify it under the terms of the GNU General Public License&lt;br /&gt;version 2 as published by the Free Software Foundation.&lt;br /&gt;&lt;br /&gt;This program is distributed in the hope that it will be useful,&lt;br /&gt;but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU&lt;br /&gt;General Public License version 2 for more details.&lt;br /&gt;&lt;br /&gt;You can view a complete copy of the GNU General Public License at&lt;br /&gt;Press [Enter] to continue :&lt;br /&gt;http://www.gnu.org/licenses/.  You also should receive a copy of&lt;br /&gt;the GNU General Public License version 2 along with the program;&lt;br /&gt;if not, write to the Free Software Foundation, Inc., 51 Franklin&lt;br /&gt;Street, Fifth Floor, Boston, MA 02110-1301 USA.&lt;br /&gt;&lt;br /&gt;Contact Jaspersoft Corporation&lt;br /&gt;539 Bryant Street, Suite 100&lt;br /&gt;San Francisco, CA 94107&lt;br /&gt;Web: www.jaspersoft.com&lt;br /&gt;General Inquiries: info@jaspersoft.com&lt;br /&gt;Sales Inquiries: sales@jaspersoft.com&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Press [Enter] to continue :&lt;br /&gt;&lt;br /&gt;Do you accept this license? [y/n]: y&lt;br /&gt;&lt;br /&gt;----------------------------------------------------------------------------&lt;br /&gt;Installation Directory&lt;br /&gt;&lt;br /&gt;Please specify the directory where JasperServer 3.5.0 will be installed.&lt;br /&gt;&lt;br /&gt;Installation directory: [/opt/jasperserver-3.5.0]:&lt;br /&gt;&lt;br /&gt;----------------------------------------------------------------------------&lt;br /&gt;Please select the Tomcat configuration you wish to use&lt;br /&gt;&lt;br /&gt;Tomcat installation:&lt;br /&gt;&lt;br /&gt;[1] I wish to use the bundled Tomcat&lt;br /&gt;[2] I wish to use an existing Tomcat&lt;br /&gt;Please choose an option [1] : 2&lt;br /&gt;&lt;br /&gt;----------------------------------------------------------------------------&lt;br /&gt;Database Installation&lt;br /&gt;&lt;br /&gt;Please select which database configuration you wish to use:&lt;br /&gt;&lt;br /&gt;[1] I wish to use the bundled MySQL database&lt;br /&gt;[2] I wish to use an existing MySQL database&lt;br /&gt;Please choose an option [1] : 2&lt;br /&gt;&lt;br /&gt;Setup will try to install new databases and will overwrite any existing duplicate. Do you wish you continue? [Y/n]: Y&lt;br /&gt;&lt;br /&gt;----------------------------------------------------------------------------&lt;br /&gt;Tomcat Directory&lt;br /&gt;&lt;br /&gt;Please specify the directory where Tomcat is located.&lt;br /&gt;&lt;br /&gt;Tomcat directory: [/opt/jasperserver-3.5.0/apache-tomcat]: /usr/share/apache-tomcat-6.0.18&lt;br /&gt;&lt;br /&gt;----------------------------------------------------------------------------&lt;br /&gt;Install Sample Data&lt;br /&gt;&lt;br /&gt;Would you like to install sample databases and sample reports?&lt;br /&gt;&lt;br /&gt; [Y/n]: Y&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;----------------------------------------------------------------------------&lt;br /&gt;Install iReport&lt;br /&gt;&lt;br /&gt;The iReport application is a graphical designer for JasperReports.&lt;br /&gt;iReport connects to JasperServer to upload and download reports.&lt;br /&gt;&lt;br /&gt;Would you like to install iReport?&lt;br /&gt;&lt;br /&gt; [Y/n]: n&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;----------------------------------------------------------------------------&lt;br /&gt;MySQL Information&lt;br /&gt;&lt;br /&gt;Please enter your MySQL database information.&lt;br /&gt;&lt;br /&gt;MySQL Binary Directory: [/opt/jasperserver-3.5.0/mysql/bin]: /usr/bin&lt;br /&gt;&lt;br /&gt;Port: [3306]:&lt;br /&gt;&lt;br /&gt;IP/Hostname Value Used:        127.0.0.1&lt;br /&gt;&lt;br /&gt;----------------------------------------------------------------------------&lt;br /&gt;MySQL Credentials&lt;br /&gt;&lt;br /&gt;Please enter your MySQL database credentials.&lt;br /&gt;&lt;br /&gt;Please enter your database root username:&lt;br /&gt;&lt;br /&gt;Username: [root]: root&lt;br /&gt;&lt;br /&gt;Please enter your database root user password:&lt;br /&gt;&lt;br /&gt;Password: :&lt;br /&gt;Re-enter password: :&lt;br /&gt;The following JasperServer database user will be created: jasperdb/password&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;----------------------------------------------------------------------------&lt;br /&gt;Setup is now ready to begin installing JasperServer 3.5.0 on your computer.&lt;br /&gt;&lt;br /&gt;Do you want to continue? [Y/n]: Y&lt;br /&gt;&lt;br /&gt;----------------------------------------------------------------------------&lt;br /&gt;Please wait while Setup installs JasperServer 3.5.0 on your computer.&lt;br /&gt;&lt;br /&gt; Installing&lt;br /&gt; 0% ______________ 50% ______________ 100%&lt;br /&gt; ########################################Info: Please shut down your application server and press OK to continue.&lt;br /&gt;Press [Enter] to continue :&lt;br /&gt;#&lt;br /&gt;&lt;br /&gt;----------------------------------------------------------------------------&lt;br /&gt;Setup has finished installing JasperServer 3.5.0 on your computer.&lt;br /&gt;&lt;br /&gt;Opt-in for JasperServer Heartbeat.&lt;br /&gt;Please help us build better products by Opting-in to the Heartbeat.&lt;br /&gt;&lt;br /&gt;By allowing the Heartbeat to collect data, you confirm consent,&lt;br /&gt;where relevant, from all individual users in your organization.&lt;br /&gt;&lt;br /&gt;Please refer to: www.jaspersoft.com/heartbeat&lt;br /&gt;&lt;br /&gt; [Y/n]: &lt;br /&gt;&lt;br /&gt;-bash-3.2#&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;One initial issue I ran into was SMTP authentication errors when using the scheduler.&lt;br /&gt;&lt;br /&gt;Thankfully, this post:&lt;br /&gt;&lt;br /&gt;http://jasperforge.org/plugins/espforum/view.php?group_id=112&amp;forumid=102&amp;topicid=60508&lt;br /&gt;&lt;br /&gt;got me sorted out.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4739427765174521248-2663737050462414823?l=davidghedini.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://davidghedini.blogspot.com/feeds/2663737050462414823/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4739427765174521248&amp;postID=2663737050462414823&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/2663737050462414823'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/2663737050462414823'/><link rel='alternate' type='text/html' href='http://davidghedini.blogspot.com/2009/09/install-jasperserver-35-on-centos-53.html' title='Install JasperServer 3.5 on CentOS 5.3'/><author><name>David Ghedini</name><uri>http://www.blogger.com/profile/17216036360922714725</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='20' src='http://3.bp.blogspot.com/_9kl8kmes6FE/TRZtxgi0R0I/AAAAAAAAAGY/plAxLyonZ_U/S220/TheWholeGang.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4739427765174521248.post-1256389130832900363</id><published>2009-09-20T12:45:00.000-07:00</published><updated>2010-12-25T14:16:49.466-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='XML'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>Import XML Data into SQL Server</title><content type='html'>How to automate comparing, updating, and inserting data from an XML feed against an existing SQL Server table.&lt;br /&gt;&lt;br /&gt;I have an existing table in SQl Server called AcmeProductTable.&lt;br /&gt;&lt;br /&gt;It contains the following columns:&lt;br /&gt;&lt;br /&gt;AcmeProductID&lt;br /&gt;AcmeProductName&lt;br /&gt;AcmeProductPrice&lt;br /&gt;AcmeProductStockQuantity&lt;br /&gt;&lt;br /&gt;The Acme Product Company has a url that provides me with an XML file of the latest data for their products. The feed is located at:&lt;br /&gt;&lt;br /&gt;http://www.acme.com/acmeproductfeed.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The task is to:&lt;br /&gt;&lt;br /&gt;1. Get the daily XML product feed from their url &lt;br /&gt;2. Save the XML file with today's date&lt;br /&gt;3. Compare today's XML file with my existing data in SQL Server&lt;br /&gt;4. Update any changes to price and stock quantity for existing products&lt;br /&gt;5. Insert any new products&lt;br /&gt;6. Automate the entire process so I don't need to do anything&lt;br /&gt;&lt;br /&gt;Well, for someone who knows SQL Server and XML, it's a simple task. But, like me, if you are Googling SQL Server and XML well....&lt;br /&gt;&lt;br /&gt;The place to start is here: &lt;a href="http://support.microsoft.com/kb/316005" target="_&amp;quot;blank&amp;quot;"&gt;http://support.microsoft.com/kb/316005&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This gives an example of creating an XML map, which you will need to import your XML data file.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;My XML map looks something like this:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&amp;lt;?xml version="1.0" ?&amp;gt;&lt;br /&gt;&amp;lt;Schema xmlns="urn:schemas-microsoft-com:xml-data" &lt;br /&gt;xmlns:dt="urn:schemas-microsoft-com:xml:datatypes"  &lt;br /&gt;xmlns:sql="urn:schemas-microsoft-com:xml-sql" &amp;gt; &lt;br /&gt;&lt;br /&gt;&amp;lt;ElementType name="product_id" dt:type="string" /&amp;gt;&lt;br /&gt;&amp;lt;ElementType name="product_name" dt:type="string" /&amp;gt;&lt;br /&gt;&amp;lt;ElementType name="product_price" dt:type="string" /&amp;gt;&lt;br /&gt;&amp;lt;ElementType name="product_stock_quanitity" dt:type="string" /&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;ElementType name="acmeproductfeed" sql:is-constant="1"&amp;gt;&lt;br /&gt;&amp;lt;element type="acmefeed" /&amp;gt;&lt;br /&gt;&amp;lt;/ElementType&amp;gt;&lt;br /&gt;&amp;lt;ElementType name="acmefeed"  sql:relation="acmefeed"&amp;gt;&lt;br /&gt;&amp;lt;element type="product_id"  sql:field="product_id" /&amp;gt;&lt;br /&gt;&amp;lt;element type="product_name"  sql:field="product_name" /&amp;gt;&lt;br /&gt;&amp;lt;element type="product_price" sql:field="product_price" /&amp;gt;&lt;br /&gt;&amp;lt;element type="product_stock_quanitity"  sql:field="product_stock_quanitity" /&amp;gt;&lt;br /&gt;&amp;lt;/ElementType&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/Schema&amp;gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In order to automate comparing the XML feed from the url above to my existing data in SQL Server,the AcmeProductTable, I will need the following four items:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;1. An XML Map of the Acme xml feed file (see MSDN link and my example above).&lt;br /&gt;2. A vbs script that will get the latest xml file from the url, date the file with today's date, save the file, and then locate the latest saved file (today's) and use the file to create a table in SQL Server.&lt;br /&gt;3. A stored procedure in SQL Server that will compare the table we created in in step 2 above with my AcmeProductTable and perform any required updating and inserting.&lt;br /&gt;4. A simple batch file to automate all of above. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Firstly, I am going to save my above XML map "AcmeMap.xml" into a folder on my desktop:&lt;br /&gt;&lt;br /&gt;C:\Documents and Settings\Administrator\Desktop\Acme\AcmeMap.xml&lt;br /&gt;&lt;br /&gt;I am going to use this same folder for all of the other files below as well.&lt;br /&gt;&lt;br /&gt;For my VBS scipt, I will use the following, which I have saved as "acmescript.vbs":&lt;br /&gt;&lt;br /&gt;C:\Documents and Settings\Administrator\Desktop\Acme\acmescript.vbs&lt;br /&gt;&lt;br /&gt;Blogging, like SQL Server, is not my forte, so I have used italic where portions should be quoted out of the script:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span style="font-style: italic;"&gt;' VBScript source code to get the file from the url then stamp the file with todays date and save it to my Acme file folder.&lt;br /&gt;The important bit here is inserting the +sDate+ into the name of the saved file&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;sDay = Day(Now())&lt;br /&gt;If Len(sDay) = 1 Then sDay = "0" &amp;amp; Day(Now())&lt;br /&gt;sMonth = Month(Now())&lt;br /&gt;If Len(sMonth) = 1 Then sMonth = "0" &amp;amp; Month(Now())&lt;br /&gt;sYear = Year(Now())&lt;br /&gt;sDate = sYear &amp;amp; sMonth &amp;amp; sDay&lt;br /&gt;strFileURL = "http://www.acme.com/acmeproductfeed"&lt;br /&gt;strHDLocation = "C:\Documents and Settings\Administrator\Desktop\Acme\acmefeed"+"-"&lt;span style="font-weight: bold;"&gt;+sDate+&lt;/span&gt;".xml"&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Set objXMLHTTP = CreateObject("MSXML2.XMLHTTP")&lt;br /&gt;&lt;br /&gt;objXMLHTTP.open "GET", strFileURL, false&lt;br /&gt;objXMLHTTP.send()&lt;br /&gt;&lt;br /&gt;If objXMLHTTP.Status = 200 Then&lt;br /&gt;Set objADOStream = CreateObject("ADODB.Stream")&lt;br /&gt;objADOStream.Open&lt;br /&gt;objADOStream.Type = 1 'adTypeBinary&lt;br /&gt;&lt;br /&gt;objADOStream.Write objXMLHTTP.ResponseBody&lt;br /&gt;objADOStream.Position = 0    'Set the stream position to the start&lt;br /&gt;&lt;br /&gt;Set objFSO = Createobject("Scripting.FileSystemObject")&lt;br /&gt;If objFSO.Fileexists(strHDLocation) Then objFSO.DeleteFile strHDLocation&lt;br /&gt;Set objFSO = Nothing&lt;br /&gt;&lt;br /&gt;objADOStream.SaveToFile strHDLocation&lt;br /&gt;objADOStream.Close&lt;br /&gt;Set objADOStream = Nothing&lt;br /&gt;End if&lt;br /&gt;&lt;br /&gt;Set objXMLHTTP = Nothing&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;' Now create a staging stable - acmefeed - in my database I will use this acmefeed table to compare to my existing production table AcmeProductTable. Note - make the name of the staging table the same as the element below the ROOT element of the XML file. In my case, acmefeed. There is probably some way around this, but I could not find it.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Const DB_CONNECT_STRING = "provider=SQLOLEDB.1;data source=IP;database=YourDB;uid=user;pwd=password"&lt;br /&gt;&lt;br /&gt;Set myConn = CreateObject("ADODB.Connection")&lt;br /&gt;&lt;br /&gt;set myCommand = CreateObject("ADODB.Command" )&lt;br /&gt;&lt;br /&gt;myConn.Open DB_CONNECT_STRING&lt;br /&gt;&lt;br /&gt;Set myCommand.ActiveConnection = myConn&lt;br /&gt;&lt;br /&gt;myCommand.CommandText = "CREATE TABLE acmefeed (acmefeed nvarchar(255),product_id nvarchar(255),product_name nvarchar(255),product_price nvarchar(255),product_stock_quantity nvarchar(255))"&lt;br /&gt;&lt;br /&gt;myCommand.Execute&lt;br /&gt;&lt;br /&gt;myConn.Close&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;' Now - find today's xml file that I saved above and use my xml map to insert it into the staging table, acmefeed, in my database. Note again that I using +sDate+ in the file name to get TODAY's file&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;sDay = Day(Now())&lt;br /&gt;If Len(sDay) = 1 Then sDay = "0" &amp;amp; Day(Now())&lt;br /&gt;sMonth = Month(Now())&lt;br /&gt;If Len(sMonth) = 1 Then sMonth = "0" &amp;amp; Month(Now())&lt;br /&gt;sYear = Year(Now())&lt;br /&gt;sDate = sYear &amp;amp; sMonth &amp;amp; sDay    &lt;br /&gt;Set objBL = CreateObject("SQLXMLBulkLoad.SQLXMLBulkLoad")&lt;br /&gt;objBL.ConnectionString = "provider=SQLOLEDB.1;data source=IP;database=YourDB;uid=user;pwd=password"&lt;br /&gt;objBL.ErrorLogFile = "C:\Documents and Settings\Administrator\Desktop\Acme\error.log"&lt;br /&gt;objBL.Execute "C:\Documents and Settings\Administrator\Desktop\Acme\AcmeMap.xml", "C:\Documents and Settings\Administrator\Desktop\Acme\acmefeed"+"-"&lt;span style="font-weight: bold;"&gt;+sDate+&lt;/span&gt;".xml"&lt;br /&gt;Set objBL = Nothing&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;' Now with the latest XML feed in my database in the form of a table, I can execute a stored procedure to update Price and Stock Quantity and then insert new new data into the appropriate table and then drop my acmefeed table&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Const DB_CONNECT_STRINGSP = "provider=SQLOLEDB.1;data source=IP;database=YourDB;uid=user;pwd=password"&lt;br /&gt;&lt;br /&gt;Set mySPConn = CreateObject("ADODB.Connection")&lt;br /&gt;&lt;br /&gt;set mySPCommand = CreateObject("ADODB.Command" )&lt;br /&gt;&lt;br /&gt;mySPConn.Open DB_CONNECT_STRINGSP&lt;br /&gt;&lt;br /&gt;Set mySPCommand.ActiveConnection = mySPConn&lt;br /&gt;&lt;br /&gt;mySPCommand.CommandText = "EXEC dbo.update_acmefeed"&lt;br /&gt;&lt;br /&gt;mySPCommand.Execute&lt;br /&gt;&lt;br /&gt;mySPConn.Close&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Below is the stored procedure, "update_acmefeed", that I am executing in the vb script above. This will compare the contents of my staging table, "acmefeed", against my actual production table AcmeProductTable. It will update any existing products where the price and/or stock quantity has changed, as well as insert any new products. I then drop the staging table (acmefeed).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;CREATE PROCEDURE update_acmefeed&lt;br /&gt;AS&lt;br /&gt;BEGIN&lt;br /&gt;-- First Update any changes to price and stock quantity for existing items&lt;br /&gt;-- Then insert any new items into the AcmeProductTable&lt;br /&gt;-- SET NOCOUNT ON added to prevent extra result sets from&lt;br /&gt;-- interfering with SELECT statements.&lt;br /&gt;SET NOCOUNT ON;&lt;br /&gt;&lt;br /&gt;declare @id varchar(255),@price numeric(9,2),@quantity varchar(255)&lt;br /&gt;declare curFeed cursor for select product_id, product_price, product_quantity, from acmefeed&lt;br /&gt;where  exists( select AcmeProductID from AcmeProductTable where product_id=AcmeProductID)&lt;br /&gt;&lt;br /&gt;open curFeed&lt;br /&gt;&lt;br /&gt;Fetch next from curFeed into @id,@price,@quantity&lt;br /&gt;&lt;br /&gt;while (@@fetch_Status = 0)&lt;br /&gt;BEGIN&lt;br /&gt;&lt;br /&gt;update AcmeProductTable set product_price=@price,product_stock_quantity=@quantity&lt;br /&gt;where AcmeProductID=@id&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Fetch next from curFeed into @id,@price,@quantity&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;CLOSE curFeed DEALLOCATE curFeed &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;insert into AcmeProductTable&lt;br /&gt;select  product_id, product_name,product_price,product_stock_quantity &lt;br /&gt;from acmefeed A where not exists(select AcmeProductID from AcmeProductTable where AcmeProductID=a.product_id)&lt;br /&gt;&lt;br /&gt;drop table acmefeed&lt;br /&gt;&lt;br /&gt;END&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Finally, I am going to schedule the above VBS to run daily by creating a simple batch file with the following contents:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;wscript.exe C:\Documents and Settings\Administrator\Desktop\Acme\acmescript.vbs&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;There is obviously redundancy in the date function as well as the ADO connections, but this is the original scripting I used to get this to work.&lt;br /&gt;&lt;br /&gt;I am sure there are more elegant ways of doing this, but I hope this helps someone...&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Sources:&lt;br /&gt;&lt;br /&gt;Download File:&lt;br /&gt;&lt;a href="http://blog.netnerds.net/2007/01/vbscript-download-and-save-a-binary-file/" target="_&amp;quot;blank&amp;quot;"&gt;http://blog.netnerds.net/2007/01/vbscript-download-and-save-a-binary-file/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Add File Date:&lt;br /&gt;&lt;a href="http://www.visualbasicscript.com/m29679.aspx" target="_&amp;quot;blank&amp;quot;"&gt;http://www.visualbasicscript.com/m29679.aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4739427765174521248-1256389130832900363?l=davidghedini.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://davidghedini.blogspot.com/feeds/1256389130832900363/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4739427765174521248&amp;postID=1256389130832900363&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/1256389130832900363'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/1256389130832900363'/><link rel='alternate' type='text/html' href='http://davidghedini.blogspot.com/2009/09/xml-feeds-and-sql-server.html' title='Import XML Data into SQL Server'/><author><name>David Ghedini</name><uri>http://www.blogger.com/profile/17216036360922714725</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='20' src='http://3.bp.blogspot.com/_9kl8kmes6FE/TRZtxgi0R0I/AAAAAAAAAGY/plAxLyonZ_U/S220/TheWholeGang.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4739427765174521248.post-6559587062466713786</id><published>2009-08-14T03:00:00.000-07:00</published><updated>2009-08-14T07:31:44.532-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='BIRT'/><category scheme='http://www.blogger.com/atom/ns#' term='Eclipse'/><category scheme='http://www.blogger.com/atom/ns#' term='Tomcat'/><category scheme='http://www.blogger.com/atom/ns#' term='Galileo'/><title type='text'>Tomcat Hangs After Restart</title><content type='html'>Tomcat 6.0.18&lt;br /&gt;jdk1.6.0_12&lt;br /&gt;apache-ant-1.7.1&lt;br /&gt;Cocoon 2.1.11&lt;br /&gt;&lt;br /&gt;Well, I have been working with Eclipse Galileo with BIRT the past few weeks and I have to say it's one of the best finds of recent memory.&lt;br /&gt;&lt;br /&gt;It's great to be able to develop reports on my XP laptop with Galileo's friendly IDE and then easily deploy my reports to the BIRT Report Viewer on my Centos server.&lt;br /&gt;&lt;br /&gt;The only issue (most likely my Tomcat restart script or some other fault on my end) is that after adding a new report and restarting Tomcat, I find that the Tomcat Manager, along with the BIRT report viewer hangs.&lt;br /&gt;&lt;br /&gt;A check showed that after restart Tomcat appears to be up:&lt;br /&gt;&lt;br /&gt;[root@server1 ~]# ps aux | grep -i tomcat&lt;br /&gt;root     24216  0.2  4.2 1186320 172692 ?      Sl   14:23   0:20 /usr/java/jdk1.6.0_12/bin/java -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=/usr/share/apache-tomcat-6.0.18/conf/logging.properties -Djava.endorsed.dirs=/usr/share/apache-tomcat-6.0.18/endorsed -classpath :/usr/share/apache-tomcat-6.0.18/bin/bootstrap.jar -Dcatalina.base=/usr/share/apache-tomcat-6.0.18 -Dcatalina.home=/usr/share/apache-tomcat-6.0.18 -Djava.io.tmpdir=/usr/share/apache-tomcat-6.0.18/temp org.apache.catalina.startup.Bootstrap start&lt;br /&gt;root     24745  0.0  0.0   3900   652 pts/0    R+   16:41   0:00 grep -i tomcat&lt;br /&gt;root     27432  5.3  6.8 1209172 277096 ?      Sl   Jul29  56:54 /usr/java/jdk1.6.0_12/bin/java -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=/usr/share/apache-tomcat-6.0.18/conf/logging.properties -Djava.endorsed.dirs=/usr/share/apache-tomcat-6.0.18/endorsed -classpath :/usr/share/apache-tomcat-6.0.18/bin/bootstrap.jar -Dcatalina.base=/usr/share/apache-tomcat-6.0.18 -Dcatalina.home=/usr/share/apache-tomcat-6.0.18 -Djava.io.tmpdir=/usr/share/apache-tomcat-6.0.18/temp org.apache.catalina.startup.Bootstrap start&lt;br /&gt;&lt;br /&gt;However, after sstopping Tomcat, when I issue pas -a, there are still java processes running. &lt;br /&gt;&lt;br /&gt;[root@server1 ~]# service tomcat stop&lt;br /&gt;Shutting down tomcat: Using CATALINA_BASE:   /usr/share/apache-tomcat-6.0.18&lt;br /&gt;Using CATALINA_HOME:   /usr/share/apache-tomcat-6.0.18&lt;br /&gt;Using CATALINA_TMPDIR: /usr/share/apache-tomcat-6.0.18/temp&lt;br /&gt;Using JRE_HOME:       /usr/java/jdk1.6.0_12&lt;br /&gt;done.&lt;br /&gt;[root@server1 ~]# ps -a&lt;br /&gt;  PID TTY          TIME CMD&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;24881 pts/0    00:00:20 java&lt;/span&gt;&lt;br /&gt;24945 pts/0    00:00:00 ps&lt;br /&gt;&lt;br /&gt;So, issue killall -9 java:&lt;br /&gt;&lt;br /&gt;[root@server1 ~]# killall -9 java&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Look at ps again:&lt;br /&gt;&lt;br /&gt;[root@server1 ~]# ps -a&lt;br /&gt;  PID TTY          TIME CMD&lt;br /&gt;24957 pts/0    00:00:00 ps&lt;br /&gt;&lt;br /&gt;Now start up Tomcat:&lt;br /&gt;&lt;br /&gt;[root@server1 ~]# service tomcat start&lt;br /&gt;Starting tomcat: Using CATALINA_BASE:   /usr/share/apache-tomcat-6.0.18&lt;br /&gt;Using CATALINA_HOME:   /usr/share/apache-tomcat-6.0.18&lt;br /&gt;Using CATALINA_TMPDIR: /usr/share/apache-tomcat-6.0.18/temp&lt;br /&gt;Using JRE_HOME:       /usr/java/jdk1.6.0_12&lt;br /&gt;done.&lt;br /&gt;[root@server1 ~]#&lt;br /&gt;&lt;br /&gt;And now my Manager, my Report viewer, and my newly added report are all accessible.&lt;br /&gt;&lt;br /&gt;I have been using this same Tomcat script for some time now and have never had any issues restarting after changes. So I'm not sure if it is my script (most likely), or the BIRT viewer, or some other oversight on my part.&lt;br /&gt;&lt;br /&gt;In any event, I won't be giving up my Galileo or Report Viewer any time soon.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4739427765174521248-6559587062466713786?l=davidghedini.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://davidghedini.blogspot.com/feeds/6559587062466713786/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4739427765174521248&amp;postID=6559587062466713786&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/6559587062466713786'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/6559587062466713786'/><link rel='alternate' type='text/html' href='http://davidghedini.blogspot.com/2009/08/tomcat-hangs-on-restart-after-adding.html' title='Tomcat Hangs After Restart'/><author><name>David Ghedini</name><uri>http://www.blogger.com/profile/17216036360922714725</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='20' src='http://3.bp.blogspot.com/_9kl8kmes6FE/TRZtxgi0R0I/AAAAAAAAAGY/plAxLyonZ_U/S220/TheWholeGang.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4739427765174521248.post-7984905096075080780</id><published>2009-02-17T15:28:00.000-08:00</published><updated>2011-12-25T05:49:49.108-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SSL'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle 10g Express'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle XE'/><category scheme='http://www.blogger.com/atom/ns#' term='XE'/><category scheme='http://www.blogger.com/atom/ns#' term='HTTPS'/><category scheme='http://www.blogger.com/atom/ns#' term='APEX'/><title type='text'>SSL (HTTPS) for Oracle Apex on Oracle 10g Express (XE)</title><content type='html'>Adding HTTPS to Oracle Application Express on Oracle 10g Express&lt;br /&gt;&lt;br /&gt;CentOS 5.x&lt;br /&gt;Oracle 10g Express &lt;br /&gt;APEX 3.x upgrade&lt;br /&gt;Apache 2.x&lt;br /&gt;mod_ssl&lt;br /&gt;open_ssl&lt;br /&gt;&lt;br /&gt;If you are running APEX on Oracle 10g Express, you do not have access to the Wallet Manager per the OTN agreement.&lt;br /&gt;&lt;br /&gt;You can still add HTTPS functionality, however, via Apache using mod_ssl. &lt;br /&gt;&lt;br /&gt;While pervasive, mod_ssl is a third party module not supplied by Apache. If not already installed, yum install mod_ssl.&lt;br /&gt;&lt;br /&gt;Let's start with a non-HTTPS example.&lt;br /&gt;&lt;br /&gt;Within our Apache httpd.conf file, we create a reverse proxy to our Oracle APEX application. &lt;br /&gt;&lt;br /&gt;There are any number of reasons for doing this:&lt;br /&gt;&lt;br /&gt;1. We might do this for domain mapping (i.e. so www.yourdomain.com resolves to a specified application ID and landing page www.yourdomain.com/apex/f?p=101:1)&lt;br /&gt;&lt;br /&gt;2. To allow access when behind a firewall where :8080 would block access&lt;br /&gt;&lt;br /&gt;3. To increase security by running our Apache installation on a public facing server and back-ending to our Oracle server behind a firewall through which only our Apache server has access. &lt;br /&gt;&lt;br /&gt;To create the reverse proxy we can use the following Virtual Host configuration under /etc/httpd/conf/httpd.conf&lt;br /&gt;&lt;br /&gt;For simplicity, in the example below, Apache is installed on the same server as Oracle. If your installation is otherwise, simply substitute your server hostname or IP for localhost below.  &lt;br /&gt;&lt;br /&gt;&amp;lt;VirtualHost *:80&amp;gt;&lt;br /&gt;ServerAdmin admin@yourdomain.com&lt;br /&gt;DocumentRoot /home/yourdomain.com/htdocs&lt;br /&gt;ServerName yourdomain.com&lt;br /&gt;ServerAlias www.yourdomain.com&lt;br /&gt;ErrorLog logs/yourdomain.com-error_log&lt;br /&gt;CustomLog logs/yourdomain.com-access_log common&lt;br /&gt;RewriteEngine On&lt;br /&gt;&lt;br /&gt;RewriteRule ^/$ apex/f?p=101:1 [R=301]&lt;br /&gt;&lt;br /&gt;ProxyRequests Off&lt;br /&gt;&amp;lt;Proxy *&amp;gt;&lt;br /&gt;Order allow,deny&lt;br /&gt;Allow from all&lt;br /&gt;&amp;lt;/Proxy&amp;gt;&lt;br /&gt;ProxyPass / http://localhost:8080/&lt;br /&gt;ProxyPassReverse / http://localhost:8080/&lt;br /&gt;&amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now, if we want to add HTTPS functionality, we begin by creating our SSL Key, CSR, and Certificate as we would for any standard SSL certificate.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;If you have never done this before, RapidSSL has a very simple and useful step-by-step guides to doing so on Apache with OpenSSL and ModSSL:&lt;br /&gt;&amp;nbsp; &lt;br /&gt;1. Create Key and CSR: &lt;a href="http://www.rapidssl.com/ssl-certificate-support/generate-csr/apache_mod_ssl.htm" target="_blank"&gt;http://www.rapidssl.com/ssl-certificate-support/generate-csr/apache_mod_ssl.htm&lt;/a&gt;&lt;br /&gt;&amp;nbsp; &lt;br /&gt;2. Install Certificate: &lt;a href="http://www.rapidssl.com/ssl-certificate-support/install-ssl-certificate/apache_mod_ssl.htm" target="_blank"&gt;http://www.rapidssl.com/ssl-certificate-support/install-ssl-certificate/apache_mod_ssl.htm&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;If you want to take a practice run, or don't care about the certificate throwing a browser error, you can simply create a self-signed certificate.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I'm going to store my key and crt (certificate) files in the default locations.&lt;br /&gt;&lt;br /&gt;With our certificate installed, lets return to the VHOST we created Now, under /etc/httpd/conf/httpd.conf change the Virtual Host we created above to below. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;VirtualHost *:80&amp;gt;&lt;br /&gt;ServerAdmin admin@yourdomain.com&lt;br /&gt;DocumentRoot /home/yourdomain.com/htdocs&lt;br /&gt;ServerName yourdomain.com&lt;br /&gt;ServerAlias www.yourdomain.com&lt;br /&gt;ErrorLog logs/yourdomain.com-error_log&lt;br /&gt;CustomLog logs/yourdomain.com-access_log common&lt;br /&gt;&lt;br /&gt;RewriteEngine on&lt;br /&gt;&lt;br /&gt;RewriteRule ^/(.*)$ https://%{HTTP_HOST}/$1 [L,R] &lt;br /&gt;&lt;br /&gt;&amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The above rewrite RewriteRule ^/(.*)$ https://%{HTTP_HOST}/$1 [L,R] forces all requests made to :80 HTTP to :443 HTTPS (or whatever port you have configured to handle HTTPS requests).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now that we have set up VHOST in httpd.conf and created our SSL key and certificate, we know need to create an additional VHOST under&amp;nbsp; /etc/httpd/conf.d/ssl.conf. The ssl.conf was created when we installed mod_ssl.&lt;br /&gt;&lt;br /&gt;Under /etc/httpd/conf.d/ssl.conf configure the Virtual Host as below. I will be creating more than one SSL domain, so I am using IP 123.456.78.90 for this domain and will specify this in the Virtual Host below.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The SSL Virtual Host in our below in our /etc/httpd/conf.d/ssl.conf&amp;nbsp; file is truncated and I have highlighted the main areas where we have done our configuration in bold. I have also added a few comments in blue.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&amp;lt;VirtualHost 123.456.78.90:443&amp;gt;&lt;/span&gt;&lt;br /&gt;# General setup for the virtual host, inherited from global configuration&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;DocumentRoot "/home/yourdomain.com/htdocs"&lt;br /&gt;ServerName www.yourdomain.com:443&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;# &lt;span style="color: blue;"&gt;Note that we have moved the reverse proxy from our httpd.conf file to our ssl.conf file&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;RewriteEngine on&lt;br /&gt;RewriteRule ^/$ apex/f?p=101:1 [R=301]&lt;br /&gt;&lt;br /&gt;ProxyRequests Off&lt;br /&gt;&amp;lt;Proxy *&amp;gt;&lt;br /&gt;Order deny,allow&lt;br /&gt;Allow from all&lt;br /&gt;&amp;lt;/Proxy&amp;gt;&lt;br /&gt;ProxyPass / http://localhost:8080/&lt;br /&gt;ProxyPassReverse / http://localhost:8080/&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;# Use separate log files for the SSL virtual host; note that LogLevel&lt;br /&gt;# is not inherited from httpd.conf.&lt;br /&gt;ErrorLog logs/ssl_error_log&lt;br /&gt;TransferLog logs/ssl_access_log&lt;br /&gt;LogLevel warn&lt;br /&gt;&lt;br /&gt;#   SSL Engine Switch:&lt;br /&gt;#   Enable/Disable SSL for this virtual host.&lt;br /&gt;SSLEngine on&lt;br /&gt;&lt;br /&gt;#   SSL Protocol support:&lt;br /&gt;# List the enable protocol levels with which clients will be able to&lt;br /&gt;# connect.  Disable SSLv2 access by default:&lt;br /&gt;SSLProtocol all -SSLv2&lt;br /&gt;&lt;br /&gt;#   SSL Cipher Suite:&lt;br /&gt;# List the ciphers that the client is permitted to negotiate.&lt;br /&gt;# See the mod_ssl documentation for a complete list.&lt;br /&gt;SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW&lt;br /&gt;&lt;br /&gt;#   Server Certificate:&lt;br /&gt;# Point SSLCertificateFile at a PEM encoded certificate.  If&lt;br /&gt;# the certificate is encrypted, then you will be prompted for a&lt;br /&gt;# pass phrase.  Note that a kill -HUP will prompt again.  A new&lt;br /&gt;# certificate can be generated using the genkey(1) command.&lt;br /&gt;# &lt;span style="color: blue;"&gt;The path below gives the location where we stored the SSL certificate we created&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;SSLCertificateFile /etc/httpd/conf/ssl.cert/www.youdomain.com.crt&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;#   Server Private Key:&lt;br /&gt;#   If the key is not combined with the certificate, use this&lt;br /&gt;#   directive to point at the key file.  Keep in mind that if&lt;br /&gt;#   you've both a RSA and a DSA private key you can configure&lt;br /&gt;#   both in parallel (to also allow the use of DSA ciphers, etc.)&lt;br /&gt;# &lt;span style="color: blue;"&gt;The path below gives the location of the key we created.&lt;/span&gt; &lt;br /&gt;&lt;span style="font-weight: bold;"&gt;SSLCertificateKeyFile /etc/httpd/conf/ssl.key/www.youdomain.com.key&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SetEnvIf User-Agent ".*MSIE.*" \&lt;br /&gt;nokeepalive ssl-unclean-shutdown \&lt;br /&gt;downgrade-1.0 force-response-1.0&lt;br /&gt;&lt;br /&gt;CustomLog logs/ssl_request_log \&lt;br /&gt;"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"&lt;br /&gt;&lt;br /&gt;&amp;lt;/VirtualHost&amp;gt; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;For Oracle APEX on Windows - I have never used a local Apache installation on W2K3. The simplest method for doing the above would be to use Linux server as front end with the proxy back-ended to the APEX installation on the Windows server. In Windows Firewall, you can then open access to your Linux box.&lt;br /&gt;&lt;br /&gt;Footnote - for those new to Apache, the above does not touch on tuning. ReverseProxy and rewrites require tuning in order to perform well. Be sure to set KeepAlive to On, use mod_deflate (or gzip for 1.3), as well as set reasonable prefork MPM and  worker MPM values. Apache tuning is beyond the scope of this post, but start with checking the docs and Googling these items to get you going.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.enciva.com/hosting-oracle-apex.htm" target="_blank"&gt;&lt;img border="0" src="http://www.davidghedini.com/images/banners/EncivaOracleHosting.png" alt="Oracle APEX Hosting" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4739427765174521248-7984905096075080780?l=davidghedini.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://davidghedini.blogspot.com/feeds/7984905096075080780/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4739427765174521248&amp;postID=7984905096075080780&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/7984905096075080780'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/7984905096075080780'/><link rel='alternate' type='text/html' href='http://davidghedini.blogspot.com/2009/02/https-for-oracle-application-express-on.html' title='SSL (HTTPS) for Oracle Apex on Oracle 10g Express (XE)'/><author><name>David Ghedini</name><uri>http://www.blogger.com/profile/17216036360922714725</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='20' src='http://3.bp.blogspot.com/_9kl8kmes6FE/TRZtxgi0R0I/AAAAAAAAAGY/plAxLyonZ_U/S220/TheWholeGang.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4739427765174521248.post-7689428009889026938</id><published>2009-02-03T09:16:00.000-08:00</published><updated>2009-08-22T11:48:44.554-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='service not available'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle apex'/><category scheme='http://www.blogger.com/atom/ns#' term='proxy'/><title type='text'>Service Temporarily Unavailable 503 Code for APEX Apache Proxy</title><content type='html'>On running a standard proxypass for an apex application on new server, kept getting:&lt;br /&gt;&lt;pre&gt;Service Temporarily Unavailable 503&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;vhost.....&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;VirtualHost:*80&amp;gt;&lt;br /&gt;ServerName domain.com&lt;br /&gt;ServerAlias www.domain.com&lt;br /&gt;DocumentRoot /var/www/html/domain.com/htdocs&lt;br /&gt;ServerAdmin admin@domain.com&lt;br /&gt;&lt;br /&gt;RewriteEngine On&lt;br /&gt;&lt;br /&gt;RewriteRule ^/$ apex/f?p=113:1 [R=301]&lt;br /&gt;&lt;br /&gt;ProxyRequests Off&lt;br /&gt;  &amp;lt;proxy&amp;gt;&lt;br /&gt;     Order deny,allow&lt;br /&gt;     Allow from all&lt;br /&gt;  &amp;lt;/proxy&amp;gt;&lt;br /&gt;ProxyPass / http://server:8080/&lt;br /&gt;ProxyPassReverse / http://server:8080/&lt;br /&gt; &amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;&lt;br /&gt;Checking the error logs: /var/log/httpd/error_log   I find:&lt;br /&gt;&lt;br /&gt;[Sun Feb 01 21:01:42 2009] [error] (13)Permission denied: proxy: HTTP: attempt to connect to localhost:8080 (1.2.3.4) failed&lt;br /&gt;&lt;br /&gt;In this case it was SELinux, giving me the option of either disbaling:&lt;br /&gt;&lt;br /&gt;# vi /etc/selinux/config&lt;br /&gt;&lt;br /&gt;# This file controls the state of SELinux on the system.&lt;br /&gt;# SELINUX= can take one of these three values:&lt;br /&gt;# enforcing - SELinux security policy is enforced.&lt;br /&gt;# permissive - SELinux prints warnings instead of enforcing.&lt;br /&gt;# disabled - SELinux is fully disabled.&lt;br /&gt;SELINUX=&lt;span style="font-weight:bold;"&gt;disabled&lt;/span&gt;&lt;br /&gt;# SELINUXTYPE= type of policy in use. Possible values are:&lt;br /&gt;# targeted - Only targeted network daemons are protected.&lt;br /&gt;# strict - Full SELinux protection.&lt;br /&gt;SELINUXTYPE=targeted&lt;br /&gt;&lt;br /&gt;# SETLOCALDEFS= Check local definition changes&lt;br /&gt;SETLOCALDEFS=0 &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Or, a more targeted:&lt;br /&gt;&lt;br /&gt;/usr/sbin/setsebool httpd_can_network_connect 1&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;While in this case "(13)Permission denied:" was self-explanatory, the most common proxy failures I have come across were, in fact, due to my database not being configured on os properly.&lt;br /&gt;&lt;br /&gt;Another area to check when your proxy stops proxying is the hostname configuration. Check /etc/hosts, /etc/hostname and make sure your hostname is set properly.&lt;br /&gt;&lt;br /&gt;If it is, check listener.ora and tnsnames.ora under /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/admin and make sure they match what is in your host/hostname files.&lt;blockquote&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4739427765174521248-7689428009889026938?l=davidghedini.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://davidghedini.blogspot.com/feeds/7689428009889026938/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4739427765174521248&amp;postID=7689428009889026938&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/7689428009889026938'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/7689428009889026938'/><link rel='alternate' type='text/html' href='http://davidghedini.blogspot.com/2009/02/service-temporarily-unavailable-503.html' title='Service Temporarily Unavailable 503 Code for APEX Apache Proxy'/><author><name>David Ghedini</name><uri>http://www.blogger.com/profile/17216036360922714725</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='20' src='http://3.bp.blogspot.com/_9kl8kmes6FE/TRZtxgi0R0I/AAAAAAAAAGY/plAxLyonZ_U/S220/TheWholeGang.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4739427765174521248.post-8777584029902146063</id><published>2008-12-23T16:19:00.000-08:00</published><updated>2008-12-26T03:17:47.292-08:00</updated><title type='text'>Oracle XE on OpenVZ (CentOS 4.6)</title><content type='html'>While recently installing on dedicated server provisioned as a single VPS, following yum install libaio (as well as bc and flex in my case), when I issued&lt;br /&gt;&lt;br /&gt;# rpm -ivh oracle-xe-10.2.0.1-1.0.i386.rpm&lt;br /&gt;&lt;br /&gt;I was greeted by:&lt;br /&gt;&lt;br /&gt;Preparing... ########################################### [100%]&lt;br /&gt;error: unknown error 1 setting key 'kernel.sysrq'&lt;br /&gt;error: unknown error 1 setting key 'kernel.core_uses_pid'&lt;br /&gt;error: %pre(oracle-xe-10.2.0.1-1.0.i386) scriptlet failed, exit status 255&lt;br /&gt;error: install: %pre scriptlet failed (2), skipping oracle-xe-10.2.0.1-1.0&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;XE, of course, does a sysctl -p to update the live kernel with the values of the sysctl.conf file.&lt;br /&gt;&lt;br /&gt;In my case, it was the default RHL sysctl.conf file and .sysrq and .uses_pid could not be updated by OpenVZ to the live kernel.&lt;br /&gt;&lt;br /&gt;In any event, re-issue # rpm -ivh oracle-xe-10.2.0.1-1.0.i386.rpm:&lt;br /&gt;&lt;br /&gt;Preparing...                ########################################### [100%]&lt;br /&gt;1:oracle-xe              ########################################### [100%]&lt;br /&gt;Executing Post-install steps...&lt;br /&gt;&lt;br /&gt;You must run '/etc/init.d/oracle-xe configure' as the root user to configure the database.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;So, vi'ing sysctl.conf kernel.sem = 250 32000 100 128, kernel.shmmax = 536870912.&lt;br /&gt;&lt;br /&gt;Finally,  # grep . kernel/* and verify everything is good.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4739427765174521248-8777584029902146063?l=davidghedini.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://davidghedini.blogspot.com/feeds/8777584029902146063/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4739427765174521248&amp;postID=8777584029902146063&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/8777584029902146063'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/8777584029902146063'/><link rel='alternate' type='text/html' href='http://davidghedini.blogspot.com/2008/12/oracle-xe-on-openvz-centos-46.html' title='Oracle XE on OpenVZ (CentOS 4.6)'/><author><name>David Ghedini</name><uri>http://www.blogger.com/profile/17216036360922714725</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='20' src='http://3.bp.blogspot.com/_9kl8kmes6FE/TRZtxgi0R0I/AAAAAAAAAGY/plAxLyonZ_U/S220/TheWholeGang.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4739427765174521248.post-4711445767314192917</id><published>2008-12-23T14:33:00.000-08:00</published><updated>2008-12-23T14:54:34.974-08:00</updated><title type='text'>Happy Birthday Uriel!!!!</title><content type='html'>Happy Birthday Uriel!!!!&lt;br /&gt;&lt;br /&gt;1. Uriel, the Birthday Boy&lt;br /&gt;2. Betzalel, the Birthday Brother (by law, this entitles him to both receive gifts as well as share Uriel's)&lt;br /&gt;3. Elouise's lovely train cake&lt;br /&gt;4. Elouise, The Birthday Mom&lt;br /&gt;5. Daphna, The Birthday Sister (by law, this entitles her to be carted about the flat all day by Birthday Dad).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_9kl8kmes6FE/SVFoYKlS-jI/AAAAAAAAAAM/EFbKtS8sppk/s1600-h/UrielsParty014.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 240px;" src="http://2.bp.blogspot.com/_9kl8kmes6FE/SVFoYKlS-jI/AAAAAAAAAAM/EFbKtS8sppk/s320/UrielsParty014.jpg" alt="" id="BLOGGER_PHOTO_ID_5283118602249239090" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_9kl8kmes6FE/SVFoYXVifTI/AAAAAAAAAAU/nR891pNVyVM/s1600-h/BetzalelParty012.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 173px; height: 320px;" src="http://3.bp.blogspot.com/_9kl8kmes6FE/SVFoYXVifTI/AAAAAAAAAAU/nR891pNVyVM/s320/BetzalelParty012.jpg" alt="" id="BLOGGER_PHOTO_ID_5283118605672807730" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_9kl8kmes6FE/SVFpCMIEqrI/AAAAAAAAAAk/jhetZwK8t1M/s1600-h/TrainCake.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 240px;" src="http://4.bp.blogspot.com/_9kl8kmes6FE/SVFpCMIEqrI/AAAAAAAAAAk/jhetZwK8t1M/s320/TrainCake.jpg" alt="" id="BLOGGER_PHOTO_ID_5283119324218043058" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_9kl8kmes6FE/SVFpCfQKKdI/AAAAAAAAAAs/9XrFsqWH4D4/s1600-h/ElouiseParty.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 240px;" src="http://3.bp.blogspot.com/_9kl8kmes6FE/SVFpCfQKKdI/AAAAAAAAAAs/9XrFsqWH4D4/s320/ElouiseParty.jpg" alt="" id="BLOGGER_PHOTO_ID_5283119329352231378" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_9kl8kmes6FE/SVFoYt68VvI/AAAAAAAAAAc/fTGlQFwzYy4/s1600-h/Hanukkah+08+and+Oriel%27s+party+002.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 304px; height: 240px;" src="http://2.bp.blogspot.com/_9kl8kmes6FE/SVFoYt68VvI/AAAAAAAAAAc/fTGlQFwzYy4/s320/Hanukkah+08+and+Oriel%27s+party+002.jpg" alt="" id="BLOGGER_PHOTO_ID_5283118611735271154" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4739427765174521248-4711445767314192917?l=davidghedini.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://davidghedini.blogspot.com/feeds/4711445767314192917/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4739427765174521248&amp;postID=4711445767314192917&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/4711445767314192917'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/4711445767314192917'/><link rel='alternate' type='text/html' href='http://davidghedini.blogspot.com/2008/12/uriel-is-4.html' title='Happy Birthday Uriel!!!!'/><author><name>David Ghedini</name><uri>http://www.blogger.com/profile/17216036360922714725</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='20' src='http://3.bp.blogspot.com/_9kl8kmes6FE/TRZtxgi0R0I/AAAAAAAAAGY/plAxLyonZ_U/S220/TheWholeGang.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_9kl8kmes6FE/SVFoYKlS-jI/AAAAAAAAAAM/EFbKtS8sppk/s72-c/UrielsParty014.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4739427765174521248.post-5437030640825155345</id><published>2008-12-23T09:09:00.000-08:00</published><updated>2009-02-03T12:02:37.740-08:00</updated><title type='text'>Oracle XE Backup with Email of Log</title><content type='html'>To receive a inline copy of your back up log, add the line in bold below to your backup.sh.&lt;br /&gt;&lt;br /&gt;Also comment out the two lines in italic.&lt;br /&gt;&lt;br /&gt;This assumes you are running in achieve log mode - which, of course, you are :)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#Display the result to user&lt;br /&gt;if [ $failed = 'true' ] ; then&lt;br /&gt;   echo '==================== ERROR ========================='&lt;br /&gt;   echo '             Backup of the database failed          '&lt;br /&gt;   echo '==================== ERROR ========================='&lt;br /&gt;   echo ${errstr}.&lt;br /&gt;   echo Log file is at $rman_backup_current.&lt;br /&gt;else&lt;br /&gt;   echo Backup of the database succeeded.&lt;br /&gt;   echo Log file is at $rman_backup_current.&lt;br /&gt;   &lt;span style="font-weight:bold;"&gt;mail -s 'Oracle Backup Completed' you@yourdomain.com &lt; /usr/lib/oracle/xe/oxe_backup_current.log&lt;/span&gt;&lt;br /&gt;  &lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;#Wait for user to press any key&lt;br /&gt;&lt;span style="font-style:italic;"&gt;#echo -n "Press ENTER key to exit"&lt;br /&gt;#read userinp&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4739427765174521248-5437030640825155345?l=davidghedini.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://davidghedini.blogspot.com/feeds/5437030640825155345/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4739427765174521248&amp;postID=5437030640825155345&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/5437030640825155345'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4739427765174521248/posts/default/5437030640825155345'/><link rel='alternate' type='text/html' href='http://davidghedini.blogspot.com/2008/12/my-perly-hell.html' title='Oracle XE Backup with Email of Log'/><author><name>David Ghedini</name><uri>http://www.blogger.com/profile/17216036360922714725</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='20' src='http://3.bp.blogspot.com/_9kl8kmes6FE/TRZtxgi0R0I/AAAAAAAAAGY/plAxLyonZ_U/S220/TheWholeGang.jpg'/></author><thr:total>0</thr:total></entry></feed>
