linux设置环境变量(这里以hive为例给大家举例)
1.进入: cd /export/servers/hive/bin/
-rwxr-xr-x. 1 root root 1031 Apr 30 2015 beeline
-rw-r--r--. 1 root root 21064 Nov 18 00:40 derby.log
drwxr-xr-x. 3 root root 4096 Nov 18 00:14 ext
-rwxr-xr-x. 1 root root 7844 May 8 2015 hive
-rwxr-xr-x. 1 root root 1900 Apr 30 2015 hive-config.sh
-rwxr-xr-x. 1 root root 885 Apr 30 2015 hiveserver2
drwxr-xr-x. 5 root root 4096 Nov 18 00:40 metastore_db
-rwxr-xr-x. 1 root root 832 Apr 30 2015 metatool
-rwxr-xr-x. 1 root root 884 Apr 30 2015 schematool
2. ./hive (这个是相对路径) 或者是 hive 或者是: /export/servers/hive/bin/hive (这个是绝对路径) (这个是可以启动起来的)
3.配置环境变量:以hive为例: vim /etc/profile
export SPARK_HOME=/export/servers/spark
export HIVE_HOME=/export/servers/hive
export HADOOP_HOME=/export/servers/hadoop
export KAFKA_HOME=/export/servers/kafka
export HBASE_HOME=/export/servers/hbase
export PATH=$PATH:$HADOOP_HOME/bin$HADOOP_HOME/sbin:$SPARK_HOME/sbin:$SPARK_H
OME/bin:$KAFKA_HOME/bin:$HBASE_HOME/bin:$HIVE_HOME/bin
原创作品,转载请附上链接.https://www.cnblogs.com/xinliang1788/
4.编译时配置生效: source /etc/profile