Home > System Tutorial > LINUX > Zabbix 3.4 Source code compilation installation

Zabbix 3.4 Source code compilation installation

PHPz
Release: 2024-09-04 07:32:49
Original
1087 people have browsed it

Zabbix 3.4 Source code compilation installation

1. Installation environment (Hyper-V virtual machine):

$ hostnamectl
 Static hostname: localhost.localdomain
 Icon name: computer-vm
 Chassis: vm
 Machine ID: renwoles1d8743989a40cb81db696400
 Boot ID: renwoles272f4aa59935dcdd0d456501
 Virtualization: microsoft
 Operating System: CentOS Linux 7 (Core)
 CPE OS Name: cpe:/o:centos:centos:7
 Kernel: Linux 3.10.0-514.2.2.el7.x86_64
 Architecture: x86-64
Copy after login

2. Since the Zabbix UI front-end is written in PHP, it must run on a web server that supports PHP scripting language. Prerequisites:

《Centos 7 编译安装nginx》
《Centos 7 编译安装PHP 7 之生产篇》
《Linux JAVA JDK JRE 环境变量安装与配置》
《Centos 7 二进制安装 MariaDB(MySQL)数据库》
Copy after login

3. If your server already has a PHP environment, please skip step 2 and continue with the following configuration:

Configuring php.ini must meet the following requirements:

max_execution_time = 300
max_input_time = 300
memory_limit = 128M
post_max_size = 32M
date.timezone = Asia/Shanghai
mbstring.func_overload=2
#Zabbix PHP LDAP 认证开启(可选)
extension = "/usr/local/php/lib/php/extensions/no-debug-zts-20160303/ldap.so"
Copy after login

4. Install dependent packages and create groups & users

$ yum -y install epel-release && yum -y update
$ yum install -y net-snmp-devel OpenIPMI-devel libssh2-devel iksemel-devel
$ groupadd zabbix
$ useradd -g zabbix zabbix
Copy after login

5. Install Zabbix Server

Download address: https://www.zabbix.com/download

$ cd /tmp
$ tar -zxvf zabbix-3.4.2.tar.gz
$ cd zabbix-3.4.2
$ ./configure --prefix=/usr/local/zabbix \
--sysconfdir=/usr/local/zabbix/etc \
--enable-server \
--enable-agent \
--with-mysql=/usr/bin/mysql_config \
--with-net-snmp \
--with-libcurl \
--with-libxml2 \
--enable-proxy \
--enable-ipv6 \
--enable-java \
--with-ssh2 \
--with-iconv \
--with-openipmi \
--with-ldap \
--with-openssl \
--with-jabber \

$ make
$ make install
Copy after login

Note: –enable-agent is optional, this parameter is mainly used for clients (monitored persons).

Note: If you have not installed the JAVA environment, please remove the –enable-java option, which is mainly used to monitor Tomcat.

6. Create and grant permissions to the Zabbix configuration file directory

$ mkdir -p /usr/local/zabbix/logs
$ chown -R zabbix.zabbix /usr/local/zabbix
Copy after login

7. Copy the Zabbix UI front-end program source code to the Nginx Web directory

$ cp -rf /tmp/zabbix-3.4.2/frontends/php/* /apps/web/zabbix
$ chown -R www.www /apps/web/zabbix
Copy after login

8. Create database name: zabbix User: zabbix Password: renwolecom and grant the user all permissions to the database:

$ mysql -uroot -p
Enter password:(输入root数据库密码回车)
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@"%" identified by 'renwolecom';
MariaDB [(none)]> flush privileges;
MariaDB [(none)]> quit;
Copy after login

9. Import the Zabbix related structure table files into the zabbix database in sequence

Import sequence schema.sql table structure > images.sql picture library > data.sql initial script

$ cd /tmp/zabbix-3.4.2/database/mysql
$ mysql -uzabbix -prenwolecom zabbix 
<p>10.Configure zabbix_server.conf</p>
<p>The content after the configuration is completed is as follows: </p>
<pre class="brush:php;toolbar:false">
$ egrep -v "^$|^#|^;" /usr/local/zabbix/etc/zabbix_server.conf
LogFile=/usr/local/zabbix/logs/zabbix_server.log
PidFile=/usr/local/zabbix/zabbix_server.pid
LogFileSize=0
DBHost=10.10.204.62
DBName=zabbix
DBUser=zabbix
DBPassword=renwolecom
JavaGateway=10.10.204.62
JavaGatewayPort=10052
StartJavaPollers=5
StartPingers=4
Timeout=4
AlertScriptsPath=/usr/local/zabbix/share/zabbix/alertscripts
LogSlowQueries=3000
Include=/usr/local/zabbix/etc/zabbix_server.conf.d/
Copy after login

Note: Since the parameter configuration of each production environment is different, I only list the basic and commonly used configuration files. See more configuration parameters for instructions.

11. Create systemctl system Zabbix servers unit file

$ vim /usr/lib/systemd/system/zabbix.service
[Unit]
Description=Zabbix Server
After=syslog.target
After=network.target

[Service]
Environment="CONFFILE=/usr/local/zabbix/etc/zabbix_server.conf"
EnvironmentFile=-/usr/local/zabbix/etc/zabbix_server.conf.d
Type=forking
Restart=on-failure
PIDFile=/usr/local/zabbix/zabbix_server.pid
KillMode=control-group
ExecStart=/usr/local/zabbix/sbin/zabbix_server -c $CONFFILE
ExecStop=/bin/kill -SIGTERM $MAINPID
RestartSec=10s
TimeoutSec=0

[Install]
WantedBy=multi-user.target
Copy after login

12. Start zabbix and add auto-start at boot

$ systemctl start zabbix
$ systemctl enable zabbix
Copy after login

13.Firewalld firewall settings

$ firewall-cmd --permanent --add-port=10051/tcp
$ firewall-cmd --permanent --add-port=80/tcp
$ firewall-cmd --reload
Copy after login

Installation completed.

Next, you can use IP or domain name to access the Zabbix monitoring and management system. For specific settings, please follow the Zabbix Server Web wizard prompts.

After the setting is completed, zabbix default account: Admin Password: zabbix (note that accounts are case-sensitive) After logging in, the English interface is displayed. Just click on the little man icon in the upper right corner (current user settings) to locate the Language item and select Chinese ( zh_CN), click Update to switch to the Chinese interface

The above is the detailed content of Zabbix 3.4 Source code compilation installation. For more information, please follow other related articles on the PHP Chinese website!

source:linuxprobe.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template