Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

One-click compilation and installation of zabbix3.2.5server

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The company plans to use zabbix to monitor all product servers, and now needs to test zabbix!

The system adopts minimal installation, and the selected packages are as follows:

BaseCompatibility librariesDebugging ToolsDevelopment tools

The system information is as follows:

# cat / etc/redhat-release CentOS release 6.8 (Final) # uname-r2.6.32-642.el6.x86_64# uname-mx86_64

The company's products are basically tomcat environment, and zabbix server compilation and installation requires-- with-java parameter. The jdk environment is built as follows:

Mkdir / server/toolsmkdir / application#download link tar xf jdk-8u131-linux-x64.tar.gzmv jdk1.8.0_131/ application/ln-s / application/jdk1.8.0_131/ / application/jdkchown-R root.root / application/jdkvim / etc/profileexport JAVA_HOME=/application/jdkexport JRE_HOME=/application/jdk/jreexport PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATHexport CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/libsource / etc/profile

The basic installation script is as follows: (note: the script lacks some judgment statements)

#! / bin/bash# modify yum source Use Ali Cloud Source function mod_yum () {if [- e / etc/yum.repos.d/CentOS-Base.repo] then mv / etc/yum.repos.d/CentOS-Base.repo / etc/yum.repos.d/CentOS-Base.repo.backup&&\ wget-O / etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/CentOS-6.repo wget-O / etc/yum.repos .d / epel.repo http://mirrors.aliyun.com/repo/epel-6.repo fi} # mysql uses 5.6.36 (zabbix3.2.5 requires mysql5.4 or above) function install_mysql () {useradd-s / sbin/nologin-M mysql wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz tar xf mysql-5.6.36 -linux-glibc2.5-x86_64.tar.gz mv mysql-5.6.36-linux-glibc2.5-x86_64 / application/mysql-5.6.36 ln-s / application/mysql-5.6.36/ / application/mysql chown-R mysql.mysql / application/mysql/ cd / application/mysql/ rm-f / etc/my.cnf cp support-files/my-default.cnf / etc/my.cnf. / scripts/mysql_ Install_db-- basedir=/application/mysql/-- datadir=/application/mysql/data/-- user=mysql sed-I's install apache install_db-- etc/profile cd-- server/tools/ mysqladmin-uroot password 123456} # install apache Version 2.2.32function install_httpd () {cd / server/tools useradd-s / sbin/nologin-M www wget http://mirrors.hust.edu.cn/apache//httpd/httpd-2.2.32.tar.gz tar xf httpd-2.2.32.tar.gz cd httpd-2.2.32 yum install zlib zlib-devel-y. / configure-- prefix=/application/apache2.2.32-- enable-deflate-- enable-expires -- enable-headers-- enable-modules=most-- enable-so-- with-mpm=worker-- enable-rewrite make make install ln-s / application/apache2.2.32/ / application/apache sed-I 's#User daemon#User www#g' / application/apache/conf/httpd.conf sed-I' s#Group daemon#Group www#g' / application/apache/conf/httpd.conf cd / server/tools} # install php dependency package function pre_install_php () {wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz tar xf libiconv-1.14.tar.gz cd libiconv-1.14. / configure-- prefix=/usr/loca/libiconv make make install yum-y install zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel yum-y install freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel yum-y install libmcrypt-devel Yum-y install mhash yum-y install mcrypt yum-y install openssl openssl-devel ln-s / application/mysql/lib/libmysqlclient.so.18 / usr/lib/libmysqlclient.so.18 ln-s / application/mysql/lib/libmysqlclient.so.18 / usr/lib64/libmysqlclient.so.18 chmod 755 / usr/lib64/libmysqlclient.so.18 chmod 755 / usr/lib/libmysqlclient.so.18 ldconfig} # install php Version 5.5.32function install_php () {cd / server/tools wget http://mirrors.sohu.com/php/php-5.5.32.tar.gz tar xf php-5.5.32.tar.gz cd php-5.5.32./configure\-- prefix=/application/php5.5.32\-- with-mysql=/application/mysql\-- with-mysqli=/application/mysql/bin/mysql_config\-- with-apxs2=/application/apache / bin/apxs\-- with-pdo-mysql=mysqlnd\-- with-iconv-dir=/usr/local/libiconv\-- with-freetype-dir\-- with-jpeg-dir\-- with-png-dir\-- with-zlib\-- with-libxml-dir=/usr\-- enable-xml\-- disable-rpath\-- with-gettext\-- enable-bcmath\-- enable-shmop\-enable-sysvsem\-enable-inline-optimization\-- with-curl\-- enable -mbregex\-- enable-fpm\-- enable-mbstring\-- with-mcrypt\-- with-gd\-- enable-gd-native-ttf\-- with-openssl\-- with-mhash\-- enable-pcntl\-- enable-sockets\-- with-xmlrpc\-- enable-soap\-enable-short-tags\-enable-static\-- with-xsl\-- with-fpm-user=www\-- with-fpm-group=www\-- enable-ftp\-- enable-opcache=no Make make install ln-s / application/php5.5.32 / application/php cp php.ini-production / application/php/lib/php.ini} # modify the httpd.conf file of apache Make apache support php Adopt php module mode function after_php () {sed-I '320i AddType application/x-httpd-php .php. Phtml\ nAddType application/x-httpd-php-source .phps' / application/apache/conf/httpd.conf sed-I 's#DirectoryIndex index.html#DirectoryIndex index.php index.html#g' / application/apache/conf/httpd.conf sed-I' s/#ServerName www.example.com:80/ServerName *: 80amp g'/ application/apache / conf/httpd.conf / application/apache/bin/apachectl start} # install zabbix dependency package # if you don't want to install agent Can be removed-- enable-agent# if you do not need to monitor the device hardware You can remove-- with-openipmifunction pre_install_zabbix_server () {cd / server/tools wget https://fossies.org/linux/misc/zabbix-3.2.5.tar.gz tar-xf zabbix-3.2.5.tar.gz cd zabbix-3.2.5 yum-y install curl libcurl-devel net-snmp net-snmp-devel perl-DBI libdbi-dbd-mysql mysql-devel gcc gcc++ make libxml2 libxml2-devel yum-y install libssh3-devel.x86 _ 64 yum-y install OpenIPMI yum-y install OpenIPMI-devel useradd-s / sbin/nologin-M zabbix mysql-uroot-p123456-e "create database zabbix DEFAULT CHARACTER SET UTF8 COLLATE utf8_general_ci "mysql-uroot-p123456-e" grant all on zabbix.* to zabbix@'localhost' identified by 'zabbix'; "mysql-uroot-p123456-e" flush privileges; "mysql-uzabbix-pzabbix zabbix

