10025-adding lts support for online installers

This commit is contained in:
rafael 2023-01-25 17:49:39 +01:00
parent 77b3be4d60
commit 7b2096edda
2 changed files with 64 additions and 28 deletions

View File

@ -4,7 +4,7 @@
#######################################################
## Tested versions ##
# Centos 8.4, 8.5
# Rocky 8.4, 8.5
# Rocky 8.4, 8.5, 8.6, 8.7
# Almalinuz 8.4, 8.5
# RedHat 8.5
@ -14,24 +14,25 @@ PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf
PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
S_VERSION='202209231'
S_VERSION='202301251'
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
# define default variables
[ "$TZ" ] || TZ="Europe/Madrid"
[ "$MYVER" ] || MYVER=57
[ "$PHPVER" ] || PHPVER=8
[ "$DBHOST" ] || DBHOST=127.0.0.1
[ "$DBNAME" ] || DBNAME=pandora
[ "$DBUSER" ] || DBUSER=pandora
[ "$DBPASS" ] || DBPASS=pandora
[ "$DBPORT" ] || DBPORT=3306
[ "$TZ" ] || TZ="Europe/Madrid"
[ "$MYVER" ] || MYVER=57
[ "$PHPVER" ] || PHPVER=8
[ "$DBHOST" ] || DBHOST=127.0.0.1
[ "$DBNAME" ] || DBNAME=pandora
[ "$DBUSER" ] || DBUSER=pandora
[ "$DBPASS" ] || DBPASS=pandora
[ "$DBPORT" ] || DBPORT=3306
[ "$DBROOTUSER" ] || DBROOTUSER=root
[ "$DBROOTPASS" ] || DBROOTPASS=pandora
[ "$SKIP_PRECHECK" ] || SKIP_PRECHECK=0
[ "$SKIP_DATABASE_INSTALL" ] || SKIP_DATABASE_INSTALL=0
[ "$SKIP_DATABASE_INSTALL" ] || SKIP_DATABASE_INSTALL=0
[ "$SKIP_KERNEL_OPTIMIZATIONS" ] || SKIP_KERNEL_OPTIMIZATIONS=0
[ "$POOL_SIZE" ] || POOL_SIZE=$(grep -i total /proc/meminfo | head -1 | awk '{printf "%.2f \n", $(NF-1)*0.4/1024}' | sed "s/\\..*$/M/g")
[ "$POOL_SIZE" ] || POOL_SIZE=$(grep -i total /proc/meminfo | head -1 | awk '{printf "%.2f \n", $(NF-1)*0.4/1024}' | sed "s/\\..*$/M/g")
[ "$PANDORA_LTS" ] || PANDORA_LTS=1
[ "$PANDORA_BETA" ] || PANDORA_BETA=0
# Ansi color code variables
@ -41,7 +42,6 @@ cyan="\e[0;36m"
reset="\e[0m"
# Functions
execute_cmd () {
local cmd="$1"
local msg="$2"
@ -76,7 +76,7 @@ check_cmd_status () {
check_pre_pandora () {
echo -en "${cyan}Checking environment ... ${reset}"
rpm -qa | grep 'pandorafms_' &>> /dev/null && local fail=true
rpm -qa | grep -v "pandorawmic" | grep 'pandorafms_' &>> /dev/null && local fail=true
[ -d "$PANDORA_CONSOLE" ] && local fail=true
[ -f /usr/bin/pandora_server ] && local fail=true
@ -137,7 +137,10 @@ check_root_permissions
[ "$SKIP_PRECHECK" == 1 ] || check_pre_pandora
#advicing BETA PROGRAM
[ "$PANDORA_BETA" -ne '0' ] && echo -e "${red}BETA version enable using nightly PandoraFMS packages${reset}"
INSTALLING_VER="${green}RRR version enable using RRR PandoraFMS packages${reset}"
[ "$PANDORA_BETA" -ne '0' ] && INSTALLING_VER="${red}BETA version enable using nightly PandoraFMS packages${reset}"
[ "$PANDORA_LTS" -ne '0' ] && INSTALLING_VER="${green}LTS version enable using LTS PandoraFMS packages${reset}"
echo -e $INSTALLING_VER
# Connectivity
check_repo_connection
@ -467,6 +470,8 @@ query_cache_size = 64M
query_cache_min_res_unit = 2k
query_cache_limit = 256K
#skip-log-bin
sql_mode=""
[mysqld_safe]
@ -477,6 +482,7 @@ EO_CONFIG_F
if [ "$MYVER" -eq '80' ] ; then
sed -i -e "/query_cache.*/ s/^#*/#/g" /etc/my.cnf
sed -i -e "s/#skip-log-bin/skip-log-bin/g" /etc/my.cnf
fi
execute_cmd "systemctl restart mysqld" "Configuring database engine"
@ -485,11 +491,18 @@ fi
export MYSQL_PWD=$DBPASS
#Define packages
if [ "$PANDORA_BETA" -eq '0' ] ; then
if [ "$PANDORA_LTS" -eq '1' ] ; then
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/LTS/pandorafms_server-7.0NG.noarch.rpm"
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/LTS/pandorafms_console-7.0NG.noarch.rpm"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/LTS/pandorafms_agent_linux-7.0NG.noarch.rpm"
elif [ "$PANDORA_LTS" -ne '1' ] ; then
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_server-7.0NG.noarch.rpm"
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_console-7.0NG.noarch.rpm"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux-7.0NG.noarch.rpm"
elif [ "$PANDORA_BETA" -ne '0' ] ; then
fi
# if beta is enable
if [ "$PANDORA_BETA" -eq '1' ] ; then
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandora_enterprise_nightlies/pandorafms_server-latest.x86_64.rpm"
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="https://pandorafms.com/community/community-console-rpm-beta/"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux-7.0NG.noarch.rpm"

View File

@ -16,7 +16,7 @@ PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
WORKDIR=/opt/pandora/deploy
S_VERSION='2022052501'
S_VERSION='202301251'
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
rm -f $LOGFILE &> /dev/null # remove last log before start
@ -34,6 +34,8 @@ rm -f $LOGFILE &> /dev/null # remove last log before start
[ "$SKIP_KERNEL_OPTIMIZATIONS" ] || SKIP_KERNEL_OPTIMIZATIONS=0
[ "$POOL_SIZE" ] || POOL_SIZE=$(grep -i total /proc/meminfo | head -1 | awk '{printf "%.2f \n", $(NF-1)*0.4/1024}' | sed "s/\\..*$/M/g")
[ "$PANDORA_BETA" ] || PANDORA_BETA=0
[ "$PANDORA_LTS" ] || PANDORA_LTS=1
# Ansi color code variables
red="\e[0;91m"
@ -134,7 +136,10 @@ check_root_permissions
[ "$SKIP_PRECHECK" == 1 ] || check_pre_pandora
#advicing BETA PROGRAM
[ "$PANDORA_BETA" -ne '0' ] && echo -e "${red}BETA version enable using nightly PandoraFMS packages${reset}"
INSTALLING_VER="${green}RRR version enable using RRR PandoraFMS packages${reset}"
[ "$PANDORA_BETA" -ne '0' ] && INSTALLING_VER="${red}BETA version enable using nightly PandoraFMS packages${reset}"
[ "$PANDORA_LTS" -ne '0' ] && INSTALLING_VER="${green}LTS version enable using LTS PandoraFMS packages${reset}"
echo -e $INSTALLING_VER
# Connectivity
check_repo_connection
@ -272,14 +277,19 @@ echo -en "${cyan}Installing phantomjs...${reset}"
/usr/bin/phantomjs --version &>> "$LOGFILE"
check_cmd_status "Error Installing phanromjs"
# create symlink for fping
rm -f /usr/sbin/fping &>> "$LOGFILE"
ln -s /usr/bin/fping /usr/sbin/fping &>> "$LOGFILE"
# Chrome
rm -f /usr/bin/chromium-browser &>> "$LOGFILE"
execute_cmd "wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb" "Downloading google chrome"
execute_cmd "apt install -y ./google-chrome-stable_current_amd64.deb" "Intalling google chrome"
execute_cmd "ln -s /usr/bin/google-chrome /usr/bin/chromium-browser" "Creating /usr/bin/chromium-browser Symlink"
# SDK VMware perl dependencies
vmware_dependencies=" \
lib32z1 \
vmware_dependencies="\
lib32z1 \
lib32z1 \
build-essential \
uuid uuid-dev \
@ -350,16 +360,22 @@ systemctl stop apparmor &>> "$LOGFILE"
systemctl disable apparmor &>> "$LOGFILE"
#install mysql
debconf-set-selections <<< $(echo -n "mysql-server mysql-server/root_password password $DBROOTPASS") &>> "$LOGFILE"
debconf-set-selections <<< $(echo -n "mysql-server mysql-server/root_password_again password $DBROOTPASS") &>> "$LOGFILE"
echo -en "${cyan}Installing MySql Server...${reset}"
env DEBIAN_FRONTEND=noninteractive apt install -y mysql-server &>> "$LOGFILE"
execute_cmd "curl -O https://repo.percona.com/apt/percona-release_latest.generic_all.deb" "Downloading Percona repository for MySQL8"
execute_cmd "apt install -y gnupg2 lsb-release ./percona-release_latest.generic_all.deb" "Installing Percona repository for MySQL8"
execute_cmd "percona-release setup ps80" "Configuring Percona repository for MySQL8"
echo -en "${cyan}Installing Percona Server for MySQL8...${reset}"
env DEBIAN_FRONTEND=noninteractive apt install -y percona-server-server &>> "$LOGFILE"
check_cmd_status "Error Installing MySql Server"
#Configuring Database
if [ "$SKIP_DATABASE_INSTALL" -eq '0' ] ; then
execute_cmd "systemctl start mysql" "Starting database engine"
echo """
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '$DBROOTPASS';
""" | mysql -uroot &>> "$LOGFILE"
export MYSQL_PWD=$DBROOTPASS
echo -en "${cyan}Creating Pandora FMS database...${reset}"
@ -399,11 +415,12 @@ max_connections = 100
key_buffer_size=4M
read_buffer_size=128K
read_rnd_buffer_size=128K
sort_buffer_size=128K
join_buffer_size=4M
skip-log-bin
sql_mode=""
log-error=/var/log/mysql/error.log
@ -417,11 +434,17 @@ execute_cmd "systemctl restart mysql" "Configuring and restarting database engin
#Define packages
if [ "$PANDORA_BETA" -eq '0' ] ; then
if [ "$PANDORA_LTS" -eq '1' ] ; then
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/LTS/pandorafms_server-7.0NG.tar.gz"
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/LTS/pandorafms_console-7.0NG.tar.gz"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/LTS/pandorafms_agent_linux-7.0NG.tar.gz"
elif [ "$PANDORA_LTS" -ne '1' ] ; then
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/pandorafms_server-7.0NG.tar.gz"
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/pandorafms_console-7.0NG.tar.gz"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/pandorafms_agent_linux-7.0NG.tar.gz"
elif [ "$PANDORA_BETA" -ne '0' ] ; then
fi
if [ "$PANDORA_BETA" -eq '1' ] ; then
[ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.artica.es/pandora_enterprise_nightlies/pandorafms_server-latest_x86_64.tar.gz"
[ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.artica.es/pandora_enterprise_nightlies/pandorafms_console-latest.tar.gz"
[ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.artica.es/pandorafms/latest/Tarball/pandorafms_agent_linux-7.0NG.tar.gz"