From bffd6c4fe7df5a82133337acc58ac1b30c22fe2d Mon Sep 17 00:00:00 2001 From: Kishan Takoordyal Date: Sun, 21 May 2023 13:27:43 +0000 Subject: [PATCH] Update Section_09/main.sh, Section_06/php.sh, Section_07/ssl.sh --- Section_06/php.sh | 7 +++++++ Section_07/ssl.sh | 4 ++-- Section_09/main.sh | 44 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 Section_09/main.sh diff --git a/Section_06/php.sh b/Section_06/php.sh index 1f6cb22..647545e 100644 --- a/Section_06/php.sh +++ b/Section_06/php.sh @@ -45,3 +45,10 @@ sudo nano /etc/php/8.1/fpm/php.ini sudo systemctl restart php${PHP_VER}-fpm # sudo systemctl stop nginx # sudo systemctl disable nginx + +# Some useful commands +# update-alternatives --set php /usr/bin/php8.1 +# update-alternatives --set phar /usr/bin/phar8.1 +# update-alternatives --set phar.phar /usr/bin/phar.phar8.1 +# update-alternatives --set phpize /usr/bin/phpize8.1 +# update-alternatives --set php-config /usr/bin/php-config8.1 diff --git a/Section_07/ssl.sh b/Section_07/ssl.sh index 17422b3..4ef56c4 100644 --- a/Section_07/ssl.sh +++ b/Section_07/ssl.sh @@ -5,8 +5,8 @@ sudo apt install certbot python3-certbot-apache python3-certbot-nginx # Apache2 sudo a2enmod ssl -sudo certbot certonly -d demo-devops.konnect.dev --apache2 -sudo certbot certonly -d demo-devops-api.konnect.dev --apache2 +sudo certbot certonly -d demo-devops.konnect.dev --apache +sudo certbot certonly -d demo-devops-api.konnect.dev --apache sudo systemctl enable apache2 --now cd /etc/apache2/sites-available/ sudo nano 000-default-ssl.conf diff --git a/Section_09/main.sh b/Section_09/main.sh new file mode 100644 index 0000000..ee9bc9f --- /dev/null +++ b/Section_09/main.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +PHP_VER=8.1 + +# Apache Setup +sudo systemctl disable nginx +sudo systemctl stop nginx +sudo systemctl enable apache2 --now +sudo certbot certonly -d demo-devops-monitoring.konnect.dev --apache +cd /etc/apache2/sites-available/ +sudo nano monitoring.conf +sudo a2ensite monitoring +sudo systemctl reload apache2 + +# Install Icinga2 +sudo apt install apt-transport-https wget gnupg curl +curl https://packages.icinga.com/icinga.key | sudo apt-key add - +echo "deb http://packages.icinga.com/ubuntu icinga-$(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/icinga2.list +echo "deb-src http://packages.icinga.com/ubuntu icinga-$(lsb_release -sc) main" | sudo tee -a /etc/apt/sources.list.d/icinga2.list +sudo apt update +sudo apt install php${PHP_VER}-dba php${PHP_VER}-ldap php${PHP_VER}-json php${PHP_VER}-intl php${PHP_VER}-pdo-mysql php${PHP_VER}-imagick php${PHP_VER}-dom +sudo apt install icinga2 icingaweb2 monitoring-plugins icinga2-ido-mysql icinga2-ido-mysql +sudo addgroup --system icingaweb2 +sudo usermod -a -G icingaweb2 www-data + +sudo systemctl restart apache2 +sudo icingacli setup token create +sudo systemctl enable --now icinga2 +sudo systemctl enable --now apache2 +sudo systemctl enable --now mysql + +# SQL Commands to run +# CREATE DATABASE icingawebdb; +# GRANT ALL PRIVILEGES ON icingawebdb.* TO icingaweb@localhost IDENTIFIED BY 'password'; +# GRANT ALL PRIVILEGES ON icinga2.* TO 'icinga2'@'localhost'; +# exit + +sudo icinga2 feature enable ido-mysql +sudo icinga2 feature enable command +sudo systemctl restart icinga2 + +sudo icinga2 api setup +# http:///icingaweb2/setup +sudo icingacli setup token create