一键编译安装zabbix3.2.5server
发表于:2025-01-21 作者:千家信息网编辑
千家信息网最后更新 2025年01月21日,公司计划使用zabbix监控所有产品服务器,现需要对zabbix进行测试!系统采用最小化安装,选包如下:BaseCompatibility librariesDebugging ToolsDevelo
千家信息网最后更新 2025年01月21日一键编译安装zabbix3.2.5server
公司计划使用zabbix监控所有产品服务器,现需要对zabbix进行测试!
系统采用最小化安装,选包如下:
BaseCompatibility librariesDebugging ToolsDevelopment tools
系统信息如下:
# cat /etc/redhat-release CentOS release 6.8 (Final)# uname -r2.6.32-642.el6.x86_64# uname -mx86_64
公司产品基本是tomcat环境,zabbix server编译安装需要--with-java参数,jdk环境搭建如下:
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
基本安装脚本如下:(注:脚本缺少一些判断语句)
#!/bin/bash#修改yum源,采用阿里云源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采用5.6.36(zabbix3.2.5需要mysql5.4以上版本)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#/usr/local/mysql#/application/mysql#g' /application/mysql/bin/mysqld_safe /application/mysql/bin/mysqld_safe & echo 'PATH=/application/mysql/bin:$PATH'>> /etc/profile source /etc/profile cd /server/tools/ mysqladmin -uroot password 123456}
#安装apache,版本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}
#安装php依赖包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}
#安装php,版本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}
#修改apache的httpd.conf文件,使apache支持php,采用php模块方式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 *:80/g' /application/apache/conf/httpd.conf /application/apache/bin/apachectl start}
#安装zabbix依赖包#如果不要安装agent,可以去掉--enable-agent#如果不需要监控设备硬件,可以去掉--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 <Options FollowSymLinks AllowOverride None Order allow,deny Allow from allEOF/application/apache/bin/apachectl graceful }
function main(){ mod_yum install_mysql install_httpd pre_install_php install_php after_php pre_install_zabbix_server install_zabbix}main
版本
产品
公司
环境
系统
脚本
监控
编译
最小
信息
参数
文件
方式
服务器
模块
监控设备
硬件
设备
语句
阿里
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
网络技术的专业问题
优质网络安全在线课程免费
旅游指南软件开发
修改数据库锁
一年级网络安全手抄报内容句子
广西轩通互联网科技
兰州西部网络安全
x58双路服务器开机线是哪个
电子商务数据库系统
网络安全学习日记
魔兽世界大服务器和跨服区别
中国互联网巨头冲刺高科技
软件开发转原因测试
数据库访问技术可以学吗
可跨库检索数据库
java访问数据库的技术是
各地网络安全政策落实情况
怀旧服可以在服务器里升级吗
黑屏无法连接服务器
网络安全sec系统
数据库不同实体根据什么区分
管家婆用的哪个服务器
优质网络安全在线课程免费
网络安全法网络是
sql数据库改字段值
软件开发培训免费
江苏互联网科技大会
高速公路网络安全计划
市委网络安全宣传周活动方案
软件开发师挂靠