(1)把apache-hive-1.2.1-bin.tar.gz上傳到linux的/opt/software目錄下
(2)解壓apache-hive-1.2.1-bin.tar.gz到/usr/local/目錄下面
/usr/local# tar -zxvf apache-hive-1.2.1-bin.tar.gz -C /usr/local
(3)修改apache-hive-1.2.1-bin.tar.gz的名稱為hive
mv apache-hive-1.2.1-bin/ hive
(4)修改/usr/local/hive/conf目錄下的hive-env.sh.template名稱為hive-env.sh
mv hive-env.sh.template hive-env.sh
(5)配置hive-env.sh文件
(a)配置HADOOP_HOME路徑
export HADOOP_HOME=/usr/local/hadoop (你的hadoop路徑)
(b)配置HIVE_CONF_DIR路徑
export HIVE_CONF_DIR=/usr/local/hive/conf (你的hive路徑)
.Hive基本操作
(1)啟動hive
[atguigu@hadoop102 hive]$ bin/hive
(2)查看數據庫
hive> show databases;
(3)打開默認數據庫
hive> use default;
(4)顯示default數據庫中的表
hive> show tables;
(5)創建一張表
hive> create table student(id int, name string);
(6)顯示數據庫中有幾張表
hive> show tables;
(7)查看表的結構
hive> desc student;
(8)向表中插入數據
hive> insert into student values(1000,"ss");
(9)查詢表中數據
hive> select * from student;
(10)退出hive
hive> quit;