Hadoop2.X/YARN environment setup-CentOS7.0 JDK configuration, centos7.0

Source: Internet
Author: User

Hadoop2.X/YARN environment setup-CentOS7.0 JDK configuration, centos7.0

Hadoop is written in Java and cannot use OpenJDK pre-installed in Linux. Therefore, JDK (1.6 or above) must be installed before hadoop is installed)

Raw materials: the 32-bit JDK downloaded from the Oracle Official Website:

Note:

1. The CentOS 7.0 system currently only has 64-bit data. However, Hadoop generally supports 32-bit data. In a 64-bit environment, there may be a Warning problem to avoid real problems, select JDK of i586 (32-bit). Of course, 64-bit CentOS 7 must be compatible with 32-bit JDK. Remember: 64-bit systems must be compatible with 32-bit software, 32-bit systems are not compatible with 64-bit software. 64-bit only indicates that the number of CPU operations at a time is 64-bit, which is more than 32-bit, And the 64-Bit performance is higher.

The rpm installation package is a unique installation file of the RedHat series system (RedHat/RHEL/Fedora/CentOS). You can run it directly, but we do not know the configuration method. For the bottom layer, I select the tar.gz compressed package for installation.

Installation Method:

The built-in OpenJDK and the later installed JDK cannot have both of them. Therefore, there are two types of operations: 1. Uninstall and delete the original OpenJDK, and then install JDK 2. The two still coexist. However, which of the following statements is true for JDK?

Method 1: uninstall and delete the original OpenJDK, and then install JDK.

Step 1: uninstall and delete OpenJDK

To uninstall and delete OpenJDK, you must first know what to delete:

[Randy @ localhost ~] $ Rpm-qa | grep openjdk-I # Find the installed OpenJDK.-I indicates that the case sensitivity of "openjdk" is ignored.

 

Delete all of them now:

[Randy @ localhost ~] $ Sudo yum remove java-1.6.0-openjdk-devel-1.6.0.0-6.1.13.4.el7_0.x86_64 java-1.7.0-openjdk-devel-1.7.0.65-2.5.1.2.el7_0.x86_64 java-1.7.0-openjdk-headless-1.7.0.65-2.5.1.2.el7_0.x86_64 java-1.7.0-openjdk-1.7.0.65-2.5.1.2.el7_0.x86_64 java-1.6.0-openjdk-1.6.0.0-6.1.13.4.el7_0.x86_64 # remove openjdk with the yum that comes with the RedHat series system, yum is similar to apt-get In ubuntu, are used to install, uninstall, and update the software that comes with the system. Note: The preceding steps are separated by spaces.

 

Step 2: Install JDK

1. Extract

First, decompress the downloaded JDK: (The tar.gz package of JDK is stored in ~ /Dev directory)

[Randy @ localhost ~] $ Sudo mkdir/usr/lib/jdk # if there is no/usr/lib/jdk path, execute this statement to create the jdk folder.
[Randy @ localhost ~] $ Sudo tar-zxvf jdk-8u11-linux-i586.tar.gz-C/usr/lib/jdk # Note:-C, -- directory = DIR change to directory DIR
[Randy @ localhost ~] $ Ls/usr/lib/jdk
Jdk1.8.0 _ 11
[Randy @ localhost ~] $ Ls/usr/lib/jdk/jdk1.8.0 _ 11/
Bin javafx-src.zip man THIRDPARTYLICENSEREADME-JAVAFX.txt
COPYRIGHT jre README.html THIRDPARTYLICENSEREADME.txt
Db lib release
Include LICENSE src.zip
[Randy @ localhost ~] $

Move the file in jdk1.8.0 _ 11 to/usr/lib/jdk and delete the jdk1.8.0 _ 11 Folder:

