LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 05-02-2009, 06:19 PM   #1
JohnRock
LQ Newbie
 
Registered: May 2009
Posts: 28

Rep: Reputation: 15
Helpful advice needed for initial setup of CentOS 5 server running Tomcat


Hello. I have excitedly begun my foray into Linux - and I expect to never look back. As an excellent pathway to learning, I have an application(Java) that I need to deploy on a freshly installed CentOs5.3box.

Having never done this before, I am looking for a basic roadmap of WHAT I need to do to have this server ready to go with the following stack installed and configured:
latest java, latest MySql, latest Tomcat, my app installed on Tomcat

Could someone help me out by giving me the steps that I need to take to get this server from 'fresh default install' to 'production ready'?

Now bear in mind, I am not so greedy as to be looking for each command that needs to be run All I am asking for is the recipe of 'concepts' that need to be done to get my server configured properly.

My hope is that if someone helps me out by giving me the steps that need to be done, then I can go and study/learn each concept and sequentially accomplish them. The problem for me right now is that I do not know WHAT needs to be done. My only experience is doing this on XP.

If anyone could take the time to list out a checklist of steps that one should do that would really help me get a handle on what I need to learn and accomplish.

I appreciate any help one can offer, Thanks!

John
 
Old 05-02-2009, 07:02 PM   #2
Brian1
Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 61
If you really want the latest forget CentOS 5 and go with Fedora 10 or 9. Centos 5 will require many newer rpm updates that aren't really complete from my last envolvement on Centos. About 6 months ago gave it up since big issues trying to get the latest to work. Spent many hours building my own RPMs to get updated.

Unless there is a reason to run Centos 5 then continue with Centos 5 but keep it simply and basic install with only what is needed. Less to maintain.

Brian
 
Old 05-03-2009, 12:15 AM   #3
JohnRock
LQ Newbie
 
Registered: May 2009
Posts: 28

Original Poster
Rep: Reputation: 15
Thanks for your suggestion. As I am an absolute beginner with Linux I am comfortable ( at this point) with sticking with the latest release of CentOS, though I am using the latest java,tomcat,mysql ... I may change my opinion as I learn more about Linux, but in the meantime, if you have any helpful advice that can shed light on my specific question I would greatly appreciate it!
 
Old 05-03-2009, 09:15 AM   #4
Brian1
Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 61
Well Been a while since using Centos but search here for Yum repos for centos 5 and use yum to update the fresh install to the latest that the repos do. I would only look at installing what you need. So if not running a dns server then no need for binds install. About all I can say for that part.

Brian
 
Old 05-03-2009, 01:00 PM   #5
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora, Lubuntu, FreeBSD
Posts: 3,930
Blog Entries: 5

Rep: Reputation: Disabled
Quote:
Originally Posted by JohnRock
Could someone help me out by giving me the steps that I need to take to get this server from 'fresh default install' to 'production ready'?
On a general level, you'll be:
  • Planning and installing the OS;
  • hardening the OS;
  • installing the required packages;
  • configuring the packages;
  • hardening the services provided by those packages.

There are large books written on these topics. To get a server to a "production ready" stage requires research and experience. The first step to getting there in your case is reading a comprehensive book on RHEL/CentOS/Fedora.

Would you like book recommendations?
 
Old 05-04-2009, 04:09 AM   #6
JohnRock
LQ Newbie
 
Registered: May 2009
Posts: 28

Original Poster
Rep: Reputation: 15
How to make Tomcat startup at boot as non root user?

Can anyone tell me how to make this script (located in /etc/init.d/tomcat) start up at boot time running as the tomcat user and not root?

If there is a better script to use I would love to know that as well, thank you.

Code:
#!/bin/bash
# tomcat	Startup Script for Tomcat
# chkconfig: 2345 20 80
# description: Tomcat Server basic start/shutdown script
# processname: tomcat
# pidfile: /var/run/tomcat.pid

# Source function library.
. /etc/rc.d/init.d/functions

JAVA_HOME=/usr/java/default
export JAVA_HOME

TOMCAT_HOME=/usr/share/tomcat/bin
START_TOMCAT=/usr/share/tomcat/bin/startup.sh
STOP_TOMCAT=/usr/share/tomcat/bin/shutdown.sh

