Update install-Gaylog-v6.1.sh

This commit is contained in:
Hubert Cornet 2024-12-06 10:44:58 +01:00
parent 3181e0699f
commit 36db2f6bc6

View File

@ -1,34 +1,76 @@
####################################### #!/bin/bash
# Installation de MongoDB
#######################################
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 timedatectl set-timezone Europe/Paris
apt install -y curl lsb-release ca-certificates gnupg2 pwgen wget echo "[+] Installation de MongoDB"
wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | apt-key add -
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 http://repo.mongodb.org/apt/debian bullseye/mongodb-org/6.0 main" | tee /etc/apt/sources.list.d/mongodb-org-6.0.list
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
apt update apt update
apt install -y mongodb-org apt install -y mongodb-org
wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.23_amd64.deb 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 dpkg -i libssl1.1_1.1.1f-1ubuntu2.23_amd64.deb
apt install -y mongodb-org apt install -y mongodb-org
echo "[+] Demarrer de Mongod"
systemctl daemon-reload systemctl daemon-reload
systemctl enable mongod.service systemctl enable mongod
systemctl restart mongod.service systemctl restart mongod
systemctl --type=service --state=active | grep 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 <<EOF
Description=Disable Transparent Huge Pages (THP)
DefaultDependencies=no
After=sysinit.target local-fs.target
[Service]
Type=oneshot
ExecStart=/bin/sh -c 'echo never | tee /sys/kernel/mm/transparent_hugepage/enabled > /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 # Installation d'OpenSearch
####################################### #######################################
@ -66,8 +108,6 @@ nano /etc/opensearch/jvm.options
cat /proc/sys/vm/max_map_count cat /proc/sys/vm/max_map_count
sysctl -w vm.max_map_count=262144
systemctl daemon-reload systemctl daemon-reload
systemctl enable opensearch systemctl enable opensearch
systemctl restart opensearch systemctl restart opensearch