1. First, make sure that you have installed jdk and set the JAVA_HOME environment variable. Then 1. First, make sure that you have installedJdk With settingsJAVA _HOME Environment variable.
ThenHttp://tomcat.apache.org/ DownloadApache-tomcat-6.0.35.tar.gz, I move it/Usr/local/webserver/ Then Enter Run
Code:
[Plain]
- 1. sudo tar apache-tomcat-6.0.35.tar.gz zxvf
Get a folderApache -- tomcat-6.0.35,At this time,TomcatThe installation is complete.
2. Then SetJAVA_HOME Environment variables. The solutions are listed below.
Run Code :
[Plain]
- 1. sudo vi/usr/local/webserver/apache-tomcat-6.0.35/bin/catalina. sh
ModifyCatalina. shFile, which is inserted after being commented at the beginning of the file
Reference:
[Plain]
- 1. JAVA_HOME = "/usr/lib/jvm/java/jdk1.6.0 _ 30"
Note: The above path is the jdk path you have installed.
3. Then execute Code :
[Plain]
- 1. sudo/usr/local/webserver/apache-tomcat-6.0.35/bin/startup. sh
In this way, the instance can be started successfully.Tomcat.
4. Haha, add the last step: easily start, close, and restartTomcat
InSudoVi~ /. Bashrc File:
Reference:
[Plain]
- 1. alias starttomcat = 'sudo/usr/local/webserver/apache-tomcat-6.0.35/bin/startup. Sh'
- 1. alias shutdowntomcat = 'sudo/usr/local/webserver/apache-tomcat-6.0.35/bin/shutdown. Sh'
- 1. alias restarttomcat = 'shutdowntomcat & starttomcat'
Then execute
Code:
[Plain]
- 1. source ~ /. Bashrc
Then you can use:
Starttomcat: Enable tomcat
Shutdowntomcat: Disable tomcat
Restarttomcat: restart tomcat
5. You can modify the server. xml file to omit the Port during access. For example, the default port of tomcat-6.0.35 is 8080. to change it to 80, perform the following operations:
Code
[Plain]
- 1. sudo vi/usr/local/webserver/apache-tomcat-6.0.35/conf/server. xml
Modify server. xml, change all the numbers to 80, and change the Port location
Reference
Port 80 is special. If you change the port to 80, you can directly enter http: // localhost/in the address bar to access your web