Configure Tomcat under Ubuntu

Source: Internet
Author: User

1. Download Tomcat

http://tomcat.apache.org/, download tomcat 8 (since the latest eclipse does not support Tomcat 9)

Extract the downloaded apache-tomcat-8.0.35.tar.gz to any folder, and then apache-tomcat-8.0.35 the extracted folder to the directory/opt

sudocp -r apache-tomcat-8.0.35 /opt###(注意先打开到所解压的文件夹)

2. Configure Environment variables

Edit apache-tomcat-8.0.35/bin/startup.sh

sudogedit /opt/apache-tomcat-8.0.35/bin/startup.sh

Put the following in the startup.sh exec "$PRGDIR"/"$EXECUTABLE" start "[email protected]" above

JAVA_HOME=/usr/lib/jdk1.8.0_91JRE_HOME=${JAVA_HOME}/jrePATH=$JAVA_HOME/bin:$PATHCLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jarTOMCAT_HOME=/opt/apache-tomcat-8.0.35

Note Modify your own JDK directory and the Tomcat folder

Also put this content in the directory of the Shutdown.sh

sudogedit /opt/apache-tomcat-8.0.35/bin/shutdown.sh

3. Operation

Launch Tomcat, browser address bar input: localhost:8080 for verification

sudo/opt/apache-tomcat-8.0.35/bin/startup.sh

Close Tomcat

sudo/opt/apache-tomcat-8.0.35/bin/shutdown.sh

Write in front:

installed, referring to a lot of online information, there are a lot of people to write some simple, others over the version of a little update, like me small white can not find the cardinal point, tossing for two days, just to get a why. So, here, I write down the whole process of myself in detail. So that everyone can make a reference.

To install the JDK:

First of all, we want Baidu "jdk", download on the official website. Here is the address I downloaded: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

I choose to be jdk-8u31-linux-x64.tar.gz. Because it's an Ubuntu system. Do not select the RPM suffix, which is used by Red Hat Linux.

When I download it, I use the default path of the browser, which is the "Downloads" folder.

Here, I refer to a Baidu experience, I just do this, but, in the middle there is a little place, need to remind. The address of this Baidu experience:

Http://jingyan.baidu.com/article/647f0115bb26817f2048a871.html

Create a directory/USR/LIB/JVM in order to put the downloaded package into this directory.

Unzip and place the extracted jdk1.8.0_25 folder in the/USR/LIB/JVM directory. Note: I am now downloading the installation package in the desktop directory so directly in the desktop directory under Operation, if you downloaded the installation package is not in the Desktop directory, please first CD into the appropriate directory, and then continue to operate.

(Explanation: Here, different times, download the JDK version is not the same, just need to put the name of the good. For example, when I download, the version is jdk-8u31-linux-x64.tar.gz, so, when I write, the command is sudo tar zxvfjdk-8u31-linux-x64.tar.gz-c/usr/lib/ JVM) Notice the space, there is only one space between the command and the arguments that follow.

Go to the/USR/LIB/JVM directory

After entering the directory, you will start to configure the environment variables. After entering the directory, the commands I use are:

sudo gedit ~/.profile

Then, enter the password, open the file, and at the end of the file, add the path. Then, save, and exit on it. As shown in.

Export java_home=/usr/lib/jvm/jdk1.8.0_31/
Export JRE_HOME=/USR/LIB/JVM/JDK1.8.0_31/JRE
Export classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar: $JAVA _home/lib: $JRE _home/lib: $CLASSPATH
Export path= $JAVA _home/bin: $PATH

If you follow the steps above, you can copy this paragraph, and then change the previous two items to your own JDK version. Then, paste it in.

After saving exit, enter the following code

Then, you can test it. Enter java-version inside the terminal

Input This command is used to reload a configuration, but sometimes I try not to use, restart the system, just can.

So, if it doesn't work, restart it.

Test, the following results will be installed, you can enjoy writing Java programs.

In this process, I have no problem. Have a question, leave a message to discuss. Then, it is the installation of Tomcat.

Configure Tomcat under Ubuntu

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.