首先将下载包拷贝到相关路径下解压:下载地址:https://mirrors.cnnic.cn/apache/
进入到conf配置:
vim log4j.properties
内容如下:
# ***** Set root logger level to DEBUG and its only appender to A.
log4j.logger.org.apache.pig=info, A
# ***** A is set to be a ConsoleAppender.
log4j.appender.A=org.apache.log4j.ConsoleAppender
# ***** A uses PatternLayout.
log4j.appender.A.layout=org.apache.log4j.PatternLayout
log4j.appender.A.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
pig.logfile=/root/pig-0.16.0/logs
log4jconf=/root/pig-0.16.0/conf/log4j.properties
exectype=mapreduce
vim /etc/profile
export JAVA_HOME=/usr/local/jdk1.8.0_172 #这里路径为自己解压的JDK的路径
export CLASSPATH=${JAVA_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
# Hadoop Environment Variables
export HADOOP_HOME=/root/hadoop-2.8.4
export HADOOP_INSTALL=$HADOOP_HOME
export HADOOP_MAPRED_HOME=$HADOOP_HOME
export HADOOP_COMMON_HOME=$HADOOP_HOME
export HADOOP_HDFS_HOME=$HADOOP_HOME
export YARN_HOME=$HADOOP_HOME
export HADOOP_CONF_DIR=$HADOOP_HOME/etc/hadoop
export YARN_CONF_DIR=$HADOOP_HOME/etc/hadoop
export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native
export PATH=$PATH:$HADOOP_HOME/sbin:$HADOOP_HOME/bin
#zookper
export ZOOKEEPER_HOME=/root/zookeeper-3.4.12
export PATH=$PATH:$ZOOKEEPER_HOME/bin
#hbase
export HBASE_HOME=/root/hbase-2.0.0
export PATH=$PATH:$HBASE_HOME/bin
#scala
export SCALA_HOME=/root/scala
export PATH=$PATH:$SCALA_HOME/bin
#spark
export SPARK_HOME=/root/spark
export PATH=$PATH:$SPARK_HOME/bin
#HIVE
export HIVE_HOME=/root/hive2
export PATH=$PATH:$HIVE_HOME/bin
#PIG
export PIG_HOME=/root/pig-0.16.0
export PIG_CLASSPATH=$HADOOP_HOME/etc/hadoop
export PATH=$PATH:$PIG_HOME/bin
然后启动hadoop,既可以了输入pig,成功!!!