Update Section_09/main.sh, Section_06/php.sh, Section_07/ssl.sh

This commit is contained in:
Kishan Takoordyal 2023-05-21 13:27:43 +00:00
parent 7900be4f59
commit bffd6c4fe7
3 changed files with 53 additions and 2 deletions

View File

@ -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

View File

@ -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

44
Section_09/main.sh Normal file
View File

@ -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://<ip_address>/icingaweb2/setup
sudo icingacli setup token create