Shell

#!/bin/bash

# file: elk_logstash_auto_install_on_rhel.sh

# 官方文档:https://www.elastic.co/guide/en/logstash/current/installing-logstash.html#package-repositories

# variable
file_yum_repo_elastic=/etc/yum.repos.d/elk.repo
file_yum_conf=/etc/yum.conf

# function

function yum_repo() {
  echo ""
  echo "=================="
  echo "--> YUM:创建REPO文件"
  cat > $file_yum_repo_elastic < YUM:清理缓存"
  yum clean metadata
  yum clean all

  echo ""
  echo "--> YUM:刷新缓存"
  yum repolist

}

function yum_conf() {
  echo ""
  echo "=================="
  echo "--> 开启YUM缓存"

  sed -i '/keepcache/s/0/1/g' $file_yum_conf
}

function logstash_install() {
  echo ""
  echo "=================="
  echo "--> YUM安装"
  yum install -y java-1.8.0-openjdk.x86_64
  yum install -y logstash

}

# begin

# 处理YUM
yum_conf
yum_repo

# 执行安装 - logstash
logstash_install

# end

# finished

————————————————
Done。

说点什么

avatar

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据

  Subscribe  
提醒