Linux JDK, Tomcat installation and environment setting


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
The file jdk-1 is generated_ 5_ 0_ 02-linux-i586. RPM, also add executable permissions to all users
#chmod +x jdk-1_5_0_02-linux-i586.rpm
erection sequence
#rpm -ivh jdk-1_5_0_02-linux-i586.rpm
If the installation agreement appears, press accept.
2. Set environment variables.
#vi /etc/profile
Add at the end
#set java environment
Save and exit.
To make JDK available to all users, you can:
vi /etc/profile.d/
In the new Java SH enter the following:
#set java environment
Save, exit, and then give it to Java SH assign permissions: Chmod 755 / etc / profile d/java. sh


Due to the project, I need to deploy the web application toLinuxIt is used on the system and needs to be configured with SSL two-way connection. I used to use Linux at school, but it is only superficial. I need to reuse it this time, so I’ll summarize. At the same time, I used the automatic running program cron under Linux. The software environment version is as follows:
operating system:RedHat Enterprise Linux V.4
First, install the Linux system. The Linux system I use for the project is a more expensive enterprise version. The installation process mainly includes the following important steps (since the installation process has a detailed wizard, it will not be repeated here):
The wizard language of the installation process. If English is good, you can use English. If you are not familiar with it, it is better to install it in simplified Chinese.
Automatic partition or manual partition can be used during partition. Because it is limited to experimental use, the whole directory structure has only one root directory (/) and swap partition.
Since the system needs to use SSL for secure connection, and the firewall of Linux is open to SSL, it needs to be closed during installation.
When setting up the network during installation, it shall be set according to the actual situation. If it is only for experimental learning, the host name can be set to localhost, which is very convenient for the future setting of the system.
      When setting up the system user, you can create a new account yourself (recommended), or you can use only one root user (as experimental learning).
      Select InstallassemblyYou can choose Custom installation. During the installation process, you’d better directly install some compilers, such as GCC, so as to save the problem of reinstalling the compiler during compilation and installation. (the operation is to select the development tool project):
When everything is ready, you can install it. There are four CDs in the version installed by the author, which can be installed according to the installation wizard until the end of installation. The system needs to be rebooted after. After rebooting the system, make a series of settings, test the sound card, create an account, register, etc. (registration can be skipped) finally log in to the system:
      proposal:1.Because it is only a testing system,In order not to affect your system,CanLinuxThe system is installed in a virtual machine,In this way, the system can be deleted at any time when it is not needed,And it won’t cause any trouble.
           2.Another thing to pay attention to is the selection during installationFTPservice,That is to install,Then build one in the machineFTPThe server,So you can accessWindowsoperating system,File transfer.
      After installing Linux, you can install the environment software
First download the above environment software and save it in the user-defined directory after downloading. The author’s user-defined directory is / usr / zhangzhongl. 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
You can install the JDK. During the installation process, you need to agree to the license agreement. After the normal installation, you will contact jdk1_ 5_ 0_ 10-linux-i586. A JDK directory is generated from the directory on the same layer of bin file. The author’s JDK directory is jdk1 5.0_ 10. Copy it to the directory you want to place. It is recommended to set the directory structure to be short, which is more convenient when setting environment variables. The author’s JDK directory is / usr / jdk1 5.0_ 10。
      After installation, set the environment variables and execute the following commands:
      cd /etc
      vi profile.d/
      The following contents are added to the file: (tomcat_home is a non essential item, which is only added 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
Pay attention here*nixThe separator in the system is a colon, not a colonWindowsSemicolon in.
After setting, restart the system, then open a new terminal and execute Java, javac, Java – version and other commands. If the corresponding information can be printed, it indicates that the JDK installation is successful and the environment variable setting is successful.
      Install Tomcat
      To install tomcat, you only need to decompress Tomcat (generally, Linux comes with a tool to decompress. GZ,. Tar format files, which can be double clicked) and store it in the user-defined directory. The author’s user-defined directory is: /usr/tomcat
Tomcat can then be set_ Home environment variable (already set above). Enter the $omcat / bin directory and execute the. / command to start Tomcat. After executing the command, you can see some Tomcat environment variables:
Then enterhttp://localhost:8080/, hehe, that kitten is still cute! Tomcat has been installed, so we can deploy our application.
      Copy the packaged war file to $Tomcat_ In the home / webapps directory, start Tomcat to deploy the application.
      The following describes the cron program of Linux, which is similar to the task management of windows. It can automatically run the specified program at the specified time and send an e-mail to the administrator to report the operation of the program. This paper does not describe the program in detail. There are many relevant articles on the network, which you can refer to. Only a practical example is given for reference.
      The project needs a program to generate a certificate revocation list (CRL) to run automatically, execute it at 00:05:00 every day, record the execution status: success or failure in the log, and send an email to notify the administrator when it fails.
      The execution process is as follows:
      cd etc                    Enter directory
crontab –e             Edit the cron program file for the root user
Each user has its own custom running program, depending on what account to log in with.
05 00 * * * java –jar /usr/app/app.jar
You can see from the previous part that you set up some environments, such asShell, system path, user who sends mail in case of error, current directory (home). The last line is the setting of the actually executed program: execute at 00:05:00 every dayJava program.
       Due to the project, other specific contents are omitted here, including configuring SSL connection, executing web application and actual cron program.