Zabbix 5.4 compilation and installation

Linux version: Centos 8.4

Zabbix version: 5.4.7

Mysql version: 8.0.26

Apache version: 2.4.37

PHP version: 7.2.24 (minimum requirement: 7.2)

catalogue

Environmental preparation

1, Software dependent package installation

1. LAMP installation

2. Installation of other software packages

Service installation

1, Zabbix Server installation

1. Download the source package

2. Decompression and installation

2, Database Mysql configuration

1. Start the database

2. Create a new database and authorize

3. Import table structure and initial data

3, Zabbix configuration

1. Add user and authorize

2. Modify Zabbix Server configuration file  

3. Modify the Zabbix Agent configuration file  

4, PHP configuration

1. Modify the configuration file

5, Apache configuration

1. Modify the configuration file  

Start service

1, Start Apache

1. Add Zabbix GUI page

2. Page authorization

3. Restart   Apache

2, Start Zabbix Server / Agent

1. Add startup script

3. Start   Zabbix Server / Agent

3, Set startup and self startup

Service access

1, Access page

1. The browser accesses http: / / host ip

2. Version requirements self inspection

3. Configure database connection information

4. Installation completed  

5. Login page

Environmental preparation

1, Software dependent package installation

1. LAMP installation

yum install -y php php-mysqlnd php-json php-common php-ldap php-gd php-mbstring php-devel php-xml php-bcmath httpd mysql-server mysql mysql-devel

2. Installation of other software packages

(snmp, ldap module, etc.)

yum install -y net-snmp-devel libcurl-devel libxml2-devel libevent libevent-devel libcurl perl-DBI openldap-devel

Service installation

1, Zabbix Server installation

1. Download the source package

Official address: Download Zabbix sources

wget https://cdn.zabbix.com/zabbix/sources/stable/5.4/zabbix-5.4.7.tar.gz

2. Decompression and installation

  (unzip the tar package, compile and install)

tar -zxf zabbix-5.4.7.tar.gz
cd zabbix-5.4.7
./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2 --with-ldap
make && make install

2, Database Mysql configuration

1. Start the database

systemctl start mysqld

2. Create a new database and authorize

(modify the actual user, password and ip)

mysql -uroot -p
create database zabbix character set utf8 collate utf8_bin;
create user zabbix@ip identified by 'password';
grant all privileges on zabbix.* to zabbix@ip;
flush privileges;

3. Import table structure and initial data

(modify the ip in step 2)

mysql -uzabbix -h<ip> -p zabbix <database/mysql/schema.sql
mysql -uzabbix -h<ip> -p zabbix <database/mysql/images.sql
mysql -uzabbix -h<ip> -p zabbix <database/mysql/data.sql

3, Zabbix configuration

1. Add user and authorize

groupadd zabbix
useradd -g zabbix zabbix
chown -R zabbix:zabbix /usr/local/zabbix

2. Modify Zabbix Server configuration file  

/usr/local/zabbix/etc/zabbix_server.conf

(modify the actual ip, user and password. DBName is the created database name zabbix)

LogFile=/tmp/zabbix_server.log
PidFile=/tmp/zabbix_server.pid
DBHost=ip
DBName=zabbix
DBUser=zabbix
DBPassword=password

3. Modify the Zabbix Agent configuration file  

/usr/local/zabbix/etc/zabbix_agentd.conf

(modify the actual ip and hostname)

PidFile=/tmp/zabbix_agentd.pid
LogFile=/tmp/zabbix_agentd.log
Server=ip
Hostname=hostname

4, PHP configuration

1. Modify the configuration file

/etc/php.ini

max_execution_time = 300
max_input_time = 300
memory_limit = 128M
post_max_size = 32M
date.timezone = Asia/Shanghai

5, Apache configuration

1. Modify the configuration file  

/etc/httpd/conf/httpd.conf

Listen 80
User apache
Group apache
ServerName domain name:80
DocumentRoot "/var/www/html"
DirectoryIndex index.html index.htm index.php

Start service

1, Start Apache

1. Add Zabbix GUI page

cp -rf ui/* /var/www/html/

2. Page authorization

chown -R apache.apache /var/www/html/

3. Restart   Apache

systemctl restart httpd

2, Start Zabbix Server / Agent

1. Add startup script

cp misc/init.d/fedora/core5/* /etc/init.d/
chmod 755 /etc/init.d/zabbix*

/etc/init.d/zabbix_server

ZABBIX_BIN="/usr/local/zabbix/sbin/zabbix_server"

/etc/init.d/agentd.conf

ZABBIX_BIN="/usr/local/zabbix/sbin/zabbix_agentd"

3. Start   Zabbix Server / Agent

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

3, Set startup and self startup

(Apache,Mysql,Zabbix Server / Agent)

systemctl enable httpd
systemctl enable mysqld
cat << EOF >> /etc/rc.local
/etc/init.d/zabbix_server start
/etc/init.d/zabbix_agentd start
EOF

Service access

1, Access page

1. The browser accesses http: / / host ip

2. Version requirements self inspection

(php.ini can be modified if it does not meet the requirements)

3. Configure database connection information

(fill in the actual database host, user and password)

4. Installation completed  

5. Login page

(default user name: Admin Password: zabbix)

Keywords: Linux Operation & Maintenance CentOS Zabbix

Added by torleone on Wed, 10 Nov 2021 04:08:51 +0200