一键安装脚本实现快速部署GrayLog Server 4.2.10单机版

网友投稿 452 2022-09-30


一键安装脚本实现快速部署GrayLog Server 4.2.10单机版

一键安装脚本实现快速部署GrayLog Server 4.2.10单机版

一、需求背景

由于局点(分支机构)较多,为了快速部署GrayLog单机版

所以简单整理了一下GrayLog的安装步骤脚本,来实现一键安装GrayLog Server 4.2.10单机版

只需上传GraylogServer4.2.10_install.tar.gz和GrayLogServer_install.sh安装脚本并执行一键安装脚本即可完成GrayLog Server 4.2.10单机版的安装

说明: - 1、GraylogServer4.2.10_install.tar.gz中为GrayLogServer安装时所需的JDK+pwgen+MongoDB+elasticsearch+graylog-server的RPM包 使用createrepo方式打包制作成本地yum源来实现离线yum安装 ![20220618_132036.png](https://s2./images/20220628/1656419931101216.png?x-oss-process=image/watermark,size_14,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_30,g_se,x_10,y_10,shadow_20,type_ZmFuZ3poZW5naGVpdGk=) - 2、建议的资源配置如下 操作系统:CentOS7.9 CPU 8核 内存建议8GB内存以上 磁盘大小:建议单独一块数据盘,并挂载到/data目录 - 3、其中ES和MongoDB未做加密认证,因为只监听在本地127.0.0.1不对外暴露,若需要安全加固,请自行配置 GrayLogServer_install.sh脚本 ## 二、一键安装脚本内容如下

#!/bin/bash#关闭SELINUXsed -i 's/enforcing/disabled/g' /etc/selinux/configsetenforce 0#解压安装包tar -zxvf GraylogServer4.2.10_install.tar.gz -C /opt/mkdir /opt/yum_repo_backup mv /etc/yum.repos.d/CentOS.repo /opt/yum_repo_backupcp /opt/graylog_local.repo /etc/yum.repos.d/echo "priority=1" >> /etc/yum.repos.d/graylog_local.repo #安装JDK+pwgenyum install -y java-1.8.0-openjdk-headless.x86_64yum install -y pwgencp /opt/yum_repo_backup/CentOS.repo /etc/yum.repos.d/#安装mongodb-server服务yum install -y mongodb-org

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

#安装elasticsearchyum install elasticsearch -y#单独创建目录用于存放elasticsearch数据mkdir -p /data/elasticsearch/datamkdir -p /data/elasticsearch/logschown -R elasticsearch:elasticsearch /data/elasticsearchcp /etc/elasticsearch/elasticsearch.yml /etc/elasticsearch/elasticsearch.yml_default#修改elasticsearch相关配置文件sed -i "s@#cluster.name: my-application@cluster.name: graylog@g" /etc/elasticsearch/elasticsearch.ymlsed -i "s#path.data: /var/lib/elasticsearch#path.data: /data/elasticsearch/data#g" /etc/elasticsearch/elasticsearch.ymlsed -i "s#path.logs: /var/log/elasticsearch#path.logs: /data/elasticsearch/logs#g" /etc/elasticsearch/elasticsearch.yml#修改JVM内存大小sed -i "s/-Xms1g/-Xms4g/g" /etc/elasticsearch/jvm.optionssed -i "s/-Xmx1g/-Xmx4g/g" /etc/elasticsearch/jvm.options#启动elasticsearch服务systemctl daemon-reloadsystemctl enable elasticsearch.servicesystemctl restart elasticsearch.servicefirewall-cmd --add-port=9200/tcp --permanent --zone=public firewall-cmd --reload curl -s -XGET '-s -XGET 'install graylog-server -ycp /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.confsed -i "s/root_password_sha2 =/root_password_sha2 = 79a560ed561e6fc57b3d02a59335b7710fada90625e4c661fbb7b780fb92ceaa/g" /etc/graylog/server/server.confsed -i "s@#root_timezone = UTC@root_timezone = Asia/Shanghai@g" /etc/graylog/server/server.confsed -i "s@#= 127.0.0.1:9000@= 0.0.0.0:9000@g" /etc/graylog/server/server.confsed -i "s/allow_highlighting = false/allow_highlighting = true/g" /etc/graylog/server/server.conf#修改graylog-server启动时JVM内存大小sed -i "s/-Xms1g -Xmx1g/-Xms2g -Xmx2g/g" /etc/sysconfig/graylog-serverfirewall-cmd --add-port=9000/tcp --permanent --zone=public firewall-cmd --reload#启动graylog-server服务systemctl restart graylog-serversystemctl enable graylog-server

安装过程截图如下 目前只在CentOS7.9环境下进行部署测试,其他版本未测试

[root@centos ~]# lltotal 642960-rw-------. 1 root root 1648 Jul 3 2021 anaconda-ks.cfg-rw-r--r--. 1 root root 658378578 Jun 18 11:56 GraylogServer4.2.10_install.tar.gz-rw-r--r--. 1 root root 3065 Jun 18 13:07 GrayLogServer_install.sh[root@centos ~]# chmod 755 GrayLogServer_install.sh [root@centos ~]# ./GrayLogServer_install.sh

echo -n "Enter Password: " && head -1

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:Windows内核(游戏逆向)
下一篇:java实现一个接口调取另一个接口(接口一调取接口二)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~