Linux virtual machine Ubuntu + JAVA environment variables to configure Tomcat installation +

JDK and environment variables

  • 下载JDK:http://www.oracle.com/technetwork/java/javase/downloads/index.html 
  • Unzip jdk-9.0.1
  • Jdk package moved to opt / java at: mv /home/sunandmoon/Desktop/jdk-9.0.1 / opt / java
  • Linux under Ctrl + Alt + t Open Terminal, enter the following command:
    • sudo -iu root # to switch to root privileges to edit the configuration file environment variables
    • vi / etc after / profile # Enter into the profile file
    • i # i inputted into Insert mode, enter the following lines:
      • export JAVA_HOME = / opt / java # address jdk file storage path
      • export JRE_HOME=${JAVA_HOME}/jre  #配置JRE_HOME
      • export CLASSPATH=${JAVA_HOME}/lib:${JRE_HOME}/lib  #配置CLASSPATH
      • export PATH = ${JAVA_HOME}/bin:${JRE_HOME}/bin:${PATH}  #配置PATH
    • Esc key and then enter: wq !, forced to save and exit
    • Continue input source / etc in the Terminal / profile loaded (source / etc / profile are performed at regular user and root)
    • Continue entering java or javac Test to see if the environment variable is added successfully and entered into force

Tomcat

  • Download tomcat installation package http://tomcat.apache.org/download-90.cgi
  • Download tar.gz installation package
  • Unzip the file: tar xzvf apache-tomcat-9.0.10.tar.gz # unzip tar.gz,
  • (If the file is compressed .tar file, tar -xvf file.tar, if the file is compressed tar.bz2 file, tar -xjvf file.tar.bz2)
  • Delete archive: rm -f apache-tomcat-9.0.10.tar.gz
  • Tomcat package moved to opt / tomcat under: mv /home/sunandmoon/Desktop/apache-tomcat-9.0.10 / opt / tomcat
  • Configure the environment variables, command: vim / etc / profile, the profile is added at the end of the file: export PATH = / opt / tomcat / bin: $ {PATH}  
  • Continue input source / etc in the Terminal / profile loaded (source / etc / profile are performed at regular user and root)
  • Into the bin directory under tomcat directory: cd /opt/tomcat/apache-tomcat-9.0.10/bin
  • Start tomcat: ./ startup.sh
  • Use http browser in a virtual machine or virtual machine external browser: // localhost: 8080 / test Tomcat, Tomcat page appears if the installation was successful
  • Close Tomcat: After cd / opt / tomcat / bin ./shutdown.sh

     

    1. Remarks: The above modify environment variables way for permanent changes, effective for multiple users. There are two other modifications:
    2. Permanent changes, effective for a single user
    3. Takes effect only bash / shell
    4. Note 2: After entering the various commands vi: screen commands like roll , insert text type command , delete command , search and replace commands. . . . . . . . . . . . . Please refer to: https: //www.cnblogs.com/java-wp/p/7885732.html

Guess you like

Origin blog.csdn.net/chang_jinling/article/details/81115262