Apache Geronimo is an Open Source J2EE server. And it can be installed rather easily on Ubuntu Linux (10.04).
As a reminder, the following instructions presume that one uses its current ubuntu account. For an enterprise environment it is recommended to create a new user account, for example g_user, that will own all the geronimo files and will start and stop the server (will be referred from now on as GERONIMO_OWNER and ${user}) and add this user to the sudoers as needed.
- First step is to install sun java.
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update
sudo apt-get install sun-java6-jdk
- Second step is to download and extract (install) Geronimo:
Download from :
Then md5sum it (to gain problem-solving time):
Extract the archive:
Rename the extracted directory to something smaller:
gedit /home/${user}/.bashrc
Add JAVA_HOME, JRE_HOME and JAVA_OPTS at the end of .bashrc:
Run .bashrc (just this once):
- Last step is to start the server:
And the server is up and running!
You can browse the Administration console at
Provide the default credentials :
system/manager
And geronimo is at your disposal!
To maximize security, it is time to change the default admin username and password. You need to stop geronimo:
cd ${GERONIMO_HOME}/bin
Open permission/groups file:
admin=g_admin
monitor=g_admin
Lastly you should change the file permissions on these files:
chmod -R 600 ${GERONIMO_HOME}/var/security
To create a service in order to automate startup open/create the following file:
Now you need to change the file permissions:
sudo chmod 755 /etc/init.d/geronimo2
Next create the upstart conf file:
Reload upstart configuration:
sudo initctl reload-configuration
Start geronimo service :
sudo initctl start geronimo2
And the geronimo service is securely installed and will be started on every boot.
p.s.
You can find me on fiverr for more personalized requests on any java app server configuration problem or java error that you encounter, with deliverance of less than a day (true!) and money back guarantee if not satisfied.
As a reminder, the following instructions presume that one uses its current ubuntu account. For an enterprise environment it is recommended to create a new user account, for example g_user, that will own all the geronimo files and will start and stop the server (will be referred from now on as GERONIMO_OWNER and ${user}) and add this user to the sudoers as needed.
- First step is to install sun java.
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update
sudo apt-get install sun-java6-jdk
- Second step is to download and extract (install) Geronimo:
Download from :
http://geronimo.apache.org/apache-geronimo-v22-release.html
I downloaded the latest stable release with tomcat:
geronimo-tomcat6-javaee5-2.2-bin.tar.gz
md5sum geronimo-tomcat6-javaee5-2.2-bin.tar.gz
and crosscheck it with the md5 sum on the site.Extract the archive:
tar -xvzf geronimo-tomcat6-javaee5-2.2-bin.tar.gz
mv geronimo-tomcat6-javaee5-2.2 geronimo.2.2
From now on when we will refer to the full path of the geronimo.2.2 directory as ${GERONIMO_HOME}.
Open .bashrc file:gedit /home/${user}/.bashrc
Add JAVA_HOME, JRE_HOME and JAVA_OPTS at the end of .bashrc:
export JAVA_HOME=/usr/lib/jvm/java-6-sun
export JRE_HOME=/usr/lib/jvm/java-6-sun/jre
export JAVA_OPTS="-Xmx256m -XX:MaxPermSize=128m"
export JRE_HOME=/usr/lib/jvm/java-6-sun/jre
export JAVA_OPTS="-Xmx256m -XX:MaxPermSize=128m"
. .bashrc
Or close the terminal and open a new one. - Last step is to start the server:
cd ${GERONIMO_HOME}/bin
./geronimo start
And the server is up and running!
You can browse the Administration console at
http://localhost:8080/
Click the link "Administration -> console" on the left.Provide the default credentials :
system/manager
And geronimo is at your disposal!
To maximize security, it is time to change the default admin username and password. You need to stop geronimo:
cd ${GERONIMO_HOME}/bin
./geronimo.sh stop --user system --password manager
Open user/passwords file
gedit ${GERONIMO_HOME}/var/security/users.properties
and add a new line with the new administrator user and his password like this:
g_admin=g_admin_pass
Next time you start the server the password will be automatically encrypted.Open permission/groups file:
gedit ${GERONIMO_HOME}/var/security/groups.properties
Assign administration and monitoring privileges only to the new user. Change the two uncommented lines like this:admin=g_admin
monitor=g_admin
Lastly you should change the file permissions on these files:
chmod -R 600 ${GERONIMO_HOME}/var/security
To create a service in order to automate startup open/create the following file:
sudo gedit /etc/init.d/geronimo2
Add the following code. You only need to set correctly for your system the variables GERONIMO_HOME, GERONIMO_OWNER, GERONIMO_ADMIN and GERONIMO_PASS inside the script.#!/bin/bash
# chkconfig: 234 20 80
# description: Geronimo Server start/stop script
# processname: geronimo2
JAVA_HOME=/usr/lib/jvm/java-6-sun
JRE_HOME=/usr/lib/jvm/java-6-sun/jre
JAVA_OPTS="-Xmx256m -XX:MaxPermSize=128m"
GERONIMO_HOME=/home/gfuser/geronimo.2.2
GERONIMO_OWNER=g_user
GERONIMO_ADMIN=g_admin
GERONIMO_PASS=g_admin_pass
export JAVA_HOME JRE_HOME JAVA_OPTS GERONIMO_HOME GERONIMO_OWNER GERONIMO_ADMIN GERONIMO_PASS
start() {
geronimo_state=`ps -ef | grep "geronimo" | grep "/bin/server.jar" | grep -v grep | wc -l`
if [ $geronimo_state -gt 0 ]; then
echo "Geronimo is already UP!"
else
echo -n "Starting geronimo: "
cd $GERONIMO_HOME/bin
su $GERONIMO_OWNER -c "$GERONIMO_HOME/bin/geronimo.sh start"
sleep 20
echo "done."
fi
}
stop() {
geronimo_state=`ps -ef | grep "geronimo" | grep "/bin/server.jar" | grep -v grep | wc -l`
if [ $geronimo_state -gt 0 ]; then
echo -n "Gracefully stoping geronimo: "
su $GERONIMO_OWNER -c "$GERONIMO_HOME/bin/geronimo.sh stop --user $GERONIMO_ADMIN --password $GERONIMO_PASS"
sleep 10
echo "done."
else
echo "Geronimo is already DOWN!"
fi
}
force_stop() {
geronimo_state=`ps -ef | grep "geronimo" | grep "/bin/server.jar" | grep -v grep | wc -l`
if [ $geronimo_state -gt 0 ]; then
echo -n "Forcefully stoping geronimo: "
su $GERONIMO_OWNER -c "$GERONIMO_HOME/bin/geronimo.sh stop --force --user $GERONIMO_ADMIN --password $GERONIMO_PASS"
echo "done."
else
echo "Geronimo is already DOWN!"
fi
}
status() {
geronimo_state=`ps -ef | grep "geronimo" | grep "/bin/server.jar" | grep -v grep | wc -l`
if [ $geronimo_state -gt 0 ]; then
echo "Geronimo is UP!"
else
echo "Geronimo is DOWN!"
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
force_stop)
force_stop
;;
restart)
stop
sleep 2
start
;;
*)
echo "Usage: $0 {start|stop|force_stop|restart|status}"
esac
exit 0
Now you need to change the file permissions:
sudo chmod 755 /etc/init.d/geronimo2
Next create the upstart conf file:
sudo gedit /etc/init/geronimo2.conf
and add the following code# geronimo2
start on runlevel [2345]
stop on runlevel [16]
respawn
pre-start exec /etc/init.d/geronimo2 start
post-stop exec /etc/init.d/geronimo2 stop
Reload upstart configuration:
sudo initctl reload-configuration
Start geronimo service :
sudo initctl start geronimo2
And the geronimo service is securely installed and will be started on every boot.
p.s.
You can find me on fiverr for more personalized requests on any java app server configuration problem or java error that you encounter, with deliverance of less than a day (true!) and money back guarantee if not satisfied.
I have gone as far as installing and starting the server, and your tutorial was very helpful!
ReplyDeleteJust want to mention that Sun Java seems no longer officially supported under Ubuntu. I used open java 7 and it worked fine this far.
Many thanks.
JJ
Ubuntu may no longer support java, but you can still download a copy from oracle download site, and extract it to a suitable directory.
ReplyDeleteAFAIK changes in the licensing prevents ubuntu from shipping it through it's own repository, so linux jdks will be downloaded directly from oracle's site.
Hi Marios, I'm setting up Geronimo on my Debian server, and just have a couple of questions I hope you can answer.
ReplyDelete1. What directory should I extract the geronimo tar.gz file into? At the moment, I've put it in my home directory ~/geronimo, but I would have thought it should go into /usr/local/geronimo.
2. Does the GERONIMO_OWNER variable have to exist as a user account?
Regards
Peter
Hi there,
ReplyDeleteThanks for stopping by my blog.
For your first question I would definitely recommend a /usr/local/ directory. Though my personal preference for an enterprise environment would be a more short directory like /app_server/geronimo and make /app_server a separate partition in order to be able to administer it separately from the root partition (I even make separate volume groups).
The answer to your second question is a definite yes. GERONIMO_OWNER is a user account, and for security reasons we never use the root account! I would suggest g_user or any other that you like. The less common the username, the less security problems may arise!
Regards.
Marios