zabbix4.0安装

系统:centos 7
1,源码包下载
wget https://cdn.zabbix.com/stable/4.0.19/zabbix-4.0.19.tar.gz
2, 解压
tar -xf zabbix-4.0.19.tar.gz
3,安装依赖包
yum install -y libevent-devel wget tar gcc gcc-c++ make net-snmp-devel libxml2-devel libcurl-devel mysql-devel unixODBC-devel fping net-snmp-devel unixODBC-devel openssl-devel OpenIPMI-devel java-devel java-1.8.0-openjdk-devel openldap openldap-devel libssh2-devel
4,安装
./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --enable-java --with-mysql --with-libxml2 --with-unixodbc --with-net-snmp --with-ssh2 --with-openipmi --with-libcurl --with-iconv --with-ldap
make && make install
/usr/local/zabbix/sbin/zabbix_server -V ##查看一下没有报错安装成功

5,mysql 安装 zabbix数据库创建
yum install mariadb-server
systemctl start mariadb
初始化数据库 ; mysql_secure_installation (输入n y n y y)
创建zabbix数据库
mysql -uroot -p (直接回车)
create database zabbix character set utf8 collate utf8_bin;
grant all privileges on zabbix.* to zabbix@localhost identified by ‘zabbix’;
flush privileges;

导入zabbix表结构
mysql -uzabbix -pzabbix zabbix < /root/zabbix-4.0.19/database/mysql/schema.sql
mysql -uzabbix -pzabbix zabbix < /root/zabbix-4.0.19/database/mysql/images.sql
mysql -uzabbix -pzabbix zabbix < /root/zabbix-4.0.19/database/mysql/data.sql

6,zabbix-server配置文件修改
[root@localhost zabbix]# cat /usr/local/zabbix/etc/zabbix_server.conf | egrep -v ‘^#’ | egrep -v “^$”
LogFile=/tmp/zabbix_server.log
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
Timeout=4
LogSlowQueries=3000

7.创建组和用户
groupadd --system zabbix
useradd --system -g zabbix -s /sbin/nologin -c “Zabbix” zabbix

8,启动zabbix-server zabbix-agent
/usr/local/zabbix/sbin/zabbix_server -c /usr/local/zabbix/etc/zabbix_server.conf
/usr/local/zabbix/sbin/zabbix_agentd -c /usr/local/zabbix/etc/zabbix_agentd.conf

9,zabbix 前端安装
yum源安装 参考:https://www.cnblogs.com/caidingyu/p/11423089.html
yum install zabbix-web-mysql
配置前端页面
vim /etc/php.ini (改动参数)
cat /etc/php.ini | egrep "max_execution_time|memory_limit|post_max_size|upload_max_filesize|^max_input_time|max_input_vars|always_populate_raw_post_data|date.timezone "
max_execution_time = 300
max_input_time = 300
max_input_vars = 10000
memory_limit = 128M
post_max_size = 16M
always_populate_raw_post_data = -1
upload_max_filesize = 2M
date.timezone = “Asia/Shanghai”
启动web服务
systemctl status httpd

10,页面输入:http://192.168.30.130/zabbix (自己服务器ip)
注意:数据库密码(自己设置的) name (agent 配置文件 Hostname 一致 )
默认登录名Admin 密码zabbix

docker 安装 zabbix
1,docker 安装
yum install docker-latest
systemctl start docker-latest

vim /etc/docker/daemon.json ##配置仓库
{
“registry-mirrors”: [“https://bmh6nx75.mirror.aliyuncs.com”]
}

docker run --name mysql-server -t -e MYSQL_DATABASE=“zabbix” -e MYSQL_USER=“zabbix” -e MYSQL_PASSWORD=“zabbix” -e MYSQL_ROOT_PASSWORD=“zabbix” -d mysql:5.7 --character-set-server=utf8 --collation-server=utf8_bin

docker run --name zabbix-java-gateway -t -d zabbix/zabbix-java-gateway:latest

docker run --name zabbix-server-mysql -t -e DB_SERVER_HOST=“mysql-server” -e NYSQL_DATABASE=“zabbix” -e MYSQL_USER=“zabbix” -e MYSQL_PASSWORD=“zabbix” -e MYSQL_ROOT_PASSWORD=“zabbix” -e ZBX_JAVAGATEWAY=“zabbix-java-gateway” --link mysql-server:mysql --link zabbix-java-gateway:zabbix-java-gateway -p 10051:10051 -d zabbix/zabbix-server-mysql:latest

docker run --name zabbix-web-nginx-mysql -t -e DB_SERVER_HOST=“mysql-server” -e MYSQL_DATABASE=“zabbix” -e MYSQL_USER=“zabbix” -e MYSQL_PASSWORD=“zabbix” -e MYSQL_ROOT_PASSWORD=“zabbix” --link mysql-server:mysql --link zabbix-server-mysql:zabbix-server -p 80:80 -d zabbix/zabbix-web-nginx-mysql:latest

docker run --name zabbix-agent -e ZBX_HOSTNAME=“Zabbix server” -e ZBX_SERVER_HOST=“zabbix-server-mysql” --link zabbix-server-mysql:zabbix-server -d zabbix/zabbix-agent:latest

你可能感兴趣的:(zabbix4.0安装)