Current File : //root/tomcatinstall.sh |
# ######################################## Reading Input started here ########################################
#########################################---------------------------------#########################################
echo -e "--------------------------------"
echo -e "1. Tomcat 7"
echo -e "2. Tomcat 8"
echo -e "3. Tomcat 9"
echo -e "--------------------------------"
echo -e "Enter your option >"
read tomversion
if [ "$tomversion" -le 3 ] && [ "$tomversion" -ge 1 ]; then
continue
else
echo -e "you have enter the wrong option so we have quited the installation"
exit
fi
echo -e "--------------------------------"
echo -e "1. Java 7"
echo -e "2. Java 8"
echo -e "--------------------------------"
echo -e "Enter your option >"
read javaversion
if [ "$javaversion" -le 2 ] && [ "$javaversion" -ge 1 ]; then
continue
else
echo -e "you have enter the wrong option so we have quited the installation"
exit
fi
TomcatPath=""
# ######################################## Reading Input started here ########################################
# ######################################## Tomcat Instatllation started here ########################################
#########################################-------------------------------------------#########################################
case "$tomversion" in
1)
echo -e "Tomcat 7 installation started succesfully..."
TomcatPath="/usr/local/tomcat7/"
wget -O apache-tomcat-7.0.73.tar.gz http://hostingraja.info/Version2.5/java/apache-tomcat-7.0.73.tar.gz
tar -xvf apache-tomcat-7.0.73.tar.gz
mv apache-tomcat-7.0.73 tomcat7
mv tomcat7/ /usr/local
chown apache. -R "/usr/local/tomcat7"
touch /etc/init.d/tomcat
echo "#!/bin/bash" > /etc/init.d/tomcat
echo "### BEGIN INIT INFO" >> /etc/init.d/tomcat
echo "# Provides: tomcat8" >> /etc/init.d/tomcat
echo "# Required-Start: $network" >> /etc/init.d/tomcat
echo "# Required-Stop: $network" >> /etc/init.d/tomcat
echo "# Default-Start: 2 3 4 5" >> /etc/init.d/tomcat
echo "# Default-Stop: 0 1 6" >> /etc/init.d/tomcat
echo "# Short-Description: Start/Stop Tomcat server" >> /etc/init.d/tomcat
echo "### END INIT INFO" >> /etc/init.d/tomcat
echo "PATH=/sbin:/bin:/usr/sbin:/usr/bin" >> /etc/init.d/tomcat
echo "start() {" >> /etc/init.d/tomcat
echo " sh /usr/local/tomcat7/bin/startup.sh" >> /etc/init.d/tomcat
echo "}" >> /etc/init.d/tomcat
echo "stop() {" >> /etc/init.d/tomcat
echo " sh /usr/local/tomcat7/bin/shutdown.sh" >> /etc/init.d/tomcat
echo "}" >> /etc/init.d/tomcat
echo "case \$1 in" >> /etc/init.d/tomcat
echo " start|stop) \$1;;" >> /etc/init.d/tomcat
echo " restart) stop; start;;" >> /etc/init.d/tomcat
echo " *) echo "Run as \$0 <start|stop|restart>"; exit 1;;" >> /etc/init.d/tomcat
echo "esac" >> /etc/init.d/tomcat
sed -i -e 's/Connector port="8080" protocol="HTTP/Connector port="80" protocol="HTTP/g' /usr/local/tomcat7/conf/server.xml
echo "suhosin.session.encrypt = Off" >> /etc/php.ini
chmod 755 /etc/init.d/tomcat
echo -e "Tomcat 7 installation completed succesfully..."
;;
2)
echo -e "Tomcat 8 installation started succesfully..."
TomcatPath="/usr/local/tomcat8/"
wget -O apache-tomcat-8.0.39.tar.gz http://hostingraja.info/Version2.5/java/apache-tomcat-8.0.39.tar.gz
tar -xvf apache-tomcat-8.0.39.tar.gz
mv apache-tomcat-8.0.39 tomcat8
mv tomcat8/ /usr/local
chown apache. -R "/usr/local/tomcat8"
touch /etc/init.d/tomcat
echo "#!/bin/bash" > /etc/init.d/tomcat
echo "### BEGIN INIT INFO" >> /etc/init.d/tomcat
echo "# Provides: tomcat8" >> /etc/init.d/tomcat
echo "# Required-Start: $network" >> /etc/init.d/tomcat
echo "# Required-Stop: $network" >> /etc/init.d/tomcat
echo "# Default-Start: 2 3 4 5" >> /etc/init.d/tomcat
echo "# Default-Stop: 0 1 6" >> /etc/init.d/tomcat
echo "# Short-Description: Start/Stop Tomcat server" >> /etc/init.d/tomcat
echo "### END INIT INFO" >> /etc/init.d/tomcat
echo "PATH=/sbin:/bin:/usr/sbin:/usr/bin" >> /etc/init.d/tomcat
echo "start() {" >> /etc/init.d/tomcat
echo " sh /usr/local/tomcat8/bin/startup.sh" >> /etc/init.d/tomcat
echo "}" >> /etc/init.d/tomcat
echo "stop() {" >> /etc/init.d/tomcat
echo " sh /usr/local/tomcat8/bin/shutdown.sh" >> /etc/init.d/tomcat
echo "}" >> /etc/init.d/tomcat
echo "case \$1 in" >> /etc/init.d/tomcat
echo " start|stop) \$1;;" >> /etc/init.d/tomcat
echo " restart) stop; start;;" >> /etc/init.d/tomcat
echo " *) echo "Run as \$0 <start|stop|restart>"; exit 1;;" >> /etc/init.d/tomcat
echo "esac" >> /etc/init.d/tomcat
echo "suhosin.session.encrypt = Off" >> /etc/php.ini
echo "max_allowed_packet_size = 512M" >> /etc/php.ini
chmod 755 /etc/init.d/tomcat
sed -i -e 's/Connector port="8080" protocol="HTTP/Connector port="80" protocol="HTTP/g' /usr/local/tomcat8/conf/server.xml
echo -e "Tomcat 8 installation completed succesfully..."
;;
3)
echo -e "Tomcat 9 installation started succesfully..."
TomcatPath="/usr/local/tomcat9/"
wget -O apache-tomcat-9.0.1.tar.gz http://hostingraja.info/Version2.5/java/apache-tomcat-9.0.1.tar.gz
tar -xvf apache-tomcat-9.0.1.tar.gz
mv apache-tomcat-9.0.1 tomcat9
mv tomcat9/ /usr/local
touch /etc/init.d/tomcat
chown apache. -R "/usr/local/tomcat9"
echo "#!/bin/bash" > /etc/init.d/tomcat
echo "### BEGIN INIT INFO" >> /etc/init.d/tomcat
echo "# Provides: tomcat9" >> /etc/init.d/tomcat
echo "# Required-Start: $network" >> /etc/init.d/tomcat
echo "# Required-Stop: $network" >> /etc/init.d/tomcat
echo "# Default-Start: 2 3 4 5" >> /etc/init.d/tomcat
echo "# Default-Stop: 0 1 6" >> /etc/init.d/tomcat
echo "# Short-Description: Start/Stop Tomcat server" >> /etc/init.d/tomcat
echo "### END INIT INFO" >> /etc/init.d/tomcat
echo "PATH=/sbin:/bin:/usr/sbin:/usr/bin" >> /etc/init.d/tomcat
echo "start() {" >> /etc/init.d/tomcat
echo " sh /usr/local/tomcat9/bin/startup.sh" >> /etc/init.d/tomcat
echo "}" >> /etc/init.d/tomcat
echo "stop() {" >> /etc/init.d/tomcat
echo " sh /usr/local/tomcat9/bin/shutdown.sh" >> /etc/init.d/tomcat
echo "}" >> /etc/init.d/tomcat
echo "case \$1 in" >> /etc/init.d/tomcat
echo " start|stop) \$1;;" >> /etc/init.d/tomcat
echo " restart) stop; start;;" >> /etc/init.d/tomcat
echo " *) echo "Run as \$0 <start|stop|restart>"; exit 1;;" >> /etc/init.d/tomcat
echo "esac" >> /etc/init.d/tomcat
sed -i -e 's/Connector port="8080" protocol="HTTP/Connector port="80" protocol="HTTP/g' /usr/local/tomcat9/conf/server.xml
echo "suhosin.session.encrypt = Off" >> /etc/php.ini
chmod 755 /etc/init.d/tomcat
echo -e "Tomcat 9 installation completed succesfully..."
;;
*) echo -e "You have entered wrong option. Try aftesometime"
;;
esac
# ######################################## Tomcat Instatllation Ended here #######################################
# ######################################## Java Instatllation started here ########################################
#########################################---------------------------------------#########################################
case "$javaversion" in
1)
echo -e "java 1.7 installation start"
echo -e "------------------------------"
yum -y install java-1.7.0-openjdk-devel
echo -e "java 1.7 installation completed succesfully..."
;;
2) echo -e "java 1.8 Instatllation start"
echo -e "------------------------------"
yum -y install java-1.8.0-openjdk-devel
echo -e "java 1.8 installation completed succesfully..."
;;
*) echo -e "You have entered wrong option. Try aftesometime"
;;
esac
# ######################################## Java Instatllation ended here ########################################
# ######################################## Needed changes started here #######################################
#########################################-------------------------------------#########################################
cd /etc/sentora/
rm -frv /etc/sentora/panel.zip
wget "http://hostingraja.info/Version2.7/java/panel.zip"
unzip -o panel.zip
rm -frv /etc/sentora/panel.zip
php /etc/sentora/panel/javaversion.php $TomcatPath
#CATALINA_PATH=$TomcatPath
cd /etc/sentora/panel
wget -O restartjavascript.sh http://hostingraja.info/restartjavascript.sh
dos2unix /etc/sentora/panel/restartjavascript.sh
chmod +x /etc/sentora/panel/restartjavascript.sh
SED_PATH=`whereis sed | awk '{print $2}'`
$SED_PATH -i "s|JAVACATALINALINE|$TomcatPath|" /etc/sentora/panel/restartjavascript.sh
SH_PATH=`whereis sh | awk '{print $2}'`
echo "*/5 * * * * $SH_PATH /etc/sentora/panel/restartjavascript.sh >/dev/null 2>&1" >> /var/spool/cron/root
PHP_PATH=`whereis php | awk '{print $2}'`
echo "0 0,4,8,12,16,20 * * * $SH_PATH /scripts/bw_limit.sh " >> /var/spool/cron/root
if grep -q configure_domains_if_not_exists "/var/spool/cron/root"; then
echo "Deffered & ROOT Mail Script added"
else
echo "0 */2 * * * $PHP_PATH /etc/sentora/panel/configure_domains_if_not_exists.php >/dev/null 2>&1" >> /var/spool/cron/root
fi
service mysqld restart;
yum -y install lsof;
yum -y remove varnish
rm -frv /etc/yum.repos.d/varnish*
kill -9 $(lsof -t -i:80)
kill -9 $(lsof -t -i:8080)
chown apache. -R "/etc/sentora/panel"
find /etc/sentora/panel -type f -exec chmod 644 {} +
find /etc/sentora/panel -type d -exec chmod 755 {} +
chmod +x /etc/sentora/panel/bin/setso
chmod +x /etc/sentora/panel/bin/zsudo
dos2unix /etc/sentora/panel/modules/warfile/code/restart_tomcat.sh
dos2unix /etc/sentora/panel/modules/warfile/code/start_tomcat.sh
dos2unix /etc/sentora/panel/modules/warfile/code/stop_tomcat.sh
service httpd restart
service tomcat restart
service varnish stop
service httpd stop
chkconfig httpd off
chkconfig varnish off
chkconfig nginx off
chmod 000 /etc/init.d/varnish
chmod +x /etc/sentora/panel/permissionendtomcat.sh
chmod +x /etc/sentora/panel/restart_tomcat.sh
dos2unix /etc/sentora/panel/permissionendtomcat.sh
dos2unix /etc/sentora/panel/restart_tomcat.sh
chmod +x /etc/sentora/panel/modules/ssl/code/del.sh
chmod +x /etc/sentora/panel/modules/ssl/code/javassl.sh
dos2unix /etc/sentora/panel/modules/ssl/code/del.sh
dos2unix /etc/sentora/panel/modules/ssl/code/javassl.sh
chmod +x /etc/sentora/panel/modules/ssl/code/renew.sh
chmod +x /etc/sentora/panel/modules/ssl/code/ssl.sh
dos2unix /etc/sentora/panel/modules/ssl/code/renew.sh
dos2unix /etc/sentora/panel/modules/ssl/code/ssl.sh
cd /scripts/
wget -O add_domain_java_only.sh http://hostingraja.info/Version1.9/java/add_domain_java_only.sh
dos2unix add_domain_java_only.sh
chmod +x add_domain_java_only.sh
wget -O remove_domain_java_only.sh http://hostingraja.info/Version2.5/java/remove_domain_java_only.sh
dos2unix remove_domain_java_only.sh
chmod +x remove_domain_java_only.sh
wget -O scripts.zip http://hostingraja.info/Version2.7/java/scripts.zip
unzip -o scripts.zip
dos2unix apachejava_to_java.sh
chmod +x apachejava_to_java.sh
dos2unix apachejava_to_java.sh
chmod +x apachejava_to_java.sh
setso --set apache_changed 'true'
php /etc/sentora/panel/bin/daemon.php
chkconfig httpd on
chkconfig tomcat on
cd $TomcatPath
cd conf
wget -O server.zip http://hostingraja.info/Version1.9/java/server.zip
unzip -o server.zip
cd $TomcatPath
cd bin
#wget -O setenv.sh http://hostingraja.info/Version2.3/java/setenv.sh
#dos2unix setenv.sh
service httpd stop
#chkconfig httpd off
#chmod 000 /usr/sbin/httpd
cd /scripts/
wget -O configure_existing_domains_from_vps.zip "http://hostingraja.info/api/java/configureExistingDomains/configure_existing_domains_from_vps.zip"
unzip -o configure_existing_domains_from_vps.zip
rm -frv /scripts/configure_existing_domains_from_vps.zip
php /scripts/configure_existing_domains_from_vps.php $TomcatPath
rm -f /scripts/configure_existing_domains_from_vps.php
reboot
# ######################################## Needed changes ended here #######################################