Linux software installation and first use

Linux:

Simple shortcuts:

  Tip keys: tab, is relatively common bond

  Enter the absolute path of the current directory: pwd

  Find the absolute path of a file / folder: whereis

  View the current system environment variables where the absolute path: echo $ JAVA_HOME (used with echo and general viewing variables)

  Edit the file: vi / vim 

      i: editing is turned on

      Press esc to exit edit mode

      Save and Exit: shift + zz or: wq or:! Wq (Force Save)

      Exit without saving :: q:! Q (forced to exit without saving)

      Jump directly to the last line: G

      Jump directly to the end of the current line of: e


 

Linux configuration JDK

1, in general, there are two versions installed: rpm: Installation version (exe windows in)

          tar.gz: green version (free installation version) ------> use free installation version

2, using xftp good tool to download jdk archive uploaded to the Linux server

3, extract jdk (extract to the current directory)

  tar -zxvf jdk.tar.gz

4, enter decompression good jdk, and view and copy absolute path

  pwd

5, configure the environment variables (modified profile file)

  vim /etc/profile

6, add the environment variable

  Jump to the last line of G; add: export JAVA_HOME = address (using the address just isolated to the pwd)

               export PATH=$PATH:$JAVA_HOME/bin

7, so that the environment variables to take effect

  source /etc/profile

  Linux can restart

8, detects whether the configuration jdk

  javac -version

note:

  Errors that may occur when configuring environment variable:

  -bash: /home/apps/jdk1.8.0_151/bin/javac: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory

 Reasons: 1, without the use of export to import commands before JAVA_HOME

    2, view the jdk location is consistent and Linux

    3, if the Linux 64-bit, 32-bit jdk but the beginning of the configuration, Linux system will default to 32-bit jdk configured on the environment variable,

      After re-put on 64, 32 and still go back to load, so the error will still, at this time needs to be 32-bit jdk deleted, leaving only 64,

      The system will go to the load 64. Linux self-protection mechanism

 

 

Note: whereis usage:

Links: https://blog.csdn.net/qq646748739/article/details/82585838
  whereis command can only be used to search the program name, and only search binary files (parameter -b), man documentation (parameter -m) and source code files (parameter -s). If the parameter is omitted, all the information is returned .

  And find compared to the speed whereis look very fast , because linux system will be all the files in the system are recorded in a database file when using locate and whereis to be introduced below, looks for data from the database,
  rather than find command as hard to find by walking, efficiency will naturally be very high. 
  However, the database file is not updated in real time a week updated By default , therefore, when we find files with whereis and locate, sometimes finds data has been deleted, or just create a file, but can not find the reason because the database file is not updated. 

  1. Command Format: whereis [-bmsu] [BMS directory name -f] filename

  2. Command functions:

  whereis positioning commands executable, source code files, help file location in the file system. These attributes should belong to the original code files, binary files, or help file.
  whereis source having a search code to specify the unusual ability to alternate entry and search path search.

  3. Command parameters:
  -b locate the executable file.
  -m help locate the file.
  -s locate the source code files.
  -u default search files other than executable files, source code files, help files in the path.
  -B specify a search path to the executable file.
  -M specify the path to the file search help.
  -S path specified search source code files.

  4. Example:
    4.1 ** files and related files to find out
      [hduser0401 @ dev-l002782 ~] $ whereis the Spark       
      the Spark: --spark not installed, so not to be found  
      [hduser0401 @ dev-l002782 ~] $ whereis hadoop
      hadoop: / usr / local / bin / hadoop
      
    4.2 binaries only to find out: whereis -b hadoop
    4.3 will only find out the source file source: whereis -s hadoop
      [dev-l002782 hduser0401 @ ~] $ whereis -b hadoop  
      hadoop : / usr / local / bin / Hadoop
      [hduser0401 @ ~ dev-l002782] -s $ the whereis Hadoop
      Hadoop:
      [hduser0401 @ ~ dev-l002782] the whereis -m $ Hadoop
      Hadoop:
      [hduser0401 @ ~ dev-l002782] $ the whereis - hadoop U
      hadoop: / usr / local / bin / hadoop
      [hduser0401@dev-l002782 ~]$ whereis -B hadoop
      [hduser0401@dev-l002782 ~]$ whereis -M hadoop


 

Linux configuration Tomcat: (Apache open-source project called Java Foundation)

That is as long as all components are downloaded from the Apache official website / framework / project requires environment variables jdk support of

1, download Tomcat8

2, using the Tomcat xftp uploaded to the server

3, extract Tomcat: tar -zxvf xxxx

4, direct start Tomcat:

  All Windows startup files, all ending with bat

  All Linux and Mac startup files, all ending with sh

  Into Tomcat's bin directory: ./startup.sh

  Or change into the Tomcat directory: bin / startup.sh

5, to detect whether a successful start Tomcat

  jps: success can only be configured jdk later can use the command

  2779 Jps: represents the jdk environment variable

  2736 Bootstrap: represents the Tomcat startup

6, stop Tomcat

  Into the Tomcat's bin directory

  ./shutdown.sh

  kill -9 2830 (strongly recommended, may damage the internal Tomcat and data files)

  There is a ROOT at the Tomcat bin / webapps

  ROOT is a project (Java project)

  The role of ROOT project is ----> localhost: 8080 ROOT project is open pages

  Note: All items to the end of the 80 port numbers do not need to enter the port number, so we modify the port number is 80, enter the URL without adding the upper slogans


 Linux configuration maven

1. Download the Apache maven from official website

2, using the tools xftp uploaded to the Linux server

3, extract the compressed maven 

4, need to configure the environment variables maven

  vi / etc / profile

  And configure the Java environment variables similarly, in the environment variable expot imported prior to the introduction:

  export MAVEN_HOME = path

  On the PATH configure connections Before continuing on the new configuration:

  export PATH=$PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin

5, environmental variables to take effect immediately: source / etc / profile

6, the detection maven environment is successful; mvn -v

7, maven local repository / Ali cloud images

  As with the configuration on Windows, found in the conf setting.xml

  vim  setting.xml

  Add a local repository location, and adding <mirror> tag in the mirrors </ mirror> (Ali cloud mirror)

Note : In all configurations, not allowed to move comes with configuration information if you need to use some configurations, modify the copy out

8, maven goal jdk version

  Jdk comes in the maven version 1.5, and 1.8 for the native environment

  Add a lot of new methods and classes no 1.5 in 1.8

  At the beginning maven compile time, the compiler version is 1.5, and the configuration of our machine is 1.8, maven will not compile error;

  Of course, idea development tools automatically integrated jdk environment of the machine, but the eclipse / Myeclipse will complain, so we need to add in setting.xmlzhong

  <profile>
    <id>jdk1.8</id>
    <activation>
      <activeByDefault>true</activeByDefault>
      <jdk>1.8</jdk>
    </activation>
    <properties>
      <maven.compiler.source>1.8</maven.compiler.source>
      <maven.compiler.target>1.8</maven.compiler.target>
      <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion> 

    </properties>

  </profile>

 

Guess you like

Origin www.cnblogs.com/liuqijia/p/11411155.html