[Randy @ localhost ~] $ Sudo cp-rf/usr/lib/jdk/jdk1.8.0 _ 11/*/usr/lib/jdk/# mobile
[Randy @ localhost ~] $
[Randy @ localhost ~] $ Ls/usr/lib/jdk
Bin javafx-src.zip LICENSE src.zip
COPYRIGHT jdk1.8.0 _ 11 man THIRDPARTYLICENSEREADME-JAVAFX.txt
Db jre README.html THIRDPARTYLICENSEREADME.txt
Include lib release
[Randy @ localhost ~] $ Sudo rm-rf/usr/lib/jdk/jdk1.8.0 _ 11/# Delete
[Randy @ localhost ~] $ Ls/usr/lib/jdk
Bin javafx-src.zip man THIRDPARTYLICENSEREADME-JAVAFX.txt
COPYRIGHT jre README.html THIRDPARTYLICENSEREADME.txt
Db lib release
Include LICENSE src.zip
[Randy @ localhost ~] $

 

2. Configure Environment Variables

[Randy @ localhost ~] $ Sudo vim/etc/profile
Insert in the last row:
#JAVA Environment
export JAVA_HOME=/usr/lib/jdk
export JRE_HOME=/usr/lib/jdk/jre
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
export CLASSPATH=$CLASSPATH:.:$JAVA_HOME/lib:$JRE_HOME/lib

3. modify the system's default JDK

[Randy @ localhost ~] $ Sudo update-alternatives -- install/usr/bin/java/usr/lib/jdk/bin/java 300 # Make the default java command/usr/lib/jdk/ java commands in bin
[Randy @ localhost ~] $ Sudo update-alternatives -- install/usr/bin/javac/usr/lib/jdk/bin/javac 300 # Make the default javac command/usr/lib/jdk/ javac command in bin
[Randy @ localhost ~] $ Sudo update-alternatives -- install/usr/bin/jar/usr/lib/jdk/bin/jar 300 # Make the default jar command/usr/lib/jdk/ jar command in bin
[Randy @ localhost ~] $ Sudo update-alternatives -- config java # configure the default java command
There is a total of 1 program that provides "java.
Option command
-----------------------------------------------
* + 1/usr/lib/jdk/bin/java
Press Enter to retain the current option [+], or Enter option number: 1
[Randy @ localhost ~] $ Sudo update-alternatives -- config javac # configure the default java command
There is a total of 1 program that provides "java.
Option command
-----------------------------------------------
* + 1/usr/lib/jdk/bin/javac
Press Enter to retain the current option [+], or Enter option number: 1

Step 3: Test JDK

[Randy@localhost ~]$ java -version
java version "1.8.0_11"
Java(TM) SE Runtime Environment (build 1.8.0_11-b12)
Java HotSpot(TM) Server VM (build 25.11-b03, mixed mode)
[Randy@localhost ~]$ javac -version
javac 1.8.0_11

The test encountered a problem:

[Randy @ localhost ~] $ Java
-Bash:/usr/bin/java:/lib/ld-linux.so.2: bad ELF interpreter: No file or directory
[Randy @ localhost ~] $ Ls/lib/ld-linux
Ls: cannot access/lib/ld-linux: No file or directory
[Randy @ localhost ~] $ Java-version
-Bash:/usr/bin/java:/lib/ld-linux.so.2: bad ELF interpreter: No file or directory
[Randy @ localhost ~] $

Solution:

[Randy @ localhost ~] $ Sudo yum install glibc. i686 # execute a 32-bit program in 64 system. If/lib/ld-linux.so.2: bad ELF interpreter: No such file or directory appears, install glic.

 

Method 2: Both of them coexist.

Similar to Method1, you do not need to uninstall or delete OpenJDK.

1. Extract

First, decompress the downloaded JDK: (The tar.gz package of JDK is stored in ~ /Dev directory)

[Randy @ localhost ~] $ Sudo mkdir/usr/lib/jdk # if there is no/usr/lib/jdk path, execute this statement to create the jdk folder.
[Randy @ localhost ~] $ Sudo tar-zxvf jdk-8u11-linux-i586.tar.gz-C/usr/lib/jdk # Note:-C, -- directory = DIR change to directory DIR
[Randy @ localhost ~] $ Ls/usr/lib/jdk
Jdk1.8.0 _ 11
[Randy @ localhost ~] $ Ls/usr/lib/jdk/jdk1.8.0 _ 11/
Bin javafx-src.zip man THIRDPARTYLICENSEREADME-JAVAFX.txt
COPYRIGHT jre README.html THIRDPARTYLICENSEREADME.txt
Db lib release
Include LICENSE src.zip
[Randy @ localhost ~] $

 

Move the file in jdk1.8.0 _ 11 to/usr/lib/jdk and delete the jdk1.8.0 _ 11 Folder:

[Randy @ localhost ~] $ Sudo cp-rf/usr/lib/jdk/jdk1.8.0 _ 11/*/usr/lib/jdk/# mobile
[Randy @ localhost ~] $
[Randy @ localhost ~] $ Ls/usr/lib/jdk
Bin javafx-src.zip LICENSE src.zip
COPYRIGHT jdk1.8.0 _ 11 man THIRDPARTYLICENSEREADME-JAVAFX.txt
Db jre README.html THIRDPARTYLICENSEREADME.txt
Include lib release
[Randy @ localhost ~] $ Sudo rm-rf/usr/lib/jdk/jdk1.8.0 _ 11/# Delete
[Randy @ localhost ~] $ Ls/usr/lib/jdk
Bin javafx-src.zip man THIRDPARTYLICENSEREADME-JAVAFX.txt
COPYRIGHT jre README.html THIRDPARTYLICENSEREADME.txt
Db lib release
Include LICENSE src.zip
[Randy @ localhost ~] $

 

2. Configure Environment Variables

[Randy @ localhost ~] $ Sudo vim/etc/profile
Insert in the last row:
#JAVA Environment
export JAVA_HOME=/usr/lib/jdk
export JRE_HOME=/usr/lib/jdk/jre
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
export CLASSPATH=$CLASSPATH:.:$JAVA_HOME/lib:$JRE_HOME/lib

3. modify the system's default JDK