start() {
	echo -n "Starting tomcat: "
	cd $TOMCAT_HOME
	#/bin/su -l tomcat
	${START_TOMCAT}
	echo "done."
}
stop() {
	echo -n "Shutting down tomcat: "
	cd $TOMCAT_HOME
	#/bin/su -l tomcat
	${STOP_TOMCAT}
	echo "done."
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 10
start
;;
*)
echo "Usage: $0 {start|stop|restart}"

esac 

exit 0
 
Old 05-04-2009, 04:19 AM   #7
JohnRock
LQ Newbie
 
Registered: May 2009
Posts: 28

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by anomie View Post
On a general level, you'll be:
  • Planning and installing the OS;
  • hardening the OS;
  • installing the required packages;
  • configuring the packages;
  • hardening the services provided by those packages.
Thank you. Yes, I guess what I was getting at was, what are the steps you need to take to Harden the OS, and what packages are required beyond CentOS 5.3 basic install.

I understand that it takes a lot of reading, just hoping for some bullet points to look for. I would LOVE good book reccomendations, please. I have gotten the Tammy Fox RHEL unleashed book, but it has been very hard to know which books are right for a Linux newbie who needs to learn RHEL 5 quick!
 
Old 05-04-2009, 04:52 AM   #8
JohnRock
LQ Newbie
 
Registered: May 2009
Posts: 28

Original Poster
Rep: Reputation: 15
If I may expand a little deeper...

I recognize the depth of learning involved to for Linux administration, and am not so naive as to think I could get by with a 'cheat sheet', if you will...

But in my situation, I am an experienced Java developer with an app I've developed to run in Tomcat. For the immediate future all I need to do is be able to setup my Centos5 box to serve my app in Tomcat. That is all I need to do for right now and I was hoping for some bullet points on what steps I need to take just to be able to accomplish that--in a manner suitable for production.

So while there are many things to learn about Linux Administration, I do suspect that there is a smaller subset required for my specific and limited task. In hopes to not get overwhelmed trying to learn everything at once, I am hoping to acquire an overview of the essential steps required to serve an app in tomcat.

Thanks for any advice you can give. Forgive me if I am naive..I'm just thirsting for knowledge right now

John
 
Old 05-04-2009, 05:05 AM   #9
kirukan
Senior Member
 
Registered: Jun 2008
Location: Eelam
Distribution: Redhat, Solaris, Suse
Posts: 1,219

Rep: Reputation: 131Reputation: 131
check this url
https://www.switch.ch/aai/docs/shibb...rivileged.html
 
Old 05-04-2009, 06:01 AM   #10
jdros
LQ Newbie
 
Registered: Apr 2008
Distribution: RedHat, CentOS, Ubuntu
Posts: 6

Rep: Reputation: 1
Hi JohnRock.

We are using quite a similar script for the same reason (RedHat 4.7). The only difference is that it is run under tomcat user:

Code:
#!/bin/sh
#
# chkconfig: 35 99 00
# description: tomcat starts and stops apache-tomcat services.
# processname: tomcat

# Source function library.
. /etc/init.d/functions

# Read JAVA_HOME, JAVA_JRE, CATALINA_HOME environment variables
. /etc/profile

# Local variables
TOMCAT_USER="tomcat"
LOCK_FILE="/var/lock/subsys/tomcat"
LOG_FILE="/var/log/tomcat/tomcat.log"

RETVAL=0

start() {
   echo -n $"Starting up apache-tomcat: "
   /bin/su - $TOMCAT_USER -c $CATALINA_HOME/bin/startup.sh >> $LOG_FILE 2>&1
   RETVAL=$?
   [ $RETVAL -eq 0 ] && touch $LOCK_FILE && echo_success
   echo
}

stop() {
   echo -n $"Shutting down apache-tomcat: "
   /bin/su - $TOMCAT_USER -c $CATALINA_HOME/bin/shutdown.sh >> $LOG_FILE 2>&1
   RETVAL=$?
   [ $RETVAL -eq 0 ] && rm -f $LOCK_FILE && echo_success
   echo
}

restart() {
   stop
   start
   RETVAL=$?
}

# See how we were called.
case "$1" in
  start)
    if [ -f $LOCK_FILE ] ; then
       echo "Apache-Tomcat already running! Try STOP first..."
    else
       start
       fi
    ;;
  stop)
    stop
    ;;
  restart)
    restart
    ;;
  *)
     echo "Usage: tomcat {start|stop|restart}"
     exit 1
esac

