Step 1: Java installation: Installation step you can find here.
Tomcat 7 installation and configuration done. For verification start a Web browser and put server ip or host name and port no. e.g. localhost:8080.
Step 3: Copy that downloaded file in /opt/ and Extract here as
shown below:
[root@linuxcnf ~]# cd
/opt/
[root@linuxcnf opt]# ls
apache-tomcat-7.0.86.tar.gz
[root@linuxcnf opt]# tar zxvf apache-tomcat-7.0.86.tar.gz
[root@linuxcnf
opt]# mv apache-tomcat-7.0.86 /usr/local/tomcat7
|
Step 4: Set environment variables
[root@linuxcnf ~]# vi /etc/profile
# add
following lines into the end of the file
export
CATALINA_HOME/usr/local/tomcat7
export
PATH=/usr/local/tomcat7/bin:$PATH
:wq
[root@linuxcnf ~]# source
/etc/profile
|
Step 5: Verify environment variables setting:
[root@linuxcnf ~]# echo
$CATALINA_HOME
/usr/local/tomcat7
|
Step 6: Add user for tomcat authentication:
[root@linuxcnf ~]#
vi $CATALINA_HOME/conf/tomcat-users.xml
#Add
this below lines in the file after --> and before this line
"</tomcat-users>" in tomcat users section.
<role
rolename="manager-gui"/>
<role rolename="manager-status"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="admin"/>
<user
username="username" password="password"
roles="manager-gui,manager-
script,manager-status,manager-jmx,admin"/>
:wq
|
Step 7: Create a service scrip to auto start the server after
reboot:
[root@linuxcnf ~]# vi /etc/rc.d/init.d/tomcat
#!/bin/bash
#
Tomcat: Start/Stop Tomcat
|
.
/etc/init.d/functions
.
/etc/sysconfig/network
CATALINA_HOME=/usr/local/tomcat7
LOCKFILE=/var/lock/subsys/tomcat7
RETVAL=0
start(){
echo "Starting Tomcat7: "
$CATALINA_HOME/bin/startup.sh
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch $LOCKFILE
return $RETVAL
}
stop(){
echo "Shutting down Tomcat7: "
$CATALINA_HOME/bin/shutdown.sh
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f $LOCKFILE
return $RETVAL
}
case
"$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
;;
esac
exit
$?
:wq
[root@linuxcnf ~]# chmod 755
/etc/rc.d/init.d/tomcat
[root@linuxcnf ~]# /etc/rc.d/init.d/tomcat start
Starting
Tomcat7:
[ok]
[root@linuxcnf ~]# chkconfig tomcat
on
|
Step 8: Configure firewall to access tomcat service
[root@linuxcnf ~]#
firewall-cmd –permanent --add-port=8080/tcp
[root@linuxcnf ~]#
firewall-cmd --reload
|
Tomcat 7 installation and configuration done. For verification start a Web browser and put server ip or host name and port no. e.g. localhost:8080.
No comments:
Post a Comment