[Randy @ localhost ~] $ Sudo update-alternatives -- install/usr/bin/java/usr/lib/jdk/bin/java 300 # Make the default java command/usr/lib/jdk/ java commands in bin
[Randy @ localhost ~] $ Sudo update-alternatives -- install/usr/bin/javac/usr/lib/jdk/bin/javac 300 # Make the default javac command/usr/lib/jdk/ javac command in bin
[Randy @ localhost ~] $ Sudo update-alternatives -- install/usr/bin/jar/usr/lib/jdk/bin/jar 300 # Make the default jar command/usr/lib/jdk/ jar command in bin
[Randy @ localhost ~] $ Sudo update-alternatives -- config java # configure the default java command
There are three programs that provide "java.
Option command
-----------------------------------------------
* 1/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65-2.5.1.2.el7_0.x86_64/jre/bin/java
/Usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
+ 3/usr/lib/jdk/bin/java
Press Enter to retain the current option [+], or Enter the option number: 3.
[Randy @ localhost ~] $ Sudo update-alternatives -- config javac # configure the default java command
There are three programs that provide "javac.
Option command
-----------------------------------------------
* 1/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65-2.5.1.2.el7_0.x86_64/jre/bin/javac
/Usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/javac
+ 3/usr/lib/jdk/bin/javac
Press Enter to retain the current option [+], or Enter the option number: 3.
[Randy @ localhost ~] $

Step 3: Test JDK

[Randy@localhost ~]$ java -version
java version "1.8.0_11"
Java(TM) SE Runtime Environment (build 1.8.0_11-b12)
Java HotSpot(TM) Server VM (build 25.11-b03, mixed mode)
[Randy@localhost ~]$ javac -version
javac 1.8.0_11

 

The test encountered a problem:

[Randy @ localhost ~] $ Java
-Bash:/usr/bin/java:/lib/ld-linux.so.2: bad ELF interpreter: No file or directory
[Randy @ localhost ~] $ Ls/lib/ld-linux
Ls: cannot access/lib/ld-linux: No file or directory
[Randy @ localhost ~] $ Java-version
-Bash:/usr/bin/java:/lib/ld-linux.so.2: bad ELF interpreter: No file or directory
[Randy @ localhost ~] $

Solution:

[Randy @ localhost ~] $ Sudo yum install glibc. i686 # execute a 32-bit program in 64 system. If/lib/ld-linux.so.2: bad ELF interpreter: No such file or directory appears, install glic.

Appendix:

After completing the JDK environment configuration, let's talk about the settings of the MariaDB database that comes with CentOS 7.

Now, the databases that come with RHEL 7/CentOS 7 are no longer MySQL, mainly because of the larger open source capability. google is also migrating its data from MySQL to MariaDB. To experience the most advanced ideas, my Hive database platform will be MariaDB in the future.

 

After the system is installed, the mariadb service of the system is out of the stop State, so you should first start the service:

[Randy @ localhost ~] $ Sudo systemctl start mariadb # Run sudo service mariadb start in CentOS earlier versions, and run the service command in CentOS 7, but the prompt "Redirecting to/bin/systemctl start mariadb. service" appears.
[Randy @ localhost ~] $ Sudo systemctl stop mariadb # stop mariadb Service
[Randy @ localhost ~] $ Sudo systemctl status mariadb # view mariadb status
[Randy @ localhost ~] $

 

Set the root password of mariadb to "root ":

Command Format:

Sudo mysqladmin-u Username password "new password"

If the root user has set a password, use the following method:

Sudo mysqladmin-u user name password old password "new password"

Because there is no password after the system is installed, set the root user password to "root ":

[Randy@localhost ~]$ sudo mysqladmin -u root password "root"

 

Test:

[Randy@localhost ~]$ mysql -u root -proot

Display:

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 5.5.37-MariaDB-log MariaDB Server
Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>

If you want to build an android development platform in windows, JDK environment variables are also installed.

The third floor is right. Some things need to be configured in the environment variable.

My computer-> properties-> advanced-> Environment Variables

User variable
PATH = D: \ Program Files \ android-2.2_r01-windows \ tools

System Variables
CLASSPATH =.; D: \ Program Files \ Java \ jdk1.6.0 _ 25 \ lib \ dt. jar; D: \ Program Files \ Java \ jdk1.6.0 _ 25 \ lib \ tools. jar
JAVA_HOME: = D: \ Program Files \ Java \ jdk1.6.0 _ 25
PATH = D: \ Program Files \ Java \ jdk1.6.0 _ 25 \ bin; D: \ Program Files \ Android \ android-sdk-windows \ platform-tools

Note: If the preceding variables exist, the content is appended. If not, a new one is created. Modify the path based on your actual installation address.

How to install JDK in a java environment

Download a JDK file on sunguan. It is similar to a file such as jdk_i586.exe. You can double-click the file, run the file, and select the disk path to be installed. Next, next, until the process is completed.
Then, configure the environment variable. In win7, open Resource Manager, system properties, system advanced properties, environment variables, and then create the environment variable name path to write the JDK path you have installed. Create a new casspath path, which is the jdk path you have installed, and add jre/lib/rt. jar. Click OK ..
If not, Baidu JDK environment variables are certainly there ..

Related Article

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.