1. 环境变量配置文件位置
vim /etc/profile
2. 在profile文件最下方中添加所需配置
#set mysql environment export MYSQL_HOME=/usr/local/mysql export PATH=$PATH:${MYSQL_HOME}/bin #set java environment export JAVA_HOME=/usr/local/java export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=${JAVA_HOME}/bin:$PATH #set zookeeper enviroment export ZOOKEEPER_HOME=/usr/local/zookeeper export PATH=$PATH:${ZOOKEEPER_HOME}/bin #set hadoop environment export HADOOP_HOME=/usr/local/hadoop-2.6.4 export PATH=$PATH:$JAVA_HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbin #set hive environment export HIVE_HOME=/usr/local/hive export PATH=$PATH:$JAVA_HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$HIVE_HOME/bin #set sqoop environment export SQOOP_HOME=/usr/local/sqoop_1.4.6_hadoop_2.0.4_alpha export PATH=$PATH:$JAVA_HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$HIVE_HOME/bin:$SQOOP_HOME/bin #set storm environment export STORM_HOME=/usr/local/storm export PATH=$PATH:$STORM_HOME/bin #set kafka environment export KAFKA_HOME=/usr/local/kafka export PATH=$PATH:$KAFKA_HOME/bin #set scala environment export SCALA_HOME=/usr/local/scala export PATH=$PATH:$SCALA_HOME/bin #set spark environment export SPARK_HOME=/usr/local/spark export PATH=$PATH:$SPARK_HOME/bin #set elasticsearch environment export ES_HOME=/home/centos/elasticsearch export PATH=$PATH:$ES_HOME/bin
3. 使配置文件立即生效 source /etc/profile
原文来自:https://blog.csdn.net/weixin_43215250/article/details/82797380