1.首先下载软件,然后双击解压,我用的是7.17.3的版本
2.然后执行如下命令
Last login: Thu Mar 14 23:14:44 on ttys001
diannao1@xiejiandeMacBook-Air ~ % cd /Users/xiejian/local/software/elasticsearch/elasticsearch-7.17.3
diannao1@xiejiandeMacBook-Air elasticsearch-7.17.3 % bin/elasticsearch
warning: usage of JAVA_HOME is deprecated, use ES_JAVA_HOME
could not find java in JAVA_HOME at /Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/bin/java
diannao1@xiejiandeMacBook-Air elasticsearch-7.17.3 % echo $ES_JAVA_HOMEdiannao1@xiejiandeMacBook-Air elasticsearch-7.17.3 % cd
diannao1@xiejiandeMacBook-Air ~ % vim .bash_profile
diannao1@xiejiandeMacBook-Air ~ %
3. 用这个命令进去vim .bash_profile配置环境变量
我自己配置的ES_JAVA_HOME和ES_HOME
export ES_JAVA_HOME=/Users/xiejian/local/software/elasticsearch/elasticsearch-7.17.3/jdk.app/Contents/Home
export PATH=$PATH:$ES_JAVA_HOME/bin
export ES_HOME=/Users/xiejian/local/software/elasticsearch/elasticsearch-7.17.3
export PATH=$PATH:$ES_HOME/bin
配置完之后记得 source .bash_profile让配置生效,再执行echo $ES_JAVA_HOME这个命令看ES_JAVA_HOME配置是否生效。
4.启动命令
diannao1@xiejiandeMacBook-Air ~ % cd /Users/xiejian/local/software/elasticsearch/elasticsearch-7.17.3
diannao1@xiejiandeMacBook-Air elasticsearch-7.17.3 % bin/elasticsearch
看到这个就启动成功了
网页测试