-
导入Elasticsearch PGP密钥: 首先,导入Elasticsearch的PGP密钥,用于验证软件包的完整性和真实性。执行以下命令:
bashCopy code
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --dearmor -o /usr/share/keyrings/elasticsearch-keyring.gpg -
安装apt-transport-https(如果需要): 在Debian系统上,如果您尚未安装apt-transport-https包,则需要安装它。Ubuntu系统通常已经默认安装了此包。执行以下命令:
sqlCopy codesudo apt-get update
sudo apt-get install apt-transport-https -
保存repository定义文件: 创建一个名为
elastic-8.x.list
的文件,并将以下内容保存到/etc/apt/sources.list.d/
目录下:bashCopy code
echo "deb [signed-by=/usr/share/keyrings/elasticsearch-keyring.gpg] https://artifacts.elastic.co/packages/8.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-8.x.list -
更新软件包信息: 运行以下命令以更新软件包列表:
sqlCopy code
sudo apt-get update -
安装Elasticsearch: 运行以下命令来安装Elasticsearch:
arduinoCopy code
sudo apt-get install elasticsearch -
启动Elasticsearch服务: 安装完成后,Elasticsearch将自动作为一个系统服务启动。您可以使用以下命令来启动、停止和重启Elasticsearch服务:
arduinoCopy codesudo systemctl start elasticsearch
sudo systemctl stop elasticsearch
sudo systemctl restart elasticsearch -
重置密码
sudo /usr/share/elasticsearch/bin/elasticsearch-reset-password -u elastic
-
访问https://localhost:9200,输入账户密码