Linux non-root users install JDK and Tomcat

Source: Internet
Author: User

Reprinted from: http://blog.csdn.net/wuyigong111/article/details/17410661, with partial modifications

Create a user sgmm and install the JDK and Tomcat in their user directory, as follows.

I. Increase SGMM users and SGMM groups

[[Email protected]_test ~]# groupadd sgmm[[email protected]_test ~]# useradd-d/home/sgmm-g sgmm-m sgmm

Second, set the password for the SGMM user

[Email protected]_test ~]# passwd sgmm

Prompt for password and Confirm password, password setup is complete.

Third, deploy the JDK (switch to SGMM user)
1. Upload jdk-6u13-linux-i586.bin to sgmm directory and assign executable permissions.

[Email protected]_test ~]$ chmod 744 jdk-6u13-linux-i586.bin

2. Perform Jdk-6u13-linux-i586.bin installation JDK

[Email protected]_test ~]$./jdk-6u13-linux-i586.bin

3. Set the SGMM user environment variable after the previous step after installation is complete

[Email protected]_test ~]$ VI bash_profile

Change to the following content

#. bash_profile# Get the aliases and Functionsif [-f ~/.BASHRC]; Then        . ~/.bashrcfi# User specific environment and startup Programsjava_home=/home/sgmm/jdk1.6.0_13classpath= $JAVA _home/lib: $JAVA _home/jre/libpath= $PATH: $JAVA _home/bin: $JAVA _home/jre/binexport PATH CLASSPATH java_home

4. Make the environment variable effective

[Email protected]_test ~]$ Source ~/.bash_profile

5, verify that "Linux installed after the Java JDK version is not how to handle, see note 1"

Javac-version

Iv. deployment of Tomcat

1. Upload the apache-tomcat-6.0.20.tar.gz to the server

2, unzip the file, appear directory apache-tomcat-6.0.20

[Email protected]_test ~]$ tar zxvf apache-tomcat-6.0.20.tar.gz

3. Set the environment variables for Tomcat.

[Email protected]_test ~]$ VI bash_profile

Add the following:

Export Catalina_base=/home/sgmm/apache-tomcat-6.0.20export catalina_home=/home/sgmm/apache-tomcat-6.0.20

The contents of the final. bash_profile file are:

#. bash_profile# Get the aliases and Functionsif [-f ~/.BASHRC]; Then    . ~/.bashrcfi# User specific environment and startup Programsjava_home=/home/sgmm/jdk1.6.0_13classpath= $JAVA _home/lib: $JAVA _home/jre/lib path= $PATH: $JAVA _home/bin: $JAVA _home/jre/bin export PATH CLASSPATH java_homeexport Catalina_base=/home/sgmm/apache-tomcat-6.0.20export catalina_home=/home/sgmm/apache-tomcat-6.0.20

4. Make the environment variable effective

[Email protected]_test ~]$ Source ~/.bash_profile

5, switch to the bin directory after the Tomcat decompression, execute the following command to start the Tomcat service

[Email protected]_test bin]$./startup.sh

Print out the following information to indicate that the startup was successful.

Using catalina_base:   /home/sgmm/apache-tomcat-6.0.20using catalina_home:   /home/sgmm/ Apache-tomcat-6.0.20using catalina_tmpdir:/home/sgmm/apache-tomcat-6.0.20/tempusing JRE_HOME:       /home/sgmm/ Jdk1.6.0_13

6. Use Ps-ef|grep tomcat to view the Tomcat process and use the kill-9 process number to kill the process

7. Close Tomcat Service

[Email protected]_test bin]$./shutdown.sh

Note 1:linux After installing Java JDK version is not how to handle

Reprinted from http://www.aixchina.net/home/space.php?uid=20260&do=blog&id=32389

Environment variables, put the Java path in front of the original path is good.

First use which Java to see which Java is used, the results are displayed as

[email protected] soft]# which Java/usr/bin/java
Description of the Java version that was not used, then put the Java path in front of the path to try "If a command not found error occurs after the modification, see note 2"
Export Java_home=/usr/java/jdk1.6.0_35export java_bin=/usr/java/jdk1.6.0_35/binexport PATH= $JAVA _home/bin:$ Pathexport classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jarexport java_home java_bin PATH CLASSPATH
Make the environment variable effective before you look at it
[email protected] ~]# which java/usr/java/jdk1.6.0_35/bin/java[[email protected] ~]# Java-versionjava version "1.6.0_ "Java (TM) SE Runtime Environment (build 1.6.0_35-B10) Java HotSpot (tm) 64-bit Server VM (build 20.10-b01, Mixed mode)

Note 2:linux:-bash: * *: Command not found

Reference: http://www.linuxidc.com/Linux/2012-08/68900.htm

This should be caused by a problem with the system environment variable.

Workaround:

First Use: Echo $PATH
See if path contains:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

If not, use temporary environment variables (disappear after reboot)
Export path= $PATH:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

Then you can use those commands, go in and modify the permanent environment variable, VI bash_profile

Use the command: source. BASHRC to make the environment variable that you just modified take effect

Linux non-root users install JDK and Tomcat

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.