在Ubuntu上安装Elasticsearch的步骤如下:
1.导入Elasticsearch公钥:
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
2.添加elasticsearch到APT源列表
echo "deb https://artifacts.elastic.co/packages/7.3.1/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.3.1.list
3.更新包索引
sudo apt-get update
4.安装elasticsearch
sudo systemctl install elasticsearch
5.启动elasticsearch服务
sudo systemctl start elasticsearch.service
6.设置系统自启动
sudo systemctl enable elasticsearch.service
7.验证elasticsearch是否运行
curl -X GET "localhost:9200"