开源日志平台GrayLog最新稳定版本6.0.5的一键安装脚本

2024-08-11 16:07:08 浏览数 (2)

GrayLog最新稳定版本6.0.5的一键安装脚本

1.GrayLogServer6.0.5_EL9_install.sh一键安装脚本内容如下

代码语言:javascript复制
#!/bin/bash
#关闭SELINUX
sed -i 's/enforcing/disabled/g' /etc/selinux/config
setenforce 0
#解压安装包
mkdir -p /opt/GrayLog_install
tar -zxvf ./GrayLog6.0.5_MongoDB6.0_OpenSearch2.13.0_EL9_RPM.tar.gz -C /opt/GrayLog_install
cat > /etc/yum.repos.d/mongodb-org.repo << EOF
[mongodb-org-6.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/9/mongodb-org/6.0/x86_64/
gpgcheck=0
enabled=1
gpgkey=https://pgp.mongodb.com/server-6.0.asc
EOF
cd /opt/GrayLog_install
#安装mongodb-server服务
rpm -ivh cyrus-sasl*.rpm
rpm -ivh mongodb*.rpm

#启动mongodb-server服务
systemctl daemon-reload
systemctl enable mongod.service
systemctl start mongod.service
systemctl --type=service --state=active | grep mongod
firewall-cmd --add-port=27017/tcp --permanent --zone=public 
firewall-cmd --reload 

#安装opensearch
env OPENSEARCH_INITIAL_ADMIN_PASSWORD=Opensearch_2024 rpm -ivh /opt/GrayLog_install/opensearch-2.13.0-linux-x64.rpm
#单独的/data目录下创建目录用于存放opensearch数据
mkdir -p /data/opensearch/data
mkdir -p /data/opensearch/logs
chown -R opensearch /data/opensearch
sysctl -w vm.max_map_count=262144
echo 'vm.max_map_count=262144' >> /etc/sysctl.conf


cp /etc/opensearch/opensearch.yml /etc/opensearch/opensearch.yml_default
#修改opensearch相关配置文件
sed -i "s@#cluster.name: my-application@cluster.name: graylog@g" /etc/opensearch/opensearch.yml
sed -i "s@#node.name: node-1@node.name: graylog@g" /etc/opensearch/opensearch.yml
sed -i "s#path.data: /var/lib/opensearch#path.data: /data/opensearch/data#g" /etc/opensearch/opensearch.yml
sed -i "s#path.logs: /var/log/opensearch#path.logs: /data/opensearch/logs#g" /etc/opensearch/opensearch.yml
sed -i "s@#network.host: 192.168.0.1@network.host: 0.0.0.0@g" /etc/opensearch/opensearch.yml
echo "discovery.type: single-node" >> /etc/opensearch/opensearch.yml
echo "action.auto_create_index: false" >> /etc/opensearch/opensearch.yml
echo "indices.query.bool.max_clause_count: 32768" >> /etc/opensearch/opensearch.yml
sed -i "s#plugins.security.ssl.http.enabled: true#plugins.security.ssl.http.enabled: false#g" /etc/opensearch/opensearch.yml
#修改JVM内存大小
sed -i "s/-Xms1g/-Xms4g/g" /etc/opensearch/jvm.options
sed -i "s/-Xmx1g/-Xmx4g/g" /etc/opensearch/jvm.options
#启动opensearch服务
systemctl daemon-reload
systemctl enable opensearch.service
systemctl restart opensearch.service
firewall-cmd --add-port=9200/tcp --permanent --zone=public 
firewall-cmd --reload 
curl -s -XGET 'http://127.0.0.1:9200/_cluster/health?pretty=true'
curl -s -XGET 'http://127.0.0.1:9200/_cat/nodes?v'
#安装graylog-server服务
rpm -ivh  /opt/GrayLog_install/graylog-server-6.0.5-1.x86_64.rpm
cp /etc/graylog/server/server.conf /etc/graylog/server/server.conf_default
#修改graylog-server相关配置文件
sed -i "s/password_secret =/password_secret = 0pAHJtPdZZUb5yHAvFbBezbWAlQwh9CbRX1rshJEVxM0kV7t0SpIgY5q9tLpVEwWLElhG3EtbvQ03mTm9i0HuvWKwlWgWiIJ/g" /etc/graylog/server/server.conf
sed -i "s/root_password_sha2 =/root_password_sha2 = 429d280c5ddad83d94770b077b22124231efc727d504b107883297304b3e2939/g" /etc/graylog/server/server.conf
sed -i "s@#root_timezone = UTC@root_timezone = Asia/Shanghai@g" /etc/graylog/server/server.conf
sed -i "s@#http_bind_address = 127.0.0.1:9000@http_bind_address = 0.0.0.0:9000@g" /etc/graylog/server/server.conf
sed -i "s/allow_highlighting = false/allow_highlighting = true/g" /etc/graylog/server/server.conf
echo "elasticsearch_hosts = http://admin:Opensearch_2024@127.0.0.1:9200" >> /etc/graylog/server/server.conf
#修改graylog-server启动时JVM内存大小
sed -i "s/-Xms1g -Xmx1g/-Xms2g -Xmx2g/g" /etc/sysconfig/graylog-server

firewall-cmd --add-port=9000/tcp --permanent --zone=public 
firewall-cmd --reload
#启动graylog-server服务
systemctl daemon-reload
systemctl restart graylog-server
systemctl enable graylog-server

2.具体安装步骤

将如下脚本与压缩包上传到AlmaLinux9.X或RockyLinux9.X系统的同一个目录下

代码语言:javascript复制
GrayLogServer6.0.5_EL9_install.sh
GrayLog6.0.5_MongoDB6.0_OpenSearch2.13.0_EL9_RPM.tar.gz

然后sh GrayLogServer6.0.5_EL9_install.sh执行一键安装脚本即可

下面是安装过程的截图

(图片点击放大查看)

(图片点击放大查看)

(图片点击放大查看)

具体可以参考之前的文章

在AlmaLinux 9.3下使用一键脚本安装最新GrayLog6.0.1版本

安装完成后Graylog的登录账号密码为admin/Graylog@2023

以上脚本是针对RHEL9.X/CentOS9.X等EL9系列系统的一键安装脚本

Tips: 对于很多还在使用CentOS7.X系列系统这边也制作了针对EL7的一键安装脚本与压缩包

代码语言:javascript复制
GrayLogServer6.0.5_EL7_install.sh
GrayLog6.0.5_MongoDB6.0_OpenSearch2.13.0_EL7_RPM.tar.gz

0 人点赞