PostgreSQL is a open source object-relational, highly scalable, SQL compliant database management system. PostgreSQL is developed at the University of California at Berkeley Computer Science Department. Step… Read more “PostgreSQL”

Tomcat in centos

Step 1: Verify JAVA
JAVA is the first requirement of Tomcat installation. Use following command to check if you have java installed already on your system.
[server@localhost ~]$ java -version
java version “1.8.0_25”
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
Tomcat 8.0 is designed to run on Java SE 7 and later.

Step 2: Download and Extract Tomcat Archive
# cd /opt
# wget
# tar apache-tomcat-8.0.15.tar.gz

Step 3: Setup Environment Variable
Before starting Tomcat, Configure environment variables using following commands.
# echo “export CATALINA_HOME=”/opt/apache-tomcat-8.0.15″” >> ~/.bashrc
# source ~/.bashrc

Step 4: Start Tomcat Service
# cd apache-tomcat-8.0.15
# ./bin/
[redmoon@fenige_www_dev apache-tomcat-8.0.15]$ sudo ./bin/
Using CATALINA_BASE: /opt/apache-tomcat-8.0.15
Using CATALINA_HOME: /opt/apache-tomcat-8.0.15
Using CATALINA_TMPDIR: /opt/apache-tomcat-8.0.15/temp
Using JRE_HOME: /usr
Using CLASSPATH: /opt/apache-tomcat-8.0.15/bin/bootstrap.jar:/opt/apache-tomcat-8.0.15/bin/tomcat-juli.jar
Tomcat started.

Step 5: Access Tomcat in Browser

Step 6: Setup User Accounts
Finally we need to create user accounts to secure and access admin/manager pages. Edit conf/tomcat-users.xml file in your editor and paste inside <tomcat-users> </tomcat-users> tags.

[root@localhost]# cat tomcat-users.xml
<?xml version=’1.0′ encoding=’utf-8′?>
<role rolename=”tomcat”/>

<role rolename=”manager-gui”/>

<role rolename=”admin-gui”/>

<user username=”test1″ password=”secret” roles=”manager-gui,admin-gui”/>
<user username= “test2″ password=”secret” roles=”manager-gui,admin-gui”/>
<user username=”test3″ password=”secret” roles=”admin-gui,manager-gui”/>

And its ready to use these users, you can restart the tomcat and access http://your_ip_address:8080/, click the manger app or host manger etc.

How to start tomcat at the system startup:
Create tomcat8 file in /etc/init.d/ like this:
#vi /etc/init.d/tomcat8
and paste following code:

export CATALINA_HOME=/your/path/here ( for eg: the path where my tomcat  is installed /opt/apache-tomcat-8.0.15 )
start() {
stop() {
case $1 in
start|stop) $1;;
restart) stop; start;;
*) echo “Run as $0 “; exit 1;;
And later modify /etc/init.d/tomcat8 file permissions:
#chmod 755 /etc/init.d/tomcat8
And we can start or stop the tomcat… 🙂