linux搭建Gray

1、组件版本选定

|---------------|------------------------------------|
| 组件 | 版本号 |
| Graylog | 4.2.10 |
| MongoDB | 4.4.14 |
| Elasticsearch | 7.10.2 |
| jdk | java-1.8.0-openjdk-headless.x86_64 |

2、安装密码指令

# 安装pwd yum install -y pwgen

3、安装MongoDB

1、配置yum仓库

# 修改yum仓库配置 vim /etc/yum.repos.d/mongodb-org.repo # 加入一下内容 [mongodb-org-4.4] name=MongoDBRepository baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.2/x86_64/ gpgcheck=1 enabled=1 gpgkey=https://www.mongodb.org/static/pgp/server-4.2.asc

2、安装MongoDB

# 安装MongoDB yum -y install mongodb-org # 查看版本号 mongo --version sudo systemctl daemon-reload # 设置开机自启 sudo systemctl enable mongod.service # 启动MongoDB sudo systemctl start mongod.service # 查看状态 sudo systemctl --type=service --state=active | grep mongod

3、安装Elastic GPG key并配置yum仓库

# 安装Elastic GPG key rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch # 配置yum仓库.这里这种方式跟vim本质一样都是写数据到/etc/yum.repos.d/elasticsearch.repo中,只不过这种更方便 cat > /etc/yum.repos.d/elasticsearch.repo <<EOF [elasticsearch-7.x] name=Elasticsearch repository for 7.x packages baseurl=https://artifacts.elastic.co/packages/oss-7.x/yum gpgcheck=1 gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch enabled=1 autorefresh=1 type=rpm-md EOF

4、安装Elasticsearch

# 安装es yum -y install elasticsearch-oss # 修改Elasticsearch配置文件 cp /etc/elasticsearch/elasticsearch.yml /etc/elasticsearch/elasticsearch.yml_default sudo tee -a /etc/elasticsearch/elasticsearch.yml > /dev/null <<EOT cluster.name: graylog action.auto_create_index: false EOT # 启动 sudo systemctl daemon-reload sudo systemctl enable elasticsearch.service sudo systemctl restart elasticsearch.service sudo systemctl --type=service --state=active | grep elasticsearch # 查看版本信息 curl -XGET localhost:9200

5、安装graylog

# 安装4.2 sudo rpm -Uvh https://packages.graylog2.org/repo/packages/graylog-4.2-repository_latest.rpm # 安装graylog服务,包含了插件。如果不需要安装插件,只安装sudo yum install graylog-server sudo yum install graylog-server graylog-enterprise-plugins graylog-integrations-plugins graylog-enterprise-integrations-plugins

6、配置密码

配置password_secretroot_password_sha2,未配置graylog无法启动。文件路径:/etc/graylog/server/server.conf 创建password_secret,需要使用pwgen工具

# 生成96的安全密码,将生成的密码配置到password_secret即可。 pwgen -1 -s 96 # 示例结果如下 smypspdHATo9vGHTM6VUl4dtIjaI32okPekLCdQ5yiD7iakUwdY9w9LFH9sVA5qNZ8tFmnq0S65QNnLOxYdyyLMbtWg8H7bk

7、集群部署,多个节点的 password_secret需要相同,部署启动后这个值不要随便修改,修改后数据库中的所有用户的会话都会失效。

创建root_password_sha2,也就是admin账号的登录密码,这里我配置成admin

echo -n "Enter Password: " && head -1 </dev/stdin | tr -d '\n' | sha256sum | cut -d" " -f1

8、配置http_bind_address

文件路径:/etc/graylog/server/server.conf http_bind_address需要配置外部可访问到graylog的IP和地址,可以是域名或IP。默认为127.0.0.1:9000。配置成0.0.0.0:9000即可。

9、启动

sudo systemctl daemon-reload sudo systemctl enable graylog-server.service sudo systemctl start graylog-server.service sudo systemctl --type=service --state=active | grep graylog

10、具体代码图示

相关推荐
序属秋秋秋36 分钟前
《Linux系统编程之入门基础》【Linux基础 理论+命令】(上)
linux·运维·服务器·ubuntu·centos·命令模式
知白守黑2673 小时前
docker资源限制
运维·docker·容器
霍格沃兹测试开发学社测试人社区3 小时前
新手指南:通过 Playwright MCP Server 为 AI Agent 实现浏览器自动化能力
运维·人工智能·自动化
ximy13354 小时前
AI服务器工作之服务器的种类分类
运维·服务器
恒创科技HK4 小时前
香港服务器CPU中E5和Gold的区别
运维·服务器
Wang's Blog6 小时前
Linux小课堂: 文件操作警惕高危删除命令与深入文件链接机制
linux·运维·服务器
2501_915909068 小时前
iOS 混淆实战,多工具组合完成 IPA 混淆与加固(源码 + 成品 + 运维一体化方案)
android·运维·ios·小程序·uni-app·iphone·webview
我科绝伦(Huanhuan Zhou)8 小时前
分享一个可以一键制作在线yum源的脚本
linux·运维
爱宇阳8 小时前
禅道社区版 Docker Compose 服务迁移教程
运维·docker·容器
Paper_Love8 小时前
Linux-查看硬件接口软件占用
linux·运维·服务器