安装JDK
下载:https://pan.baidu.com/s/17ZDrs9n3geawFZZltvsbTQ 提取码: ph6v
代码语言:javascript复制[root@centos7-1 local]# ll /usr/local/jdk-8u131-linux-x64.rpm
-rw-r--r--. 1 root root 169983496 6月 12 23:17 /usr/local/jdk-8u131-linux-x64.rpm
[root@centos7-1 local]# rpm -ivh jdk-8u131-linux-x64.rpm
Preparing... ################################# [100%]
Updating / installing...
1:jdk1.8.0_131-2000:1.8.0_131-fcs ################################# [100%]
Unpacking JAR files...
tools.jar...
plugin.jar...
javaws.jar...
deploy.jar...
rt.jar...
jsse.jar...
charsets.jar...
localedata.jar...
[root@centos7-1 local]#
默认安装到了 /usr/java/
[root@VM_0_16_centos java]# ll /usr/java
总用量 4
lrwxrwxrwx 1 root root 16 4月 8 14:37 default -> /usr/java/latest
drwxr-xr-x 9 root root 4096 4月 8 14:37 jdk1.8.0_131
lrwxrwxrwx 1 root root 22 4月 8 14:37 latest -> /usr/java/jdk1.8.0_131
[root@VM_0_16_centos java]#
验证安装
代码语言:javascript复制[root@VM_0_16_centos java]# ll /usr/bin/java
lrwxrwxrwx 1 root root 22 4月 8 14:37 /usr/bin/java -> /etc/alternatives/java
[root@VM_0_16_centos java]# ll /etc/alternatives/java
lrwxrwxrwx 1 root root 35 4月 8 14:37 /etc/alternatives/java -> /usr/java/jdk1.8.0_131/jre/bin/java
[root@VM_0_16_centos java]# java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
配置环境变量
打开配置文件并敲如下命令:vi ~/.bashrc
JAVA_HOME=/usr/java/default
PATH=$PATH:$JAVA_HOME/bin
export JAVA_HOME PATH
运行命令使其生效
代码语言:javascript复制source ~/.bashrc
验证是否生效
代码语言:javascript复制[root@VM_0_16_centos java]# echo $JAVA_HOME
/usr/java/default
[root@VM_0_16_centos java]# echo $PATH
/usr/local/mysql/bin:/usr/local/mysql/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/hive/bin:/usr/java/default/bin:/usr/java/default/bin
安装Hadoop
安装HIVE
下载 http://mirror.bit.edu.cn/apache/hive/
将hive解压到/usr/local
下:
tar -zxvf apache-hive-3.1.2-bin.tar.gz -C /usr/local/
将文件重命名为 hive
文件:
mv apache-hive-2.1.1-bin hive
修改环境变量 /etc/profile
#hive
export HIVE_HOME=/usr/local/hive
export PATH=$PATH:$HIVE_HOME/bin
执行 source /etc.profile
执行 hive --version