Categories

Sunday, 20 March 2016

Installing Tomcat 8 on a CentOS 6 Linux VPS

In the following article we will guide you through the steps onhow to install the latest Tomcat 8 on a CentOS 6 Linux VPS.

What is Tomcat?

Apache Tomcat (previously known as Jakarta Tomcat) is an application server developed by the Apache Software Foundation that executes Java servlets and renders Web pages that include Java Server Page coding.

System Requirements?

    A Linux VPS Hosting
    JAVA 7+ Server



SETUP TOMCAT:



Step 1: Download the Tomcat zip file from the below link
wget http://mirror.fibergrid.in/apache/tomcat/tomcat-8/v8.0.32/bin/apache-tomcat-8.0.32.zip

Step 2: Tar and Unzip the Tomcat folder
tar xvfz apache-tomcat-8.0.32.zip
unzip apache-tomcat-8.0.32.zip

Step 3: Cretae a directory "tomcat" under /usr/local/
mkdir tomcat

Step 4: Now move apache-tomcat-8.0.32 to /usr/local/tomcat/ using below command
mv apache-tomcat-8.0.32 /usr/local/tomcat/

Step 5: Now go to the path (cd /usr/local/tomcat/apache-tomcat-8.0.32/  ) and please copy current working directory using "pwd" commnd.(/usr/local/tomcat/apache-tomcat-8.0.32)

Step 6: Edit the profile file
vim /etc/profile

Add the below lines under export section

export CATALINA_HOME=/usr/local/tomcat/apache-tomcat-8.0.32
export PATH=${PATH}:{CATALINA_HOME}/bin

Save and Exit

Step 7: Run the command : source /etc/profile

Step 8: Check the path you just entered using the below command
echo $CATALINA_HOME

Step 9: Now go to cd /usr/local/tomcat/apache-tomcat-8.0.32/bin/

Here if you are listing all the files on this path , you can see startup.sh  and shutdown.sh  files

Step 10: Run the command under this path (/usr/local/tomcat/apache-tomcat-8.0.32/bin/) :

Run this to make all .sh file as executable file :  chmod +x *
Run this to start tomcat : ./startup.sh
Run this to stop  tomcat : ./shutdown.sh

Step 11: Now check in browser with the Url: http://localhost:8080

It will display the tomcat default page.

Step 12: Now go to the path :  /usr/local/tomcat/apache-tomcat-8.0.32/conf

Under (/usr/local/tomcat/apache-tomcat-8.0.32/conf) edit the .xml file (tomcat-users.xml)

Vim tomcat-users.xml

(under line number : 29)
----------------
<role rolename="manager-gui"/>
<user username="tomcat" password="set-new-password" roles="manager-gui"/>
----------------
Save and exit

Step 13: Go to /usr/local/tomcat/apache-tomcat-8.0.32/bin and below command

./shutdown.sh
./startup.sh   ( bash ./startup.sh )

Step 14: NOW check http://localhost:8080 and click manager and then use the credentials to login


Wednesday, 16 March 2016

Steps to enable Password based authentication on linux server

Setp 1 : Edit the file sshd_config

vim /etc/ssh/sshd_config

Step 2 : Make changes on line 66 as below (ie from 'no' to 'yes')

PasswordAuthentication yes

Step 3 : Restart the sshd service using below command

/etc/init.d/sshd restart

(Till now password based auth is enabled)

Step 4 : To set passsword

Type the below command

#passwd
Changing password for user root.
New password: <enter password here>
Retype new password: <enter password here>
passwd: all authentication tokens updated successfully.

Step 5 : Thats All You Are Done !!!!

Password based authentication is enabled on the server.