Article Title: install and configure Tomcat5.5 in Ubuntu8.04. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Using JSP as a website and using Tomcat as a server is a good choice. Here, I will share with you my own Tomcat installation experience and hope to give you some reference.
Since it is Ubuntu, we need to make good use of the "New Software Package Manager.
1. Tomcat requires jdk support, so let's talk about jdk installation first. If jdk has been installed, you can check 2nd items directly.
1.1 install jdk
Search for "sun-java" in the new, install the latest jdk, such as "sun-java6-jdk", and then click the application to automatically complete the installation.
1.2 configure jdk Environment Variables
The installation is automatic, but the configuration needs to be done by yourself.
1.2.1 modify user environment variables
$ Vi/home/fancy (your user name)/. bashrc
Add the following to the. bashrc file:
Export JAVA_HOME = "/usr/lib/jvm/java-6-sun"
Export CLASSPATH = "$ CLASSPATH: $ JAVA_HOME/lib: $ JAVA_HOME/jre/lib"
Export PATH = "$ PATH: $ JAVA_HOME/bin"
1.2.2 modify environment variables of all users
$ Sudo vi/etc/profile
Add:
Export JAVA_HOME = "/usr/lib/jvm/java-6-sun"
Export CLASSPATH = "$ CLASSPATH: $ JAVA_HOME/lib: $ JAVA_HOME/jre/lib"
Export PATH = "$ PATH: $ JAVA_HOME/bin"
2. Tomcat installation and configuration, which is the key here
2.1 install Tomcat through the new version
This is not much to say. Search for "tomcat" and select the corresponding software package and then apply it.
2.2Tomcat Configuration
This is the focus.
$ Sudo vi/etc/profile
Join:
Export CATALINA_HOME = "/usr/share/tomcat5.5"
Note:
A. It is incorrect to set atat_home in some places on the Internet;
B. you need to modify conf/server. xml and web. xml, which is not required when using the new version in ubuntu (of course, you can change it later, but it is not required during the first installation ).
OK. The configuration is complete. Restart! After the computer is restarted, changes to/etc/profile will take effect.
3. Start the Tomcat Service
3.1 go to/usr/share/tomcat5.5/bin. You can see several bash scripts in it.
$./Startup. sh
You can start the service.
Note that you can use tomcat directly as a web server without installing apache.
Run. /Startup. sh:
Using CATALINA_BASE:/usr/share/tomcat5.5
Using CATALINA_HOME:/usr/share/tomcat5.5
Using CATALINA_TMPDIR:/usr/share/tomcat5.5/temp
Using JRE_HOME:/usr/lib/jvm/java-6-sun
3.2 run. /Startup. sh may cause the following problems:
Touch: cannot touch '/usr/share/tomcat5.5/logs/catalina. out': Permission denied. /catalina. sh: 323: cannot create/usr/share/tomcat5.5/logs/catalina. out
The reason is that the permission for the logs directory after installation is insufficient. You can change it as follows:
$ Sudo chmod 766./logs-R
4. Check whether the service is successfully enabled
Open your browser and enter http: // localhost: 8180.
The default port of Tomcat is 8180.
Change
In this way, you can directly access http: // localhost.
If the service is enabled normally, the home page of Tomcat is displayed.
5. Close the service
Run shutdown. sh under bin.
$./Shutdown. sh
Normally, the following results are displayed:
Using CATALINA_BASE:/usr/share/tomcat5.5
Using CATALINA_HOME:/usr/share/tomcat5.5
Using CATALINA_TMPDIR:/usr/share/tomcat5.5/temp
Using JRE_HOME:/usr/lib/jvm/java-6-sun