JDK, mysql and hadoop should be correctly installed and running before Hive.
1. Download Hive. You can use wget to download hive from hive.apache.org/downloads.html
2. Uncompress it to /home/hadoop/hive-0.13.1
3. Edit hive-site.xml. In hive-0.13.1/conf directory, create a new hive-site.xml from the template:
#cp hive-default.xml.template hive-site.xml
Add/change the below part in hive-site.xml, to let it adapt to mysql.
<configuration>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://192.168.1.160:3306/hive?characterEncoding=UTF-8</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>thepassword</value>
<description>password to use against metastore database</description>
</property>
</configuration>
4. Add HIVE_HOME environment variable to /etc/profile. Modify PATH.
export HIVE_HOME=/home/hadoop/hive-0.13.1
export PATH=$HIVE_HOME/bin:$PATH
Update the profile
#source /etc/profile
5. type hive, you can enter hive successfully!