Hadoop2.x/yarn Environment Build--centos7.0 JDK Configuration _ database other

Source: Internet
Author: User
Tags mkdir pack centos

Hadoop is written in Java, and he can't use Linux preinstalled OpenJDK, so you need to install the JDK before installing Hadoop (more than 1.6)

Raw materials: 32 JDK downloaded on Oracle's website:

Description

1, CentOS 7.0 system is now only 64, but, Hadoop generally support 32-bit, in the 64-bit environment there will be warning, to avoid the real horse problem, select the i586 jdk (that is, 32-bit), of course, 64-bit CentOS 7 Must be compatible with 32-bit JDK, remember: 64-bit system is certainly compatible with 32-bit software, 32-bit system is not compatible with 64-bit software. The 64-bit only indicates that the CPU once operation is 64 bits, more than 32 bits, 64 bit performance is higher.

2, the previous Linux version of the JDK has ". Bin" files available for download, but now the official website only provides the RPM installation package and the tar.gz compression package, the RPM installation package is the RedHat series system (Redhat/rhel/fedora/centos)-Specific installation files , you can run it directly, but we don't know how to configure it. So, to get close to the bottom, I chose to install the tar.gz compression package.

Installation method:

Since the openjdk with the installation of the JDK, can not be both, so there are two operations: 1, uninstall delete the original OPENJDK, and then install JDK 2, both still coexist, but, configure what is really effective JDK

Method 1: Uninstall deletes the original OPENJDK, then installs the JDK

The first step: Uninstall Delete openjdk

To uninstall Delete OpenJDK, you first need to know what to delete:

[Randy@localhost ~]$ rpm-qa|grep openjdk-i #查找已经安装的OpenJDK,-I indicates that the case of "OPENJDK" is ignored

Now remove all of them:

