zabbix4.2 server installation

Keywords: Zabbix MySQL PHP Nginx

As for the installation of zabbix server 4.2, in fact, the official website has written a lot of details. I'll take notes here and make some additions by the way.

zabbix official website address: https://www.zabbix.com/download

The system environment I use here is CentOS 6.9. mysql, php and nginx are pre installed

1. Install ZABBIX server and agent

# rpm -Uvh https://repo.zabbix.com/zabbix/4.2/rhel/7/x86_64/zabbix-release-4.2-1.el7.noarch.rpm
# yum clean all

# yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent

2. Create a database. Note that the zabbix user's password needs to be set here:

# mysql -uroot -p
password
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix_password';
mysql> quit;

3. To import the database through the zabbix user, you need to enter the zabbix user password you just set:

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

4. Modify the following parameters in php.ini and reload PHP after modification:

max_execution_time=300
memory_limit=128M
post_max_size=16M
upload_max_filesize=2M
max_input_time=300
date.timezone=PRC

5. Modify the configuration file vim /etc/zabbix/zabbix_server.conf:

DBName=zabbix
DBUser=zabbix
DBPassword=zabbix_password
DBPort=3306
DBSocket=/tmp/mysql.sock   # Please refer to the mysql configuration file / etc/my.cnf for the configuration here        

7. Start ZABBIX? Server

/etc/init.d/zabbix_server start
/etc/init.d/zabbix_agentd start

6. Download the source package and extract it, and take out the zabbix site file:

 wget https://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/4.2.0/zabbix-4.2.0.tar.gz/download -O zabbix-4.2.0.tar
 tar -zxvf zabbix-4.2.0.tar
 mkdir -p /opt/web/zabbix
 cp -rf zabbix-4.2.0/frontends/php/* /opt/web/zabbix 
  chown -R www:www /opt/web/zabbix

7. Configure nginx and add a site:

server
    {
        listen 80;
        index index.html index.htm index.php;
        root  /opt/web/zabbix;
        include enable-php.conf;
        location /nginx_status
        {
            stub_status on;
            access_log   off;
        }
        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
            expires      30d;
        }
        location ~ /.well-known {
            allow all;
        }
        location ~ /\.
        {
            deny all;
        }
        access_log  /tmp/access.log;
    }

Reload nginx:

nginx -s reload

8. Open the browser for configuration, http: / / server? IP/

Posted by lizard on Fri, 29 Nov 2019 08:31:39 -0800