一.安装Java
sudo apt-add-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install openjdk-8-jre-headless
验证
java -version
安装JDK
sudo apt-get install openjdk-8-jdk-headless
验证
javac
JAVA HOME /usr/lib/jvm/java-8-oracle
JAVA CLASSPATH /usr/share/java
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export CLASSPATH=/usr/share/java
source /etc/profile
二.安装ES
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
sudo apt-get install apt-transport-https
echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list
sudo apt-get update
sudo apt-get install elasticsearch
ps -p 1
sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable elasticsearch.service
sudo systemctl start elasticsearch.service
//sudo systemctl stop elasticsearch.service
//sudo systemctl status elasticsearch.service
验证
curl localhost:9200
三.安装ik
sudo /usr/share/elasticsearch/bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.4.1/elasticsearch-analysis-ik-7.4.1.zip
重启
sudo systemctl stop elasticsearch.service
sudo systemctl start elasticsearch.service
验证
curl 'http://127.0.0.1:9200/_analyze?pretty=true' -H 'Content-Type: application/json' -d '{ "analyzer":"ik_max_word", "text":"士大夫敢死队风格MN"}'