< database/mysql/schema.sql mysql -uzabbix -pzabbix zabbix < database/mysql/p_w_picpaths.sql mysql -uzabbix -pzabbix zabbix < database/mysql/data.sql }#安装zabbixfunction install_zabbix(){./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --enable-java --with-mysql --with-libxml2 --with-net-snmp --with-ssh3 --with-openipmi --with-libcurl makemake installcp -R frontends/php /application/apache/htdocs/chown -R www.www /application/apache/htdocs/phpcp -a misc/init.d/fedora/core/zabbix_server /etc/init.d/zabbix_serversed -i 's#/usr/local#/usr/local/zabbix#g' /etc/init.d/zabbix_server mkdir /var/log/zabbixchown -R zabbix.zabbix /var/log/zabbixsed -i 's#LogFile=/tmp/zabbix_server.log#LogFile=/var/log/zabbix/zabbix_server.log#g'sed -i 's/# DBHost=localhost/DBHost=localhost/g' /usr/local/zabbix/etc/zabbix_server.confsed -i 's/# DBPassword=/DBPassword=zabbix/g' /usr/local/zabbix/etc/zabbix_server.conf/etc/init.d/zabbix_server start sed -i 's#max_execution_time = 30#max_execution_time = 300#g' /application/php/lib/php.ini sed -i 's#max_input_time = 60#max_input_time = 300#g' /application/php/lib/php.ini sed -i 's#post_max_size = 8M#post_max_size = 16M#g' /application/php/lib/php.ini sed -i 's#;date.timezone =#date.timezone = Asia/Shanghai#g' /application/php/lib/php.ini cat >

> / application/apache/conf/httpd.conf

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report