Tomcat can act as a completely separate Web server. The biggest advantage of Tomcat is the servlet and JSP engines.
To install Tomcat:
Sudo Yum install-y tomcat-*
To start Tomcat:
[User@localhost ~]$/etc/rc.d/init.d/tomcat start
[User@localhost ~]$
[User@localhost ~]$/etc/rc.d/init.d/tomcat Status
[User@localhost ~]$
As shown above, the boot process does not have any output, and there is no output to view the service status, stating that the service startup was unsuccessful.
Why is it?
Think of/etc/rc.d/init.d/tomcat as a bash script, so you can debug it with the following debugging methods:
[User@localhost ~]$ bash-x/etc/rc.d/init.d/tomcat Status
+ ' ['-r/lib/lsb/init-functions '] '
+ Exit 1
[Email protected] ~]$
From the above output can be, the problem is not found in the/lib/lsb/init-functions file. OK, let's find out which rpm the file belongs to.
Package.
[email protected] ~]$ Yum whatprovides/lib/lsb/init-functions
Loaded plugins: LangPacks, Refresh-packagekit
REDHAT-LSB-CORE-4.1-14.FC19.I686:LSB Core Module Support
Source
: Fedora
Match Source:
Filename
:/lib/lsb/init-functions
redhat-lsb-core-4.1-14.fc19.x86_64: Source
: Fedora
Match Source:
Filename
:/lib/lsb/init-functions
LSB Core Module Support
REDHAT-LSB-CORE-4.1-15.1.FC19.I686:LSB Core Module Support
Source
: Updates
Match Source:
Filename
:/lib/lsb/init-functions
REDHAT-LSB-CORE-4.1-15.1.FC19.X86_64:LSB Core Module Support
Source
: Updates
Match Source:
Filename
:/lib/lsb/init-functions
Oh, it turns out that Tomcat relies on package redhat-lsb-core, but not in Tomcat's requires, pit!
Below, put the redhat-lsb-core to look.
[email protected] ~]$ sudo yum install-y redhat-lsb-core
Loaded plugins: LangPacks, Refresh-packagekit
Resolving dependencies
--Checking transactions
---> Package redhat-lsb-core.x86_64.0.4.1-15.1.fc19 will be installed
--Resolve dependency completion
Dependency resolution
========================================================================
===================================================================
Package
Architecture
Version
Source
Size
========================================================================
===================================================================
Installing:
Redhat-lsb-core
x86_64
4.1-15.1.fc19
Updates
K
Transaction summary
========================================================================
===================================================================
Installing the 1 package
Total Downloads: $ k
Installation Size: K
Downloading packages:
redhat-lsb-core-4.1-15.1.fc19.x86_64.rpm
| KB 00:00:02
Running transaction Check
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing 1/1
Verification in 1/1
has been installed:
Redhat-lsb-core.x86_64 finished!
0:4.1-15.1.fc19
Redhat-lsb-core-4.1-15.1.fc19.x86_64
Redhat-lsb-core-4.1-15.1.fc19.x86_64
Start Tomcat again and try again.
[[email protected] ~]$ Sudo/etc/rc.d/init.d/tomcat start
Starting tomcat:[OK]
[Email protected] ~]$
OK, start success!
Enter http://127.0.0.1:8080/in the Web browser to see if the service is running and can be accessed:
Turn Tomcat off:
[[email protected] ~]$ Sudo/etc/rc.d/init.d/tomcat stop
stopping tomcat: [OK]
[Email protected] ~]$
At this point, the installation, startup, and shutdown are completed successfully.
Linux system installation, startup, and shutdown Tomcat