Monday, May 19, 2008

Useful Linux Commands

Installing Java:
1. chmod 744 jre-1_5_0_15-linux-amd64-rpm.bin
2. Run ./jre-1_5_0_15-linux-amd64-rpm.bin \
java is intalled.
Now to make it active do following:
1. edit .bashrc
2. add PATH=$PATH:/usr/local/bin
where /usr/local/bin is the pate where java is installed.
If you dont want to edit Path variable than create symbolic link (ln) in directory /usr/bin for java, javac , and other utilities you want to use of jre.

Installing Tomcat:
1. Unjar tomcat.tar in the directory you wish to set up tomcat.
2. put following tomcat script in /etc/init.d/
---------------script tomcat----------------------
# This is the init script for starting up the
# Jakarta Tomcat server
#
# chkconfig: 345 91 10
# description: Starts and stops the Tomcat daemon.
#
# Source function library. . /etc/rc.d/init.d/functions
# Get config. . /etc/sysconfig/network
# Check that networking is up.[ "${NETWORKING}" = "no" ] && exit 0
tomcat=/usr/local/tomcat/apache-tomcat-6.0.16
startup=$tomcat/bin/startup.sh
shutdown=$tomcat/bin/shutdown.sh
start(){
echo -n $"Starting Tomcat service: "
#daemon -c
$startup
RETVAL=$?
echo
}
stop(){
action $"Stopping Tomcat service: " $shutdown
RETVAL=$?
echo
}
restart(){
stop
start
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
# This doesn't work ;)
status tomcat
;;
restart )
restart
;;
*)
echo $"Usage: $0 {startstopstatusrestart}"
exit 1
esac
exit 0
-----------------------------------------------------------------------------------
3. chmod a+x tomcat
4. chkconfig --add tomcat and your service is set :
use "service tomcat start" command to test your service
5. to check tomcat is running ------------------ netstat -vatn grep 8080
6. " dos2unix tomcat" to fix dos to unix conversion issue tomcat" to fix dos to unix conversion issue

No comments: