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.
Geronimo is available with choice of Tomcat or Jetty. Except for the file names, the installation procedure is identical.
For this installation, we'll use Geronimo 2.2.1, the current, stable release.
To start, we'll install the Java Development Kit (JDK) 1.6
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.
If you do have the JDK installed, you can skip to: Step 2: Download and Unpack Geronimo 2.2.1:
Step 1: Install JDK 1.6
You can download the JDK here: http://www.oracle.com/technetwork/java/javase/downloads/index.html
We'll install the latest JDK, which is JDK 6 Update 24. The JDK is specific to 32 and 64 bit versions.
My CentOS box is 64 bit, so I'll need: jdk-6u24-linux-x64.bin.
If you are on 32 bit, you'll need: jdk-6u24-linux-i586.bin
Download the appropriate JDK and save it to a directory. I'm saving it to /root.
Move (mv) or copy (cp) the file to the /opt directory:
[root@srv6 ~]# mv jdk-6u24-linux-x64.bin /opt/jdk-6u24-linux-x64.bin
Create a new directory /usr/java.
[root@srv6 ~]# mkdir /usr/java
Change to the /usr/java directory we created and install the JDK using 'sh /opt/jdk-6u24-linux-x64.bin'
[root@srv6 ~]# cd /usr/java [root@srv6 java]# sh /opt/jdk-6u24-linux-x64.bin
Set the JAVA_HOME path. This is where we installed our JDK above.
To set it for your current session, you can issue the following from the CLI:
[root@srv6 java]# JAVA_HOME=/usr/java/jdk1.6.0_24 [root@srv6 java]# export JAVA_HOME [root@srv6 java]# PATH=$JAVA_HOME/bin:$PATH [root@srv6 java]# export PATH
To set the JAVA_HOME permanently, we add below to either the ~/.bashrc or ~/.bash_profile of the user (in this case, root).
We can also add it /etc/profile and then source it to give to all users.
JAVA_HOME=/usr/java/jdk1.6.0_24 export JAVA_HOME PATH=$JAVA_HOME/bin:$PATH export PATH
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.
[root@srv6 ~]# echo $JAVA_HOME /usr/java/jdk1.6.0_24
Step 2: Download and Unpack Geronimo 2.2.1
Download geronimo-tomcat6-javaee5-2.2.1 here
If you want to use the embedded Jetty version, download geronimo-jetty7-javaee5-2.2.1 from the same page as above.
Again, the only difference in installation is the file names, so just adjust accordingly.
Save the file to a directory. I'm saving it to /root/geronimo-tomcat6-javaee5-2.2.1-bin.tar.gz
Before proceeding, you should verify the MD5 Checksum for your Geronimo download.
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.
[root@srv6 ~]# md5sum geronimo-tomcat6-javaee5-2.2.1-bin.tar.gz 0bb2985421398eb2b4af35ce4eaff974 geronimo-tomcat6-javaee5-2.2.1-bin.tar.gz
Compare the output above to the MD5 Checksum provided by the Geronimo Tomcat MD5 page and insure that they match exactly.
Now, move (mv) or copy (cp) the file to the /usr/share directory:
[root@srv6 ~]# mv geronimo-tomcat6-javaee5-2.2.1-bin.tar.gz /usr/share/geronimo-tomcat6-javaee5-2.2.1-bin.tar.gz
Change to the /usr/share directory and unpack the file using tar -xzf:
[root@srv6 ~]# cd /usr/share [root@sv2 srv6 ]# tar -xzf geronimo-tomcat6-javaee5-2.2.1-bin.tar.gz
This will create the directory /usr/share/geronimo-tomcat6-javaee5-2.2.1
Step 3: Configure Geronimo to Run as a Service.
We will now create a simple Start/Stop/Restart script and configure Geronimo to run as a service.
Naviagte to the /etc/init.d directory and create a script called 'geronimo' as shown below.
[root@srv6 share]# cd /etc/init.d [root@srv6 init.d]# vi geronimo
The script:
#!/bin/bash # description: Geronimo Start Stop Restart # processname: geronimo # chkconfig: 234 20 80 JAVA_HOME=/usr/java/jdk1.6.0_24 export JAVA_HOME PATH=$JAVA_HOME/bin:$PATH export PATH GERONIMO_HOME=/usr/share/geronimo-tomcat6-javaee5-2.2.1 case $1 in start) sh $GERONIMO_HOME/bin/startup.sh ;; stop) sh $GERONIMO_HOME/bin/shutdown.sh ;; restart) sh $GERONIMO_HOME/bin/shutdown.sh sh $GERONIMO_HOME/bin/startup.sh ;; esac exit 0
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).
GERONIMO_HOME is the Geronimo home directory where we unpacked at (/usr/share/geronimo-tomcat6-javaee5-2.2.1)
Now, make the geronimo script executable:
[root@srv6 init.d]# chmod 755 geronimo
Add Geronimo to chkconfig and set to start at boot.
[root@srv6 init.d]# chkconfig --add geronimo [root@srv6 init.d]# chkconfig --level 234 geronimo on
Verify it:
[root@srv6 init.d]# chkconfig --list geronimo tomcat 0:off 1:off 2:on 3:on 4:on 5:off 6:off
Now, we can start Geronimo using 'service geronimo start':
Start Geronimo:
[root@srv6 ~]# service geronimo start Using GERONIMO_HOME: /usr/share/geronimo-tomcat6-javaee5-2.2.1 Using GERONIMO_TMPDIR: var/temp Using JRE_HOME: /usr/java/jdk1.6.0_24/jre Using GERONIMO_OUT: /usr/share/geronimo-tomcat6-javaee5-2.2.1/var/log/geronimo.out Geronimo started in background. PID: 5179
You should now be able to navigate to http://yourdomain.com:8080 or http://yourIPaddress:8080 and we should see the Geronimo home page.
Step 4: Access Geronimo Admin Console and Change Password.
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.
The default user name and password is system/manager.
Logged in as system:
To change the default password, in the Console Navigation menu, expand the Security node and then click on 'Users and Groups'
Click the Edit link for the user System and update the password.
Step 5 (optional): Modify Script to Pass the System Password Value.
Stopping Geronimo.
Using our script above, when stopping Geronimo using 'service geronimo stop', we will be prompted for the system password:
[root@srv6 init.d]# service geronimo stop Using GERONIMO_HOME: /usr/share/geronimo-tomcat6-javaee5-2.2.1 Using GERONIMO_TMPDIR: var/temp Using JRE_HOME: /usr/java/jdk1.6.0_24/jre Username: system Password: ******* Locating server on localhost:1099... Server found. Server shutdown started Server shutdown completed
We can modify our script, however, to pass the password to the shell by adding '--user system --password manager' to the shutdown command:
#!/bin/bash # description: Geronimo Start Stop Restart # processname: geronimo # chkconfig: 234 20 80 JAVA_HOME=/usr/java/jdk1.6.0_24 export JAVA_HOME PATH=$JAVA_HOME/bin:$PATH export PATH GERONIMO_HOME=/usr/share/geronimo-tomcat6-javaee5-2.2.1 case $1 in start) sh $GERONIMO_HOME/bin/startup.sh ;; stop) sh $GERONIMO_HOME/bin/shutdown.sh --user system --password manager ;; restart) sh $GERONIMO_HOME/bin/shutdown.sh --user system --password manager sh $GERONIMO_HOME/bin/startup.sh ;; esac exit 0
**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.
You can also create a new role and user if you wish to.
Now, when we stop Geronimo using 'service geronimo stop' we are no longer prompted for the password:
Stop Geronimo:
[root@srv6 init.d]# service geronimo stop Using GERONIMO_HOME: /usr/share/geronimo-tomcat6-javaee5-2.2.1 Using GERONIMO_TMPDIR: var/temp Using JRE_HOME: /usr/java/jdk1.6.0_24/jre Locating server on localhost:1099... Server found. Server shutdown started Server shutdown completed
Learn More About Apache Geronimo
Apache Geronimo
Geronimo Documentation Wiki











0 comments:
Post a Comment