The first step download Hive
http://archive.apache.org/dist/hive/
them find their favorite versions Download
$ curl -O http://archive.apache.org/dist/hive/hive-3.1.2/apache-hive-3.1.2-bin.tar.gz
$ tar -xzf apache-hive-3.1.2-bin.tar.gz
$ sudo mv apache-hive-3.1.2-bin /srv/
$ sudo ln -s /srv/apache-hive-3.1.2-bin /srv/hive
The second step, the establishment hive user directory and the default repository directory, as well as to ensure the temporary data can be written hadoop hive directory
$ hadoop fs -mkdir /tmp
$ hadoop fs -mkdir -p /user/hive
$ hadoop fs -mkdir /user/hive/warehouse
$ hadoop fs -chmod g+w /tmp
$ hadoop fs -chmod g+w /user/hive/warehouse
$ chmod g+w /var/app/hadoop/data
The third step is to configure the environment variables
$ sudo su hadoop
$ vim ~/.bashrc
Add the following:
export HIVE_HOME=/srv/hive
export PATH=$PATH:$HIVE_HOME/bin
Enter the following code to validate the configuration saved
$ source ~/.bashrc
The fourth step is to configure hive metastore
use here of the Derby database, only suitable pseudo-distributed mode
we look hive-site.xml configuration file
$ cd $HIVE_HOME/conf
$ sudo cp hive-default.xml.template hive-site.xml
$ vim hive-site.xml
Modify the following several attributes:
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:derby:;databaseName=/home/hadoop/metastore_db;create=true</value>
</property>
<property>
<name>hive.exec.scratchdir</name>
<value>/tmp/hive</value>
</property>
<property>
<name>hive.exec.local.scratchdir</name>
<value>/tmp/hive/local</value>
</property>
<property>
<name>hive.downloaded.resources.dir</name>
<value>/tmp/hive/resources</value>
</property>
Try to start hive after saving
$ cd $HIVE_HOME
$ bin/hive
If you can see
hive>
Configuration is successful, if the error. Check the configuration.