exit $RETVAL
NOTE:
tomcat user and group must be defined, and CATALINA_HOME permissions must be set to tomcat:tomcat for the above to work.
 
Old 05-04-2009, 10:59 AM   #11
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora, Lubuntu, FreeBSD
Posts: 3,930
Blog Entries: 5

Rep: Reputation: Disabled
While you are learning, what I would recommend doing is running your application server in a relatively safe environment. It'd be best if you could keep it on private IP space, or behind a perimeter firewall, where other hosts on the network are known to you. Do not provide your service to the 'net or this will certainly get ugly with or without your knowledge.

It sounds like you will be running Tomcat as a standalone web server with MySQL on the backend, so this should not be too daunting -- once you're familiar with the services, that is.

A high level look would be something like:
  1. Install Sun's java binary (just my opinion) -- you can download the rpm directly from Sun.
  2. Install Tomcat and MySQL server using yum.
  3. Configure Tomcat and MySQL.
  4. Test your java application, debug problems, and so on.

The RHEL book you picked up should be fine, so long as it focuses on the correct major version (5 in your case). For long term learning, I'd recommend Linux Administration Handbook (2nd Edition), by Evi Nemeth, Garth Snyder, & Trent R. Hein. This is a great book on server administration fundamentals. Once you have that down sufficiently, you can focus on specific services and details as needed.
 
Old 05-05-2009, 12:00 AM   #12
JohnRock
LQ Newbie
 
Registered: May 2009
Posts: 28

Original Poster
Rep: Reputation: 15
Thank you. I will certainly pick up the book you reccommended. Thanks!

I installed Tomcat by downloading the rpm.bin directly from apache site and had no problems with that. Do you think it is really better to use yum when I get MySql? Will I be able to get the latest MySql version directly from yum? Do I need to configure a specific repository to ensure that?

I feel pretty good about the steps you outlined. They are what I am going to be focusing on intently and would not plan on thinking of going live until such a time as I feel these steps are solid. I just want to make sure I am not missing something that needs to be done before putting it on the 'net'. Because eventually that is where it's headed!

Thank you!

John
 
Old 05-05-2009, 12:37 AM   #13
JohnRock
LQ Newbie
 
Registered: May 2009
Posts: 28

Original Poster
Rep: Reputation: 15
Thanks jdros! Of all the posts I have looked at yours was the only one that got me where I needed to be. Tomcat running under the tomcat user.

All I had to do was create a directory /var/log/tomcat/ for the log file

Much Obliged

John
 
Old 05-05-2009, 02:12 PM   #14
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora, Lubuntu, FreeBSD
Posts: 3,930
Blog Entries: 5

Rep: Reputation: Disabled
Quote:
Originally Posted by JohnRock
I installed Tomcat by downloading the rpm.bin directly from apache site and had no problems with that. Do you think it is really better to use yum when I get MySql? Will I be able to get the latest MySql version directly from yum? Do I need to configure a specific repository to ensure that?
When possible, it's preferable to use the packages provided by the repositories you're pointing yum to. The reason is rpm keeps a nice little database (behind the scenes) of all the packages you have installed. This means dependencies are tracked among packages, and in most cases you won't have files from one package accidentally clobbering files from another package.

There are cases where it is simply not possible to install from the yum repositories, and in those cases you need to take extra care to ensure dependencies are met properly. It probably won't be a big issue with Tomcat, but you need to be aware of it.

So unless you have a good to not use the repositories for MySQL server, then - of course - install from them. I think it's available in CentOS's standard repositories.
 
Old 05-05-2009, 06:01 PM   #15
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,964
Blog Entries: 11

Rep: Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865
I merged your two tomcat threads into one.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Advice howto setup centos 5.2 as database server on HP Proliant ML110 ? risyadi Linux - Newbie 2 02-25-2009 03:06 PM
[SOLVED] File/web server setup advice needed NightSky Linux - Server 4 09-04-2007 03:00 PM
[SOLVED] Need to setup a subdomain in Tomcat 5.5.9 CentOS 4.2 thedonkdonk Linux - General 2 09-27-2006 09:41 AM
Initial setup of Cyrus on CentOS 4.2 jjrowan cAos 0 01-13-2006 01:12 PM
Opinion/Advice needed on a setup: tarballed Linux - General 3 11-20-2002 05:26 PM


All times are GMT -5. The time now is 11:12 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration