首页 > zabbix > 正文

ZABBIX3.4+CENTOS6.8+Mysql5.6监视服务器安装


zabbix3.4原生支持Centos7,
在Centos6上面安装对依赖包的版本有要求
实际安装时遇到很多坑,总结记录一下 Centos6安装选择basic server

apache部分

yum install httpd

在我的机器上zabbixweb模块不是安装到默认的/var/www下,
而是跑到了/usr/share/zabbix下。 /etc/httpd/conf/http.conf修改

DocumentRoot "/usr/share/zabbix"
<Directory "/usr/share/zabbix">

PHP部分

PHP5.6依赖包安装

rpm -Uvh http://ftp.iij.ad.jp/pub/linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
yum install --enablerepo=remi --enablerepo=remi-php56 php php-opcache php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof php-bcmath php-gd php-ldap

/etc/php.ini参数修改

max_execution_time = 300
memory_limit = 128M
post_max_size = 16M
upload_max_filesize = 2M
max_input_time = 300
date.timezone = Asia/Shanghai
always_populate_raw_post_data = -1

mysql部分

rpm -ivh https://dev.mysql.com/get/mysql57-community-release-el6-11.noarch.rpm
yum install --enablerepo=mysql56-community --disablerepo=mysql80-community mysql-server

编辑参数(8G内存)

vi /etc/my.cnf
innodb_file_per_table = 1
innodb_status_file = 1
innodb_buffer_pool_size = 6G
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 16M
innodb_log_file_size = 64M
innodb_support_xa = 0
default-storage-engine = innodb
bulk_insert_buffer_size = 8M
join_buffer_size = 16M
max_heap_table_size = 32M
tmp_table_size = 32M
max_tmp_tables = 48
read_buffer_size = 32M
read_rnd_buffer_size = 16M
key_buffer_size = 32M
thread_cache_size = 32
innodb_thread_concurrency = 8
innodb_flush_method = O_DIRECT
innodb_rollback_on_timeout = 1
query_cache_size = 16M
query_cache_limit = 16M
collation_server = utf8_bin
character_set_server = utf8

启动mysql

service mysqld start 

创建数据库和用户

mysql> create database zabbix default charset utf8;
mysql> grant all privileges on zabbix.* to zabbix@'localhost' identified by 'zabbix';
mysql> flush privileges;

zabbix部分

rpm -i http://repo.zabbix.com/zabbix/3.4/rhel/6/x86_64/zabbix-release-3.4-1.el6.noarch.rpm
yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-get zabbix-send

zabbix数据库模板导入mysql

zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix

编辑配置文件

DBPassword=zabbix
CacheSize=512M
HistoryCacheSize=128M
HistoryIndexCacheSize=128M
TrendCacheSize=128M
ValueCacheSize=256M
Timeout=30
StartVMwareCollectors=2
VMwareCacheSize=256M
VMwareTimeout=300

开启进程

service httpd start
service zabbix-server start
service zabbix-agentd start
chkconfig httpd on
chkconfig zabbix-server on
chkconfig zabbix-agentd on

原创文章,转载请注明出处!
本文链接:https://justbio.github.io//posts/zabbix3.4-centos6.html
上篇: 更新微信报警,邮件报警脚本
下篇: ZABBIX3.4+CENTOS7.4+Mysql5.6监视服务器安装