From 36db2f6bc672a09dac19c34e95a14f12f7d210be6adf1d969fa597fb107acaf1 Mon Sep 17 00:00:00 2001 From: Hubert Cornet Date: Fri, 6 Dec 2024 10:44:58 +0100 Subject: [PATCH] Update install-Gaylog-v6.1.sh --- install-Gaylog-v6.1.sh | 72 ++++++++++++++++++++++++++++++++---------- 1 file changed, 56 insertions(+), 16 deletions(-) diff --git a/install-Gaylog-v6.1.sh b/install-Gaylog-v6.1.sh index 75a1c9a..331eb7e 100644 --- a/install-Gaylog-v6.1.sh +++ b/install-Gaylog-v6.1.sh @@ -1,34 +1,76 @@ -####################################### -# Installation de MongoDB -####################################### +#!/bin/bash -apt update +echo "[+] Verification des droits d acces a ROOT" +if [ "$EUID" -ne 0 ];then + echo "Veuillez executer ce script en tant que ROOT" + exit 1 +fi -apt full-upgrade +echo "[+] Regler le redemarrage sur automatique pour eviter les pop ups de redemarrage" +sed -i 's/#$nrconf{restart} = '"'"'i'"'"';/$nrconf{restart} = '"'"'a'"'"';/g' /etc/needrestart/needrestart.conf +echo "[+] Verification des mises a jour" +apt-get update +apt-get full-upgrade -y + +echo "[+] Definition du nombre maximum de fichiers pour opensearch" +sysctl -w vm.max_map_count=262144 +echo 'vm.max_map_count=262144' >> /etc/sysctl.conf + +echo "[+] Installation des depenbdancies" +apt install dirmngr lsb-release gnupg apt-transport-https ca-certificates software-properties-common -y +apt install apt-transport-https uuid-runtime pwgen net-tools gnupg gnupg2 wgetcurl dirmngr -y + +echo "[+] Configuration NTP" timedatectl set-timezone Europe/Paris -apt install -y curl lsb-release ca-certificates gnupg2 pwgen wget - -curl -fsSL https://www.mongodb.org/static/pgp/server-6.0.asc | sudo gpg -o /usr/share/keyrings/mongodb-server-6.0.gpg --dearmor - -echo "deb [ signed-by=/usr/share/keyrings/mongodb-server-6.0.gpg] http://repo.mongodb.org/apt/debian bullseye/mongodb-org/6.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list +echo "[+] Installation de MongoDB" +wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | apt-key add - +echo "deb http://repo.mongodb.org/apt/debian bullseye/mongodb-org/6.0 main" | tee /etc/apt/sources.list.d/mongodb-org-6.0.list apt update - apt install -y mongodb-org wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.23_amd64.deb - dpkg -i libssl1.1_1.1.1f-1ubuntu2.23_amd64.deb apt install -y mongodb-org +echo "[+] Demarrer de Mongod" systemctl daemon-reload -systemctl enable mongod.service -systemctl restart mongod.service +systemctl enable mongod +systemctl restart mongod systemctl --type=service --state=active | grep mongod +echo "[+] Desactivation de la prise en charge des pages volumineuses" +cat > /etc/systemd/system/disable-transparent-huge-pages.service < /dev/null' +[Install] +WantedBy=basic.target +EOF + +echo "[+] Demarrer de Disable-transparent-huge-pages" +systemctl daemon-reload +systemctl enable disable-transparent-huge-pages.service +systemctl start disable-transparent-huge-pages.service + +echo "[+] Creation utilisateur Opensearch" +adduser --system --disabled-password --disabled-login --home /var/empty --no-create-home --quiet --force-badname --group opensearch + +echo "[+] Installion Opensearch" +curl -o- https://artifacts.opensearch.org/publickeys/opensearch.pgp | apt-key add - +echo "deb https://artifacts.opensearch.org/releases/bundle/opensearch/2.x/apt stable main" | tee -a /etc/apt/sources.list.d/opensearch-2.x.list + +apt update +env OPENSEARCH_INITIAL_ADMIN_PASSWORD=IT-Connect2024! apt-get install opensearch + +apt install opensearch=2.5.0 + ####################################### # Installation d'OpenSearch ####################################### @@ -66,8 +108,6 @@ nano /etc/opensearch/jvm.options cat /proc/sys/vm/max_map_count -sysctl -w vm.max_map_count=262144 - systemctl daemon-reload systemctl enable opensearch systemctl restart opensearch