In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-08 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article focuses on "installation and environment settings of Linux JDK and TOMCAT". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn the installation and environment settings of Linux JDK and TOMCAT.
1. JDK
Enter the installation directory
# cd / home
# cp jdk-1_5_0_02-linux-i586.rpm / usr/local
# cd / usr/local
Add executable permissions to all users
# chmod + x jdk-1_5_0_02-linux-i586.rpm.bin
#. / jdk-1_5_0_02-linux-i586.rpm.bin
The file jdk-1_5_0_02-linux-i586.rpm is generated, and executable permissions are also added to all users
# chmod + x jdk-1_5_0_02-linux-i586.rpm
Installation program
# rpm-ivh jdk-1_5_0_02-linux-i586.rpm
If the installation agreement appears, just press accept.
two。 Set the environment variable.
# vi / etc/profile
Join at the end
# set java environment
JAVA_HOME=/usr/java/jdk-1_5_0_02
CLASSPATH=.:$JAVA_HOME/lib.tools.jar
PATH=$JAVA_HOME/bin:$PATH
Export JAVA_HOME CLASSPATH PATH
Save exit.
To make JDK available to all users, you can do this:
Vi / etc/profile.d/java.sh
Enter the following in the new java.sh:
# set java environment
JAVA_HOME=/usr/java/jdk-1_5_0_02
CLASSPATH=.:$JAVA_HOME/lib/tools.jar
PATH=$JAVA_HOME/bin:$PATH
Export JAVA_HOME CLASSPATH PATH
Save exit and assign permissions to java.sh: chmod 755 / etc/profile.d/java.sh
2.TOMCAT
As a result of doing the project, I need to deploy the Web application to the Linux system, and need to configure the SSL-two-way connection. I used Linux before when I was at school, but it is only superficial, so I need to re-use it this time, so I summarize it and use the automatic running program Cron under Linux at the same time. The software environment version is as follows:
Operating system: RedHat Enterprise Linux V.4
JDK:jdk1.5.0_09
Tomcat:5.5.17
First of all, install the Linux system, I do the project with the Linux system is a more expensive enterprise version. There are mainly the following important steps in the installation process (since there are more detailed wizards in the installation process, I will not repeat them here):
Installation process wizard language, if English is good, you can use English, if you are not familiar with it, it is better to install in simplified Chinese.
Automatic partitioning or manual partitioning can be used when partitioning, and since it is limited to experimental use, the entire directory structure has only one root directory (/) and SWAP partition.
Because this system needs to use SSL secure connection, and the firewall of Linux is open to SSL and other ten, so it needs to be turned off during the installation process.
When setting up the network during installation, it is set according to the actual situation. If it is only used as an experimental study, the hostname can be set to localhost, which is very convenient for the future setting of the system.
When setting up system users, you can create your own new account (recommended), or you can use only one root user (as an experimental learning time).
When you choose to install components, you can choose to customize the installation. during the installation process, it is best to directly choose to install some compilers, such as gcc, etc., so that you can avoid the problem of reinstalling the compiler during compilation and installation. (the operation is to select the project of the development tool):
When everything is in place, you can install it. There are four CDs in the version installed by the author, and you can follow the installation wizard until the end of the installation. The system needs to be rebooted at the end. After rebooting the system, make a series of settings, test the sound card, create an account, register, and so on. (registration can be skipped) finally log in to the system:
Suggestion: 1. Because it is only a testable system, in order not to affect your own system, you can install the Linux system in a virtual machine, so that it can be deleted at any time when you do not need it, and it will not cause any trouble.
two。 Another thing to pay attention to is to select the FTP service during installation, that is, to install, and then build a FTP server on this machine, so that you can access the Windows operating system and transfer files.
After installing Linux, you can install the environment software.
First of all, download the above environment software, save it in the custom directory after the download is completed, and the author defines the directory as / usr/zhangzhongl, and then the first thing to do is to modify the execution permissions of these downloaded files so as to make them executable. Enter the custom directory and execute chmod 777 * to maximize the permissions.
Install JDK, enter the custom directory, and execute
. / jdk1_5_0_10-linux-i586.bin
Jdk installation can be carried out, the need to agree to the license agreement during the installation process, after the normal installation, will be in the same layer of jdk1_5_0_10-linux-i586.bin file directory generated a jdk directory, the author jdk directory for jdk1.5.0_10, copy it to the directory you want to place, it is recommended to set the directory structure short better, set environment variables more convenient. The author's jdk directory is / usr/jdk1.5.0_10.
After the installation is complete, set the environment variable and execute the following command:
Cd / etc
Vi profile.d/java.sh
Add the following to the file: (where TOMCAT_HOME is a non-essential item, just add it here first to save future work)
# set java environment variables
Export JAVA_HOME=/usr/jdk1.5.0_10
Export TOMCAT_HOME=/usr/tomcat
Export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:.
Export PATH=$PATH:$JAVA_HOME/bin
Note here that the delimiter in the * nix system is a colon and the semicolon in Windows from time to time.
After setting up, restart the system, then open a new terminal and execute commands such as java,javac,java-version. If you can print out the corresponding information, it means that jdk is installed successfully and the environment variable is set successfully.
Install TOMCAT
To install TOMCAT, you only need to extract the TOMCAT (in general, Linux comes with a tool to extract .gz, .tar format files, double-click), and store it in a custom directory. The author's custom directory is: / usr/tomcat.
You can then set the TOMCAT_HOME environment variable (already set above). Go to the $OMCAT/bin directory and execute the. / startup.sh command to start TOMCAT. After executing the command, you can see some environment variables of TOMCAT:
Then enter http://localhost:8080/, hehe, that kitten is still cute! TOMCAT has been installed, so we can deploy our application.
Copy the packaged war file to the $TOMCAT_HOME/webapps directory and start TOMCAT to deploy the application.
Next, let's introduce the Cron program of Linux, which is similar to the task management of Windows. It can automatically run the specified program at a specified time, and send an email to the administrator to report the operation of the program. This article does not describe the program in detail. There are many related articles on the network that you can refer to. Just give a practical example as a reference.
The project needs a program that generates a certificate revocation list (CRL), runs automatically, executes at 00:05:00 every day, logs the execution: success or failure, and notifies the administrator by email if it fails.
The execution process is as follows:
Cd etc enters the directory
Crontab-e edits Cron program files for root users
Each user has his or her own custom running program, depending on which account to log in with.
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/jdk1.5.0_10/bin
MAILTO=root
HOME=/usr/app
05 00 * java-jar / usr/app/app.jar
In the previous section, you can see that some environments are set up, such as the SHELL used, the system PATH, the user who sent mail in the event of an error, the current directory (HOME). The last line is the setting of the program that is actually executed: the java program is executed at 00:05:00 every day.
At this point, I believe you have a deeper understanding of the "installation and environment settings of Linux JDK and TOMCAT". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
1. In the While statement,''and 0 ~ # false denote false
© 2024 shulou.com SLNews company. All rights reserved.