Thứ Năm, 16 tháng 8, 2007

How to install Tomcat 5.5.9 on Ubuntu

Installing Tomcat on Ubuntu

Versions:
SDK: 1.5
JRE: 1.5
Tomcat: 5.5.9

Step 1 – Install JRE and SDK

Download and install the Java Software Development Kit (SDK) and J2SE Runtime Environment (JRE). These packages are available through Synaptic (the extra repositories have to be added).

Or in terminal type:

Code:

sudo apt-get install sun-j2re1.5
sudo apt-get install sun-j2sdk1.5

N.B. SDK is 146MB and JRE is 84.7MB.
You can verify that both items were installed corectly, by checking that you get a response when typing in terminal:

Code:

java -version
javac -help
Step 2 – Get tomcat

Download tomcat 5.5 from http://jakarta.apache.org/site/downloads/

In this example I am using jakarta-tomcat-5.5.9.tar.gz

Uncompress the file:

Code:

sudo tar -zxvf jakarta-tomcat-5.5.9.tar.gz
N.B. To make things simpler I also renamed the package to just 'tomcat'. If you do not do this, make sure you adjust these tutorial instructions to the name of your package whenever you see 'tomcat' written.

Step 3 – Add tomcat

Place the uncompressed package in:

/usr/local/

Step 4 – Set JAVA_HOME and CLASSPATH

You need to point out where you installed Java SDK. You will have to edit the file '.bashrc'. Backup this file first!

In terminal type:

Code:

sudo gedit ~/.bashrc
Add the following lines to the file:

Code:

export JAVA_HOME=/usr/local/java/j2sdk1.5/
exprt CLASSPATH=/usr/local/tomcat/common/lib/jsp-api.jar:/usr/local/tomcat/common/lib/servlet-api.jar
N.B. remember to change the word tomcat to the name of the package you placed in /usr/local.

Save and close. You will have to log out and back in again before these changes take effect.


The next steps are optional. They are for setting tomcat up to be used as a development environment. Skip to the last step ( Step 8 ) if you just want to start tomcat how it is.


Step 5 – Change default port number


Tomcats default port number is 8080. To change it to 1024 or another number do the following.

In terminal type:

Code:

sudo gedit /usr/local/tomcat/conf/server.xml
Find the lines:

Connector port = "8080" ...
maxThreads = "150" minSpareThreads = "25" ....


Adjust the port number to 1024 (or any other port number you want to use), save and close.

The last step
Open Web Browser and type http://localhost:1024/

Good luck

Không có nhận xét nào: