Setting Up Tomcat 5 on Ubuntu 6.06
2007-06-26 19:11
483 查看
First a quick overview of what we are going to do:
1. install software
2. change 1 line in a configuration file.
3. start the Tomcat5 service
4. go to http://localhost:8180
And now for the good stuff.
First we want to install the right packages. basically we want to install apache2, a java jdk and tomcat (duh). I’ve chosen to use Sun’s java implementation. To install this you need to enable the multiverse repository. See this section of the Unofficial Ubuntu Starter Guide for help with enabling additional repositories. To install Tomcat itself you will also need to have the universe repository enabled.
Note: For Tomcat you MUST have a jdk not just a jre.
So, for the basic install use the following command.
sudo apt-get install apache2 tomcat5 sun-java5-jdk
If you want a shiny Tomcat welcome page when we finally get that far then install the example apps by adding tomcat5-webapps to the end of the last command. For the Tomcat admin web interface add tomcat5-admin, too.
My final command looks like this.
sudo apt-get install apache2 tomcat5 sun-java5-jdk tomcat5-webapps tomcat5-admin
By default Ubuntu uses a free Java implementation. We now need to tell Ubuntu that we want to use Sun Java as the default. Run the following command.
sudo update-alternatives --config java
Then enter the number of the version of Java you want from the list when prompted. The one I wanted was /usr/lib/jvm/java-1.5.0-sun/jre/bin/java.
Now we need to tell Tomcat where the jdk is. Open /etc/default/tomcat5 and change the variable JAVA_HOME to read…
JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun/
Make sure it’s NOT got a “#” at the start of the line. You can should now be able to start Tomcat5 with…
sudo /etc/init.d/tomcat5 start
Tomcat is listening on port 8180. So open up firefox and enter http://localhost:8180 in the address bar. Once the page loads you should see either a tomcat welcome page or, if you chose not to install the examples and admin packages, a fairly empty page with “Apache Tomcat/5.0″ at the bottom left. Congrats, you just installed a working Tomcat service. If you don’t see one of these pages, either you or I screwed up. ;)
If you installed them, the example apps can be found in “/usr/share/tomcat5/webapps/“. Also take a look at the configuration files in “/etc/tomcat5/“.
Hope that was helpful.
Update: Manolo Canga added a section in his Spanish translation of this tutorial that I’ve translated into English below.
Setting up an admin user
If you try to use the admin interface you’ll find you can’t because no admin user has been set up. To resolve that go into /var/lib/tomcat5/conf and edit tomcat-users.xml. You’ll see that 3 users have been created by default. We’re going to change the password of the user “tomcat” (<user username="tomcat" ) to something better than the default of “tomcat”. Duh!? Now we are going to give the user “tomcat” admin access. Add “admin” to the user tag’s roles attribute. It should look smilar to this.
<user username="tomcat" password="your_password" roles="tomcat,admin"/>
Now restart tomcat…
sudo /etc/init.d/tomcat5 restart
…and you’re done!
1. install software
2. change 1 line in a configuration file.
3. start the Tomcat5 service
4. go to http://localhost:8180
And now for the good stuff.
First we want to install the right packages. basically we want to install apache2, a java jdk and tomcat (duh). I’ve chosen to use Sun’s java implementation. To install this you need to enable the multiverse repository. See this section of the Unofficial Ubuntu Starter Guide for help with enabling additional repositories. To install Tomcat itself you will also need to have the universe repository enabled.
Note: For Tomcat you MUST have a jdk not just a jre.
So, for the basic install use the following command.
sudo apt-get install apache2 tomcat5 sun-java5-jdk
If you want a shiny Tomcat welcome page when we finally get that far then install the example apps by adding tomcat5-webapps to the end of the last command. For the Tomcat admin web interface add tomcat5-admin, too.
My final command looks like this.
sudo apt-get install apache2 tomcat5 sun-java5-jdk tomcat5-webapps tomcat5-admin
By default Ubuntu uses a free Java implementation. We now need to tell Ubuntu that we want to use Sun Java as the default. Run the following command.
sudo update-alternatives --config java
Then enter the number of the version of Java you want from the list when prompted. The one I wanted was /usr/lib/jvm/java-1.5.0-sun/jre/bin/java.
Now we need to tell Tomcat where the jdk is. Open /etc/default/tomcat5 and change the variable JAVA_HOME to read…
JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun/
Make sure it’s NOT got a “#” at the start of the line. You can should now be able to start Tomcat5 with…
sudo /etc/init.d/tomcat5 start
Tomcat is listening on port 8180. So open up firefox and enter http://localhost:8180 in the address bar. Once the page loads you should see either a tomcat welcome page or, if you chose not to install the examples and admin packages, a fairly empty page with “Apache Tomcat/5.0″ at the bottom left. Congrats, you just installed a working Tomcat service. If you don’t see one of these pages, either you or I screwed up. ;)
If you installed them, the example apps can be found in “/usr/share/tomcat5/webapps/“. Also take a look at the configuration files in “/etc/tomcat5/“.
Hope that was helpful.
Update: Manolo Canga added a section in his Spanish translation of this tutorial that I’ve translated into English below.
Setting up an admin user
If you try to use the admin interface you’ll find you can’t because no admin user has been set up. To resolve that go into /var/lib/tomcat5/conf and edit tomcat-users.xml. You’ll see that 3 users have been created by default. We’re going to change the password of the user “tomcat” (<user username="tomcat" ) to something better than the default of “tomcat”. Duh!? Now we are going to give the user “tomcat” admin access. Add “admin” to the user tag’s roles attribute. It should look smilar to this.
<user username="tomcat" password="your_password" roles="tomcat,admin"/>
Now restart tomcat…
sudo /etc/init.d/tomcat5 restart
…and you’re done!
相关文章推荐
- Setting up NFS on Ubuntu 10.04 Server
- Setting up Ethereum smart contract development using Parity on Ubuntu
- Setting up PhoneGap on Ubuntu for Android app development
- Setting up Telnet server on Ubuntu
- Setting up a Subversion Server on Ubuntu Gutsy Gibbon server
- Setting Up OpenERP (Odoo) 9 with Nginx on RHEL/CentOS and Debian/Ubuntu
- Setting up Hudson on port 80 on a Debian or Ubuntu machine
- config Tomcat service on ubuntu14 server as daemon thread
- Setting up ccache on android 4.0.3
- Setting up Initial Tomcat Administration
- apache Setting on ubuntu
- getting git-svn up and running on ubuntu
- Setting up your Windows computer to run JPetStore 3.x with MySQL and Tomcat
- Setting up a Single Node Cluster on hadoop-0.23.9
- How To Set Up Database Replication In MySQL On Ubuntu
- How To Set Up Apache Virtual Hosts on Ubuntu 14.04 LTS
- 转载:Setting Up ADB/USB Drivers for Android Devices in Linux (Ubuntu)
- How To Set Up a Private Docker Registry on Ubuntu 14.04
- How to set up IceScrum on Ubuntu 12.04