Ubuntu Tomcat initial configuration 1, download the tomcat installation package from the tomcat official website http://tomcat.apache.org download installation package, and then extract to a directory, such :~ In the/opt/apache-tomcat-7.0.63 official documents, we recommend that you do not use the installation packages already installed in each Linux release, because the installation packages in each release install tomcat in different locations, therefore, we recommend that you do not use tomcat in the source. $ Initial configuration of Tomcat in tarxz Ubuntu 1. Download the tomcat installation package
Download the installation package from the official tomcat website http://tomcat.apache.org, and then extract it to a directory, such :~ /Opt/apache-tomcat-7.0.63
We recommend that you do not use the installation packages that have been installed in each Linux release, because the installation packages in each release install tomcat in different locations. Therefore, we recommend that you do not use tomcat in the source.
$ Tar xzvf apache-tomcat-7.0.63.tar.gz-C ~ /Opt
2. Listen to port 80
Modify server. xml in the conf directory under the tomcat installation directory
$ Cd ~ /Opt/apache-tomcat-7.0.63/conf
$ Vim server. xml
...
...
3. Add users
Modify the tomcat-users.xml file under the conf directory under the Tomcat 7 installation directory
$ Cd ~ /Opt/apache-tomcat-7.0.63/conf
$ Vim tomcat-user.xml.
...
...
4. Set the working directory
The default directory of web programs under Tomcat is $ TOMCAT_INSTALL_DIR/webapps. You only need to place your web program directory in this directory, but you usually need to set your own working directory. Two methods:
1) Use the docBase variable in Context to set
$ Vim $ TOMCAT_INSTALL_DIR/conf/Catalina/localhost/mywebapp. xml
Note: For Versions later than tomcat 5.5, you do not need to set the path variable. tomcat determines the path based on the file name. For example, if the file name is mywebapp. xml, the path is/mywebapp.
2) Soft link
$ Cd $ TOMCAT_INSTALL_DIR/webapps
$ Ln-s ~ /Working/project/program/webapps/mywebapp
5. install Tomcat as a service started with the System
1) set the JAVA_HOME environment variable in the $ TOMCAT_INSTALL_DIR/bin/setenv. sh script.
$ Vim $ TOMCAT_INSTALL_DIR/bin/setenv. sh
#! /Bin/sh
JAVA_HOME =/usr/lib/jvm/java-7-openjdk-i386
2) Copy $ TOMCAT_INSTALL_DIR/bin/catalina. sh to the/etc/init. d directory, add the LSB setting information at the beginning of the script, and set the tomcat installation environment variable:
$ Sudo cp catalina. sh/etc/init. d/tomcat
$ Sudo vim/etc/init. d/tomcat
### BEGIN INIT INFO
# Provides: apache-tomcat
# Required-Start: $ all
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Run/etc/rc. local if it exist
### END INIT INFO
CATALINA_HOME = "/home/cb/opt/apache-tomcat-7.0.63"
Cd $ CATALINA_HOME/bin
3) install the service
$ Sudo update-rc.d-f tomcat ults
4) start/stop the service
$ Sudo service tomcat start
$ Sudo service tomcat stop
6. Test
$ Sudo service tomcat start
Then, open the browser and enter: http: // localhost
The above test passed in Ubuntu 14.04.
For more Tomcat-related tutorials, see the following content::
Install and configure the Tomcat environment in CentOS 6.6Http://www.linuxidc.com/Linux/2015-08/122234.htm
RedHat Linux 5.5 install JDK + Tomcat and deploy Java project http://www.linuxidc.com/Linux/2015-02/113528.htm
Tomcat authoritative guide (second edition) (Chinese and English PDF + with bookmarks) http://www.linuxidc.com/Linux/2015-02/113062.htm
Tomcat secure configuration and performance optimization http://www.linuxidc.com/Linux/2015-02/113060.htm
Linux using Xshell view Tomcat real-time log Chinese garbled solution http://www.linuxidc.com/Linux/2015-01/112395.htm
CentOS 64-bit install JDK and Tomcat and set Tomcat boot operation steps http://www.linuxidc.com/Linux/2015-01/111485.htm
Install Tomcat http://www.linuxidc.com/Linux/2015-01/111415.htm in CentOS 6.5
Tomcat details: Click here
Tomcat: Click here
This article permanently updates the link address: Http://www.linuxidc.com/Linux/2015-08/122464.htm