The installation of elasticsearch is implemented by ytkah in the search of the laravel e-commerce site. It is not very laborious to solve it through its own search and learning ability. Let's sort out the installation of elasticsearch tutorial. The server is Centos 7. Friends in need can refer to it. Elasticsearch requires java8 or above; we go to https://www.oracle.com/technetwork/java/javase/downloads/index.html to download and install the latest version of java11 jdk, select Accept License Agreement and right-click jdk-11.0.1_linux-x64_bin .rpm copy link, enter command on the command line:
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http:%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie""http://download.oracle.com/otn-pub/java/jdk/11.0.1+13/90cf5d8f270a4347a95050320eef3fb7/jdk-11.0.1_linux-x64_bin.rpm"
Wait for download to complete
Start the installation, install jdk, pay attention to the file name to be consistent with the link
sudo rpm -ivh jdk-10.0.1_linux-x64_bin.rpm
Enter the following command, if you can see the version number, the installation is successful;
java -version
Download the elasticsearch installation, https://www.elastic.co/downloads/elasticsearch, select the RPM file (in this example, elasticsearch-6.4.2.rpm), copy the link, and enter the following command to download:
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.4.2.rpm
Install elasticsearch, pay attention to the same version number:
sudo rpm -ivh elasticsearch-6.4.2.rpm
Edit configuration items after installation
vim /etc/elasticsearch/elasticsearch.yml
Uncomment the following three lines (remove the # in front);
bootstrap.memory_lock:true
network.host:192.168.0.1
http.port:9200
Pay attention to open ports 9200 and 9300, because some operators will set server security group policies
Then change network.host to localhost
network.host: localhost
Start elasticsearch and enter
sudo systemctl daemon-reload
sudo systemctl enable elasticsearch.service
sudo systemctl start elasticsearch
Then check the 9200 port to check if it started successfully
netstat -plntu
If it still does not start up after half a day, it may be due to insufficient memory.
vim /etc/elasticsearch/jvm.options
Change the memory to less than half of your server's memory, for example, change it to 512M here;
Restart elasticsearch
sudo systemctl restart elasticsearch
Check whether the status is normal
curl 'localhost:9200'
At this point, elasticsearch is installed.
This article is referenced from https://baijunyao.com/article/155
Recommended Posts