403Webshell
Server IP : 104.129.129.72  /  Your IP : 216.73.216.229
Web Server : LiteSpeed
System : Linux 123answers 5.15.0-143-generic #153-Ubuntu SMP Fri Jun 13 19:10:45 UTC 2025 x86_64
User : answe8064 ( 1002)
PHP Version : 8.2.28
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /opt/installer/apps/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/installer/apps/zabbix-7.0-offirepo
#!/bin/bash

if [ -f "include/startup.sh" ]; then
    . include/startup.sh
elif [ -f "../include/startup.sh" ]; then
    . ../include/startup.sh
fi

checkTagExist php.success
checkTagExist httpd.success
checkTagExist mysqld.success

rootDir=$(rootDir)

echo "Installing php ldap" | log
installPackage php8.3-ldap
waitOrStop 0 "Failed to install ldap"

echo "Downloading Zabbix from official repo" | log
curlDownload https://repo.zabbix.com/zabbix/7.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_7.0-2+ubuntu24.04_all.deb 
waitOrStop 0 "File not downloaded from official source"

echo "Extracting Zabbix" | log
dpkg -i zabbix-release_7.0-2+ubuntu24.04_all.deb
waitOrStop 0 "Failed to extract application archive"
apt update | log

echo "Installing Zabbix" | log
installPackage zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent
waitOrStop 0 "Failed to install Zabbix"

chmod 600 ~/.my.cnf

echo "Creating Zabbix Database" | log
mysql --defaults-file=/root/.my.cnf -h localhost <<EOF
create database zabbix character set utf8mb4 collate utf8mb4_bin;
create user zabbixuser@localhost identified by '${ADMINPASSWORD}';
grant all privileges on zabbix.* to zabbixuser@localhost;
set global log_bin_trust_function_creators = 1;
FLUSH PRIVILEGES;
EOF

echo "Tweaking Zabbix & PHP configuration" | log
sed -i "s/DBName=zabbix_db/DBName=zabbix/g" /etc/zabbix/zabbix_server.conf
sed -i "s/DBUser=zabbix/DBUser=zabbixuser/g" /etc/zabbix/zabbix_server.conf
sed -i "s/#\sDBPassword=/DBPassword=${ADMINPASSWORD}/g" /etc/zabbix/zabbix_server.conf
sed -i "s/post_max_size = 8M/post_max_size = 32M/g" /etc/php/8.3/fpm/php.ini
sed -i "s/max_input_time = 60/max_input_time = 360/g" /etc/php/8.3/fpm/php.ini
sed -i "s/max_execution_time = 30/max_execution_time = 360/g" /etc/php/8.3/fpm/php.ini
sed -i "s/post_max_size = 8M/post_max_size = 32M/g" /etc/php/8.3/apache2/php.ini
sed -i "s/max_input_time = 60/max_input_time = 360/g" /etc/php/8.3/apache2/php.ini
sed -i "s/max_execution_time = 30/max_execution_time = 360/g" /etc/php/8.3/apache2/php.ini
sed -i "s/127.0.0.1/0.0.0.0/g" /etc/mysql/mysql.conf.d/mysqld.cnf
echo "StartIPMIPollers=1" >> /etc/zabbix/zabbix_server.conf
echo "StartSNMPTrapper=1" >> /etc/zabbix/zabbix_server.conf
echo "StartVMwareCollectors=1" >> /etc/zabbix/zabbix_server.conf
echo "StartReportWriters=1" >> /etc/zabbix/zabbix_server.conf
echo "WebServiceURL=1" >> /etc/zabbix/zabbix_server.conf

echo "Adding FW rules" | log
ufw allow 10050
ufw allow 10051
ufw allow 3306
ufw reload

rm -rf /usr/share/zabbix/conf/zabbix.conf.php
cp $rootDir/tweaks/extras/zabbix/zabbix.conf.php /usr/share/zabbix/conf/
sed -i "s/PASSWORDVAR/${ADMINPASSWORD}/g" /usr/share/zabbix/conf/zabbix.conf.php
unlink /etc/apache2/sites-enabled/default-ssl.conf
cp $rootDir/tweaks/extras/zabbix/zabbix.conf /etc/apache2/sites-available/
sed -i "s/CWMDOMAIN/${CWM_DOMAIN}/g" /etc/apache2/sites-available/zabbix.conf
ln -s /etc/apache2/sites-available/zabbix.conf /etc/apache2/sites-enabled/

echo "Extracting database content and Importing zabbix database" | log
while true; do
        echo "Testing"
        status=$(systemctl status mysql.service | grep "Active:" | awk -F' ' '{print $2}')
        if [ "${status,,}" == "active" ]; then
                echo "Active"
                break
        fi
        sleep 1
done

gunzip /usr/share/zabbix-sql-scripts/mysql/server.sql.gz 

mysql --defaults-file=/root/.my.cnf -h localhost <<EOF
set global log_bin_trust_function_creators = 0;
use zabbix;
source /usr/share/zabbix-sql-scripts/mysql/server.sql;
EOF

echo "Enabling and starting SQL and Zabbix" | log
systemctl enable mysql.service
sleep 1
systemctl restart mysql.service
waitOrStop 0 "Failed to start SQL"
systemctl enable zabbix-server
sleep 1
systemctl restart zabbix-server
waitOrStop 0 "Failed to restart Zabbix"
sleep 3
systemctl restart apache2
waitOrStop 0 "Failed to restart Apache"
sleep 3
systemctl restart php8.3-fpm
waitOrStop 0 "Failed to restart php8.3-fpm"
sleep 3

echo "Adding descriptions" | log
descriptionAppend " "
descriptionAppend "Database = zabbix"
descriptionAppend "DBUser = zabbixuser"
descriptionAppend "Zabbix Admin Web UI: http://${CWM_DOMAIN}/zabbix"
descriptionAppend "Zabbix default credentials: User=Admin | Pass=zabbix"
descriptionAppend " "


tagScript success

exit 0

Youez - 2016 - github.com/yon3zu
LinuXploit