Detailed installation tutorial of zabbix 4.04 (based on CentOS 7.6)

Detailed installation tutorial of zabbix 4.04 (based on CentOS 7.6)

1. Preparation before installation:

1.1 Install JDK

Uninstall openjdk

# rpm -qa | grep java
# yum remove java-1.8.0-openjdk
# yum remove java-1.8.0-openjdk-headless

Install JDK Package

# rpm -ivh jdk-8u191-linux-x64.rpm

1.2 Install dependency packages

# yum install -y net-snmp net-snmp-devel OpenIPMI-devel libssh2-devel openldap-devel openldap-clients libxml2-devel libcurl-devel gcc msyql-devel libevent-devel php-mysql php-gd php-mbstring php-bcmath libjpeg-devel freetype-devel libpng-devel php-xml keyutils-libs-devel krb5-devel libcom_err-devel libkadm5 libselinux-devel libsepol-devel openssl-devel pcre-devel zlib-devel

The following three packages are not included in DVD1. If you configure a local yum source, you need to install them separately.

# yum install -y libevent-devel-2.0.21-4.el7.x86_64.rpm
# yum install -y libssh2-devel-1.4.3-12.el7.x86_64.rpm
# yum install -y OpenIPMI-devel-2.0.23-2.el7.x86_64.rpm

After installing the dependency packages, you can use the following command to check whether they are all installed successfully

# rpm -qa net-snmp net-snmp-devel OpenIPMI-devel libssh2-devel openldap-devel openldap-clients libxml2-devel libcurl-devel gcc msyql-devel libevent-devel php-mysql php-gd php-mbstring php-bcmath libjpeg-devel freetype-devel libpng-devel php-xml keyutils-libs-devel krb5-devel libcom_err-devel libkadm5 libselinux-devel libsepol-devel openssl-devel pcre-devel zlib-devel

1.3 Install MySQL

See the MySQL installation documentation for details.

1.4 Install nginx

# tar -zxvf nginx-1.14.0.tar.gz -C /home
# cd /home/nginx-1.14.0/
# ./configure 
# make & make install

1.5 Install PHP

# yum install -y php
# yum install -y php-fpm-5.4.16-46.el7.x86_64.rpm

2 Installation Service:

2.1 Compile and install zabbix

# groupadd --system zabbix
# useradd --system -g zabbix -d /usr/lib/zabbix -s /sbin/nologin zabbix
# tar -zxvf zabbix-4.0.4.tar.gz -C /home
# cd /home/zabbix-4.0.4/
# ./configure --prefix=/usr/local/zabbix/ --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2 --with-ldap --with-ssh2 --with-openipmi --enable-java --with-openssl
# make install

2.2 Create a database

# mysql -uroot -p<password>
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@"serverip" identified by '<password>';
mysql> quit
# cd /home/zabbix-4.0.4/database/mysql
# mysql -uzabbix -p<password> zabbix < schema.sql
# mysql -uzabbix -p<password> zabbix < images.sql
# mysql -uzabbix -p<password> zabbix < data.sql

2.3 Modify configuration

# vim /usr/local/zabbix/etc/zabbix_server.conf
DBPassword=<password>

2.4 Start the service

# /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 
# /usr/local/zabbix/sbin/zabbix_java/startup.sh

Note: /usr/local/zabbix/sbin/zabbix_server: error while loading shared libraries: libmysqlclient.so.20: cannot open shared object file: No such file or directory

Solution for reporting the above error:

# find / -name libmysqlclient.so.20
/home/mysql/lib/libmysqlclient.so.20
# echo "/home/mysql/lib" >> /etc/ld.so.conf
#ldconfig

Then restart the service

3 Install the front end:

3.1 Configure nginx

# vim /usr/local/nginx/conf/nginx.conf
server { 
    listen 80; 
    server_name localhost; 
    proxy_buffer_size 128k; 
    proxy_buffers 32 32k; 
    client_header_buffer_size 64k; 
    large_client_header_buffers 8 128k; 
    access_log /usr/local/nginx/logs/zabbix.access.log main; 
    error_log /usr/local/nginx/logs/zabbix.error.log error; 
    location / { 
      root html; 
      index index.php index.htm; 
    } 
    error_page 500 502 503 504 /50x.html; 
    location = /50x.html { 
      root html; 
    } 
    location ~ \.php$ { 
      fastcgi_buffer_size 128k; 
      fastcgi_buffers 32 32k; 
      fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; 
      fastcgi_index index.php; 
      fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; 
      include fastcgi_params; 
      include fastcgi.conf; 
    } 
}

Note: Remove the comment of log_format above

3.2 Configure PHP

# vim /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
# vim /etc/php-fpm.d/www.conf
[www] 
listen = 127.0.0.1:9000 
listen = /var/run/php-fpm/php-fpm.sock 
listen.mode = 0666 
user = nobody 
group = nobody 
pm = dynamic 
pm.max_children = 50 
pm.start_servers = 5 
pm.min_spare_servers = 5 
pm.max_spare_servers = 35

3.3 Copy static files

# rm -rf /usr/local/nginx/html/*
# cp -rf /home/zabbix-4.0.4/frontends/php/* /usr/local/nginx/html/
# chown -R nobody.nobody /usr/local/nginx/html

3.4 Configure the front end

Access the web address of the deployed service

Check dependencies and install any missing modules. Find the corresponding rpm package in DVD2 and install it, restart php-fpm (kill -USR2 php-fpm:master's pid)

Configuring the database

Configuring the Server

Complete the installation.

Default username: Admin, password: zabbix

Summarize

The above is the detailed installation documentation tutorial of Zabbix 4.04 (based on CentOS 7.6) introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!
If you find this article helpful, please feel free to reprint it and please indicate the source. Thank you!

You may also be interested in:
  • Super detailed steps to install zabbix3.0 on centos7
  • Installation and deployment of Zabbix based on Docker
  • Detailed explanation of Centos7.2 compilation and installation of zabbix3.2 (detailed steps)
  • Detailed installation steps of Zabbix3.4 under Centos 7
  • Detailed explanation of the whole process of installation and deployment of zabbix v3.0
  • Detailed tutorial on installing Zabbix 3.2 on CentOS 7.2
  • Install and configure Zabbix Agentd on Windows

<<:  Small program to implement a simple calculator

>>:  MySQL index coverage example analysis

Recommend

Zen coding resource update function enhancement

Official website: http://code.google.com/p/zen-cod...

Detailed steps to install Nginx on Linux

1. Nginx installation steps 1.1 Official website ...

Fixed table width table-layout: fixed

In order to make the table fill the screen (the re...

JS implements jQuery's append function

Table of contents Show Me The Code Test the effec...

Example of how to quickly build a Redis cluster with Docker

What is Redis Cluster Redis cluster is a distribu...

In-depth understanding of Vue transition and animation

1. When inserting, updating, or removing DOM elem...

mysql5.7.17 installation and configuration example on win2008R2 64-bit system

123WORDPRESS.COM has explained to you the install...

Use of MySQL DATE_FORMAT function

Suppose Taobao encourages people to shop during D...

MYSQL local installation and problem solving

Preface This article is quite detailed and even a...

Detailed steps for Python script self-start and scheduled start under Linux

1. Python automatically runs at startup Suppose t...

Example analysis of mysql stored procedure usage

This article describes the usage of MySQL stored ...

How to use Node.js to determine whether a png image has transparent pixels

background PNG images take up more storage space ...