[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_ java-1.6.0-openjdk-1.6.0.0-6.1.13.4.el7_0.x86_64# java-1.7.0-openjdk-1.7.0.65-2.5.1.2.el7_0.x86_64 Redhat series system with the Yum to remove openjdk,yum similar to the apt-get in Ubuntu, are used to install, uninstall and update the system's own software, note: The above are separated by space

Step Two: Install JDK

1, decompression

First unzip the downloaded JDK: (the JDK's tar.gz compression pack is placed in the ~/dev directory)

[Randy@localhost ~]$ sudo mkdir/usr/lib/jdk #如若没有/usr/lib/jdk Path, this sentence is executed to create the JDK folder
[Randy@localhost ~]$ sudo tar-zxvf jdk-8u11-linux-i586.tar.gz-c/usr/lib/jdk #注意:-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 Mans Thirdpartylicensereadme-javafx.txt
COPYRIGHT JRE readme.html THIRDPARTYLICENSEREADME.txt
DB Lib Release
Include LICENSE Src.zip
[Randy@localhost ~]$

Move the files 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/#移动
[Randy@localhost ~]$
[Randy@localhost ~]$ LS/USR/LIB/JDK
Bin Javafx-src.zip LICENSE Src.zip
COPYRIGHT Jdk1.8.0_11 Mans Thirdpartylicensereadme-javafx.txt
DB JRE readme.html THIRDPARTYLICENSEREADME.txt
Include Lib release
[Randy@localhost ~]$ sudo rm-rf/usr/lib/jdk/jdk1.8.0_11/#删除
[Randy@localhost ~]$ LS/USR/LIB/JDK
Bin Javafx-src.zip Mans 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 on last line:
#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 default JDK

[Randy@localhost ~]$ sudo update-alternatives--install/usr/bin/java java/usr/lib/jdk/bin/java #使系统默认的java命令是/usr Java commands in/lib/jdk/bin
[Randy@localhost ~]$ sudo update-alternatives--install/usr/bin/javac javac/usr/lib/jdk/bin/javac #使系统默认的javac命令是 The Javac command in/usr/lib/jdk/bin
[Randy@localhost ~]$ sudo update-alternatives--install/usr/bin/jar jar/usr/lib/jdk/bin/jar #使系统默认的jar命令是/usr/lib Jar command in/jdk/bin
[Randy@localhost ~]$ sudo update-alternatives--config java #配置默认java命令
There are 1 programs that provide "Java".
Options command
-----------------------------------------------
*+ 1/usr/lib/jdk/bin/java
Press Enter to keep the current option [+], or type the option number: 1
[Randy@localhost ~]$ sudo update-alternatives--config javac #配置默认java命令
There are 1 programs that provide "Java".
Options command
-----------------------------------------------
*+ 1/usr/lib/jdk/bin/javac
Press Enter to keep the current option [+], or type the option number: 1

Step three: 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: Without that file or directory
[Randy@localhost ~]$ Ls/lib/ld-linux
LS: Unable to access/lib/ld-linux: No file or directory
[Randy@localhost ~]$ Java-version
-bash:/usr/bin/java:/lib/ld-linux.so.2:bad ELF interpreter: Without that file or directory
[Randy@localhost ~]$

The solution is:

[Randy@localhost ~]$ sudo yum install glibc.i686 #在64系统里执行32位程序如果出现/lib/ld-linux.so.2:bad ELF interpreter:no such file o R directory, install the glic can be

Method 2: Both coexist and configure what is really valid JDK

Similar to Method1, just do not need to uninstall delete OpenJDK

1, decompression

First unzip the downloaded JDK: (the JDK's tar.gz compression pack is placed in the ~/dev directory)

[Randy@localhost ~]$ sudo mkdir/usr/lib/jdk #如若没有/usr/lib/jdk Path, this sentence is executed to create the JDK folder
[Randy@localhost ~]$ sudo tar-zxvf jdk-8u11-linux-i586.tar.gz-c/usr/lib/jdk #注意:-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 Mans Thirdpartylicensereadme-javafx.txt
COPYRIGHT JRE readme.html THIRDPARTYLICENSEREADME.txt
DB Lib Release
Include LICENSE Src.zip
[Randy@localhost ~]$

Move the files 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/#移动
[Randy@localhost ~]$
[Randy@localhost ~]$ LS/USR/LIB/JDK
Bin Javafx-src.zip LICENSE Src.zip
COPYRIGHT Jdk1.8.0_11 Mans Thirdpartylicensereadme-javafx.txt
DB JRE readme.html THIRDPARTYLICENSEREADME.txt
Include Lib release
[Randy@localhost ~]$ sudo rm-rf/usr/lib/jdk/jdk1.8.0_11/#删除
[Randy@localhost ~]$ LS/USR/LIB/JDK
Bin Javafx-src.zip Mans 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 on last line:
#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 default JDK

[Randy@localhost ~]$ sudo update-alternatives--install/usr/bin/java java/usr/lib/jdk/bin/java #使系统默认的java命令是/usr Java commands in/lib/jdk/bin
[Randy@localhost ~]$ sudo update-alternatives--install/usr/bin/javac javac/usr/lib/jdk/bin/javac #使系统默认的javac命令是 The Javac command in/usr/lib/jdk/bin
[Randy@localhost ~]$ sudo update-alternatives--install/usr/bin/jar jar/usr/lib/jdk/bin/jar #使系统默认的jar命令是/usr/lib Jar command in/jdk/bin
[Randy@localhost ~]$ sudo update-alternatives--config java #配置默认java命令
There are 3 programs that provide "Java".
Options 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 keep the current option [+], or type the option number: 3
[Randy@localhost ~]$ sudo update-alternatives--config javac #配置默认java命令
A total of 3 "Javac" procedures are available.
Options 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 keep the current option [+], or type the option number: 3
[Randy@localhost ~]$

Step three: 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: Without that file or directory
[Randy@localhost ~]$ Ls/lib/ld-linux
LS: Unable to access/lib/ld-linux: No file or directory
[Randy@localhost ~]$ Java-version
-bash:/usr/bin/java:/lib/ld-linux.so.2:bad ELF interpreter: Without that file or directory
[Randy@localhost ~]$

The solution is:

[Randy@localhost ~]$ sudo yum install glibc.i686 #在64系统里执行32位程序如果出现/lib/ld-linux.so.2:bad ELF interpreter:no such file o R directory, install the glic can be

Report:

After you finish configuring the JDK's environment, by the way, CentOS 7 has its own database mariadb settings.

Now, RHEL 7/centos 7 's own database is no longer MySQL, mainly because of the greater ability to open source, and now Google is moving its data from MySQL to mariadb. To experience the most advanced ideas, the future of my hive database platform will be mariadb

When the system is installed, the system's MARIADB service is out of the stop state, so you should start the service first:

[Randy@localhost ~]$ sudo systemctl start mariadb #之前CentOS版本执行sudo service mariadb start, and the CentOS7 Execute Service command can also take effect, but prompts: R Edirecting to/bin/systemctl Start Mariadb.service
[Randy@localhost ~]$ sudo systemctl stop mariadb #停止mariadb服务
[Randy@localhost ~]$ sudo systemctl status mariadb #查看mariadb状态
[Randy@localhost ~]$

Set the root password of mariadb to "root":

Command format:

sudo mysqladmin-u username password "New password"

If the password is already set by root, use the following method:

sudo mysqladmin-u username password old password "new password"

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

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

Test:

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

Show:

 Welcome to the mariadb monitor.  Commands end With or \g. 
Your mariadb Connection ID is 3
Server Versio N:5.5.37-mariadb-log mariadb Server
Copyright (c), 2014, Oracle, Monty program Ab and others.
Type ' help, ' or ' \h ' for help. Type ' \c ' to clear the current input statement.
Mariadb [(None)]>

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.