一、下载地址
http://mirror.bit.edu.cn/apache/hive/
二、将hive解压到/usr/local/hive下
[root@hive ~]#mkdir /usr/local/hive
[root@hive ~]# tar -zxvf apache-hive-1.2.1-bin.tar.gz -C /usr/local/hive
三、修改环境变量
[root@hive ~]# vim /etc/profile
1 #hive
2 export HIVE_HOME=/usr/local/hive
3 export PATH=$PATH:$HIVE_HOME/bin
[root@hive ~]#source /etc/profile(配置生效)
四、配置
[root@hive ~]# cd /usr/local/hive/apache-hive-1.2.1-bin/conf/
[root@hive conf]#vim conf/hive-site.xml*(如果不存在创建)*
configuration>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true</value>
<description>JDBC connect string for a JDBC metastore</description>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
<description>Driver class name for a JDBC metastore</description>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>**root**</value>
<description>username to use against metastore database</description>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>**root**</value>
<description>password to use against metastore database</description>
</property>
</configuration>
cp hive-env.sh.template hive-env.sh
五、上传jar包
上传一个mysql的驱动jar包到hive的安装目录的lib中
mysql-connector-java-5.1.39.jar下载地址
六、hive启动测试
6.1
[root@hive ~]#cd /usr/local/hive/apache-hive-1.2.1-bin/bin
[root@hive bin]# ./hiveserver2
6.2
[root@hive ~]# cd /usr/local/hive/apache-hive-1.2.1-bin
[root@hive apache-hive-1.2.1-bin]# bin/beeline -u jdbc:hive2://hive:10000 -n root