In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
In order to facilitate the process of installing Zabbix into automated one-click deployment scripts, if you are interested, you can refer to these basic commands:
#! / bin/bash#Zabbix one-click deployment script # install zabbix3.0.4, relying on php-5.6.25src_home= `pwd`echo-n "configuring iptables Firewall …" / etc/init.d/iptables save > > / dev/nullchkconfig iptables offif [$?-eq 0]; thenecho-n "Iptables Firewall initialization complete!" Fiecho-n "shutting down SELinux..." Setenforce 0 > / dev/null 2 > & 1sed-I'/ ^ SELINUX=/s/=.*/=disabled/' / etc/selinux/configif [$?-eq 0]; then echo-n "SELinux initialization complete!" Fiecho-n "installing nginx yum source..." Yum-y install wgetwget http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpmrpm-ivh nginx-release-centos-6-0.el6.ngx.noarch.rpmif [$?-eq 0]; then echo-n "Nginx yum source initialization complete!" Fiecho-n "installing epel-release yum source..." Rpm-Uvh http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpmrpm-Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpmif [$?-eq 0]; then echo-n "epel-release yum source initialization complete!" Fiecho-n "installing the relevant software needed for compiling php-5.6.25." Yum-y install make gcc nginx libmcrypt php-mcrypt mysql-server mysql-devel net-snmp-devel libcurl-devel php php-mysql php-bcmath php-mbstring php-gd php-xml bzip2-devel libmcrypt-devel libxml2-devel gd gd-devel libcurl*if [$?-eq 0]; then echo-n "php-5.6.25 dependency initialization complete!" Fiecho-n "adding zabbix users …" Useradd-M-s / sbin/nologin zabbix & & echo "OK" echo-n "is starting the mysqld service." Service mysqld startif [$?-eq 0]; then echo-n "Mysql startup is complete!" Fi#echo-n "setting password for root users of mysql..." # mysql_user_root_password= "password" # mysql_user_zabbix_password= "zabbix" # mysqladmin-uroot-p password $mysql_user_root_passwordecho "is executing the mysql statement, creating the zabbix database and authorizing zabbix to access the database" mysql-e "create database zabbix character set utf8;grant all privileges on zabbix.* to zabbix@'%' identified by 'zabbix';grant all privileges on zabbix.* to zabbix@'127.0.0.1' identified by' zabbix' Grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';flush privileges "# echo" is executing the mysql statement to create the zabbix database Authorize zabbix to access database "# mysql-uroot-p" $mysql_user_root_password "- e" create database zabbix character set utf8 "& & echo" create zabbix database complete "# mysql-uroot-p" $mysql_user_root_password "- e" grant all privileges on zabbix.* to zabbix@localhost identified by'$mysql_user_zabbix_password' "& & echo" authorize zabbix local login database "# mysql-uroot-p" $mysql_user_root_ Password "- e" grant all privileges on zabbix.* to zabbix@'%' identified by'$mysql_user_zabbix_password' "& & echo" authorizes any host to log in locally to the database "# zabbix one-click deployment of the unzipped directory echo-n of third-party software packages compiles and installs php-5.6.25.... It may take a few minutes "tar zxf ${src_home} / php-5.6.25.tar.gzcd ${src_home} / php-5.6.25 & &. / configure-- prefix=/usr/local/php-- with-config-file-path=/etc-- enable-fpm-- with-libxml-dir-- with-gd-- with-jpeg-dir-- with-png-dir-- with-freetype-dir-- with-iconv-dir-- with-zlib- Dir-- with-mcrypt-- enable-soap-- enable-gd-native-ttf-- enable-mbstring-- enable-exif-- with-pear-- with-curl-- enable-bcmath-- with-gettext-- with-mysqli-- enable-socketscd ${src_home} / php-5.6.25 & & make-j 4 & & make installcdecho-n "is configuring startup php-fpm.... Please wait a moment "/ bin/cp ${src_home} / php-5.6.25/php.ini-production / etc/php.inicp ${src_home} / php-5.6.25/sapi/fpm/init.d.php-fpm / etc/init.d/php-fpmchmod 777 / etc/init.d/php-fpmcd / usr/local/php/etc/ & & cp php-fpm.conf.default php-fpm.confcdservice php-fpm startif [$?-eq 0] Then echo-n "php-fpm start complete!" Fi#zabbix compilation installation echo-n "importing zabbix data into mysql database." tar zxf ${src_home} / zabbix-3.0.4.tar.gzmysql-uzabbix-pzabbix zabbix
< ${src_homie}/zabbix-3.0.4/database/mysql/schema.sqlmysql -uzabbix -pzabbix zabbix < ${src_homie}/zabbix-3.0.4/database/mysql/p_w_picpaths.sqlmysql -uzabbix -pzabbix zabbix < ${src_homie}/zabbix-3.0.4/database/mysql/data.sqlif [ $? -eq 0 ];then echo -n "zabbix数据导入启动完毕!"fiecho -n "正在安装zabbix编译依赖软件包....可能需要几分钟"yum -y install net-snmp-devel curl-devel javacc java-1.8*echo -n "编译安装Zabbix-server....可能需要几分钟"cd ${src_home}/zabbix-3.0.4 && ./configure --prefix=/usr/local/zabbix --enable-server --enable-proxy --enable-agent --with-net-snmp --with-libcurl --enable-java --with-mysqlmake -j 4 && make installecho -n "正在制作Zabbix-server启动脚本...."echo -e "zabbix-agent 10050/tcp #ZabbixAgent\nzabbix-agent 10050/udp #Zabbix Agent\nzabbix-trapper 10051/tcp #ZabbixTrapper\nzabbix-trapper 10051/udp #Zabbix Trapper" >> / etc/servicescp ${src_home} / zabbix-3.0.4/misc/init.d/fedora/core/zabbix_server / etc/init.d/cp ${src_home} / zabbix-3.0.4/misc/init.d/fedora/core/zabbix_agentd / etc/init.d/cdchmod 777 / etc/init.d/zabbix_*sed-I'/ BASEDIR=/s/$/\ / zabbix/' / etc/init.d/zabbix_serversed-I'/ BASEDIR= / zabbix/' / etc/init.d/zabbix_agentdecho-n "configuring zabbix profile...." cd / usr/local/zabbix/etcsed'/ # DBHost=localhost/a\ DBHost=localhost' zabbix_server.conf-ised'/ # DBPassword=/a\ DBPassword=zabbix' zabbix_server.conf-ised'/ # EnableRemoteCommands=0/a\ EnableRemoteCommands=1' zabbix_agentd.conf-ised'/ # ListenPort=10050/a\ ListenPort=10050' zabbix_agentd.conf-ised'/ # User=zabbix/a\ User=zabbix' Zabbix_agentd.conf-ised'/ # AllowRoot=0/a\ AllowRoot=1' zabbix_agentd.conf-ised'/ # UnsafeUserParameters=0/a\ UnsafeUserParameters=1' zabbix_agentd.conf-iif [$?-eq 0] Then echo-n "zabbix configuration is complete!" Fiecho-n "starting zabbix_server and zabbix_agent...." service zabbix_server startservice zabbix_agentd startchkconfig zabbix_server onchkconfig zabbix_agentd oncdecho-n "configuring nginx reverse zabbix...." cp-r ${src_home} / zabbix-3.0.4/frontends/php / usr/share/nginx/html/zabbixcd / etc/nginx/conf.d/ & & mv default.conf default.conf.bakcp ${src_home} / zabbix.conf / etc/nginx/ Conf.d/echo-n "configuration complete Starting nginx web server.... "service nginx startif [$?-eq 0] Then echo-n "Nginx start complete!" Fiecho-n "final modification of zabbix Install, php parameters is in progress." sed'/ ^ post_max_size = / etc/php.ini ised. Max_execution_time = 16m etc/php.ini'/ etc/php.ini-ised'/ ^ max_execution_time = / s ised. Date.timezone/a\ date.timezone = Asia/Shanghai' / etc/php.inised-I'/ ^ Always_populate_raw_post_data.*/a\ always_populate_raw_post_data =-1'/ etc/php.inised-I'/ ^ mysqli.default_socket = / splash. Mysql =\ / var\ / lib\ / mysql\ / mysql.sock/' / etc/php.iniecho-n "restarting the php service." / etc/init.d/php-fpm restartecho-n "initializing zabbix Server...." cp ${src_home} / zabbix.conf.php / usr/share/nginx/html/zabbix/conf/echo-n "is doing the final Zabbix Server restart." / etc/init.d/zabbix_server restartif [$?-eq 0] Then echo-n "Zabbix Server start complete!" Fiecho-n "is solving the zabbix server garbled problem, please wait patiently." cd / usr/share/nginx/html/zabbix/fonts & & mv DejaVuSans.ttf DejaVuSans.ttf.bakcp ${src_home} / msyh.ttf .cd. / include/ & & sed-I's Universe defines.inc.phpcdecho-n "Congratulations, Zabbix deployment completed here, if there is any problem, please refer to the script to solve it alone!" Echo-e-n "follow-up operations: 1. Visit your zabbix Web page through http://ip/zabbix. Next step. All the way to the end. 2. You may need to configure the Nginx domain name, access Zabbix Server.... 3 through the domain name, customize or use the system's own template, add hosts, etc."
When the script is finished, type: http://172.16.2.21/zabbix/ in your browser should see the following page:
I have already packed the tar package with one click, please download it from the attachment:
Connection: http://pan.baidu.com/s/1nuTaX2D password: yckv
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.