# CentOS 6.8 安装 zabbix 3.2.1 #作者:老农民 #QQ: 46715422 #Email: flyingercn@wo.cn #微信: ericliu_77 yum -y install net-snmp-devel /usr/sbin/groupadd zabbix /usr/sbin/useradd -r -g zabbix -s /bin/false -M zabbix tar xf zabbix-3.2.1.tar.gz cd zabbix-3.2.1/ # MysqL CC="/usr/local/gcc6/bin/gcc" ./configure --prefix=/usr/local/zabbix --with-MysqL=/home/MysqL/bin/MysqL_config --enable-server --enable-proxy --enable-agent --with-net-snmp --with-libcurl --with-libxml2 # Psotgresql CC="/usr/local/gcc6/bin/gcc" ./configure --prefix=/usr/local/zabbix --with-postgresql=/home/pgsql/bin/pg_config --enable-server --enable-proxy --enable-agent --with-net-snmp --with-libcurl --with-libxml2 CC="/usr/local/gcc6/bin/gcc" make -j `grep processor /proc/cpuinfo | wc -l` CC="/usr/local/gcc6/bin/gcc" make install # MysqL /home/MysqL/bin/MysqL -hlocalhost -u root -proot -P3306 -A -e "create database zabbix default charset utf8;" /home/MysqL/bin/MysqL -hlocalhost -u root -proot -P3306 -A -e "grant all on zabbix.* to zabbix@'localhost' identified by 'zabbix' with grant option;" /home/MysqL/bin/MysqL -hlocalhost -u root -proot -P3306 -A -e "grant all on zabbix.* to zabbix@'127.0.0.1' identified by 'zabbix' with grant option;" /home/MysqL/bin/MysqL -hlocalhost -u zabbix -pzabbix -P3306 -A zabbix<./database/MysqL/schema.sql /home/MysqL/bin/MysqL -hlocalhost -u zabbix -pzabbix -P3306 -A zabbix<./database/MysqL/images.sql /home/MysqL/bin/MysqL -hlocalhost -u zabbix -pzabbix -P3306 -A zabbix<./database/MysqL/data.sql # Psotgresql su -l postgres -s /bin/bash -c "/home/pgsql/bin/createuser -h localhost -p 5432 -d -A -P -e zabbix" su -l postgres -s /bin/bash -c "/home/pgsql/bin/createdb zabbix -O zabbix -E UTF8" su -l postgres -s /bin/bash -c "/home/pgsql/bin/psql -h localhost -U zabbix -d zabbix -f /soft/zabbix-3.2.1/database/postgresql/schema.sql" su -l postgres -s /bin/bash -c "/home/pgsql/bin/psql -h localhost -U zabbix -d zabbix -f /soft/zabbix-3.2.1/database/postgresql/images.sql" su -l postgres -s /bin/bash -c "/home/pgsql/bin/psql -h localhost -U zabbix -d zabbix -f /soft/zabbix-3.2.1/database/postgresql/data.sql" mkdir /var/log/zabbix chown zabbix.zabbix /var/log/zabbix ln -s /usr/local/zabbix/etc/ /etc/zabbix ln -s /usr/local/zabbix/bin/* /usr/bin/ ln -s /usr/local/zabbix/sbin/* /usr/sbin/ cp ./misc/init.d/fedora/core/zabbix_* /etc/init.d chmod 755 /etc/init.d/zabbix_* sed -i "s@BASEDIR=/usr/local@BASEDIR=/usr/local/zabbix@g" /etc/init.d/zabbix_server sed -i "s@BASEDIR=/usr/local@BASEDIR=/usr/local/zabbix@g" /etc/init.d/zabbix_agentd sed -i "s@DBUser=root@DBUser=zabbix@g" /etc/zabbix/zabbix_server.conf sed -i "s@#DBPassword=@DBPassword=zabbix@g" /etc/zabbix/zabbix_server.conf sed -i "s@# DBPassword=@DBPassword=zabbix@g" /etc/zabbix/zabbix_server.conf # Psotgresql sed -i "s@# DBPort=3306@DBPort=5432@g" /etc/zabbix/zabbix_server.conf #修改/etc/zabbix/zabbix_agentd.conf,这里的IP地址写的是zabbix_server的IP地址,比如192.168.199.152 sed -i "s@Server=127.0.0.1@Server=127.0.0.1,192.168.199.152@g" /etc/zabbix/zabbix_agentd.conf sed -i "s@ServerActive=127.0.0.1@ServerActive=192.168.199.152:10051@g" /etc/zabbix/zabbix_agentd.conf sed -i "s@tmp/zabbix_agentd.log@var/log/zabbix/zabbix_agentd.log@g" /etc/zabbix/zabbix_agentd.conf sed -i "s@^# UnsafeUserParameters=0@UnsafeUserParameters=1\n@g" /etc/zabbix/zabbix_agentd.conf cp -r ./frontends/PHP/ /home/websys/zabbix/ chown -R www.www /home/websys/zabbix/ chkconfig zabbix_server on chkconfig zabbix_agentd on chkconfig --level 345 zabbix_server on chkconfig --level 345 zabbix_agentd on service zabbix_server start service zabbix_agentd start vi /usr/local/Nginx/conf/vhost/zabbix.conf server { listen 80; server_name zabbix.test.net; root /home/websys/zabbix; index index.html index.htm index.PHP; location /Nginx_status { stub_status on; allow 127.0.0.1; deny all; } location ~ [^/]\.PHP(/|$) { fastcgi_pass unix:/dev/shm/PHP7-cgi.sock; fastcgi_index index.PHP; include ./fastcgi.conf; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ { expires 30d; } location ~ .*\.(js|css)?$ { expires 7d; } } access_log /home/logs/Nginx/zabbix.log main; #输入以下地址安装,安装完后,用户名是 Admin ,密码是:zabbix http://zabbix.test.net/setup.PHP #如果不支持中文,开启中文支持 vi /home/websys/zabbix/include/locales.inc.PHP #修改 'zh_CN' => ['name' => _('Chinese (zh_CN)'),'display' => false],'zh_CN' => ['name' => _('Chinese (zh_CN)'),'display' => true],# 解决图形分析中的中文乱码问题 # 将windows 字体 simkai.ttf 复制到 zabbix/fonts vi /home/websys/zabbix/include/defines.inc.PHP //define('ZBX_GRAPH_FONT_NAME','DejaVuSans'); // font file name define('ZBX_GRAPH_FONT_NAME','simkai'); //define('ZBX_FONT_NAME','DejaVuSans'); define('ZBX_FONT_NAME','simkai');
要买正宗新疆特产,微信扫下面二维码,加老农民咨询购买:
原文链接:https://www.f2er.com/centos/379609.html