Environment Description:
IP | use | system version | kernel version | Software version | Remark |
192.168.10.100 | zabbix-server | CentOS Linux release 7.4.1708 (Core) | 3.10.0-693.el7.x86_64 | zabbix3.4.7-1 | |
192.168.10.101 | zabbix-client | CentOS Linux release 7.4.1708 (Core) | 3.10.0-693.el7.x86_64 |
Installation preparations:
Turn off firewall and SELinux
#Close the firewall
systemctl stop firewalld systemctl disable firewalld #Close SELinux sed -i ' s/SELINUX=enforcing/SELINUX=disabled/g ' /etc/selinux/ config setenforce 0 getenforce
Install epel source and zabbix source
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo rpm -i http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
Install dependencies
yum -y install wget net-snmp-devel OpenIPMI-devel httpd openssl-devel java lrzsz fping-devel libcurl-devel perl-DBI pcre-devel libxml2 libxml2-devel mysql-devel gcc php php-bcmath php-gd php-xml php-mbstring php-ldap php-mysql.x86_64 php-pear php-xmlrpc net-tools wget vim-enhanced
Install and configure the web environment on the zabbix-server side
Install database and web related software
1 yum -y install mariadb mariadb-server php php-mysql httpd
Initialize the mysql database and configure the root user password.
[root@Server ~]# mysql_secure_installation .... Enter current password for root (enter for none): #mariadb default empty password after installation, just press Enter here OK, successfully used password, moving on... Set root password ? [Y/ n] and New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. ... Success! ... Remove anonymous users ? [Y/ n] y #Whether to remove anonymous users ... Success! Disallow root login remotely ? [Y/ n] y #Whether root is allowed to log in to MySQL remotely ... Success! Remove test database and access to it ? [Y/ n] y #Whether to remove test database and access to it - Dropping test database... ... Success! - Removing privileges on test database... ... Success! ... Reload privilege tables now ? [Y/ n] y #Whether to reload privilege tables now ... Success! Cleaning up... All done! If you've completed all of the above steps, your MariaDB installation should now be secure. Thanks for using MariaDB!
Create zabbix library and user
ariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin; Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix3'; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> flushr privieles;
start httpd service
systemctl start httpd
View test page
Install zabbix service
Since the source of zabbix has been installed when configuring the yum source before, you can install it directly here
yum install -y zabbix-server-mysql zabbix-web-mysql zabbix-agent
import database
cd /usr/share/doc/zabbix-server-mysql-3.4.7/ zcat create.sql.gz |mysql -uroot -p123456 zabbix
Modify the zabbix configuration file
#Backup zabbix configuration file
cp zabbix_server.conf zabbix_server.conf.default vim /etc/zabbix、zabbix_server.conf LogFile=/var/log/zabbix/zabbix_server.log LogFileSize=0 PidFile=/var/run/zabbix/zabbix_server.pid SocketDir=/var/run/zabbix DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=zabbix3 SNMPTrapperFile = / var / log / snmptrap / snmptrap.log Timeout=4 AlertScriptsPath=/usr/lib/zabbix/alertscripts ExternalScripts=/usr/lib/zabbix/externalscripts LogSlowQueries=3000
Remarks: The main focus is on the configuration related to DB, and the correctness can be ensured. The above configuration is the default configuration after zabbix is secured, in which DBHost and DBPassword are both commented states, remove the '#' and modify it correctly. The configuration of the remaining annotations is filtered.
Modify the zabbix configuration file of httpd
cd /etc/httpd/conf.d/ cp zabbix.conf zabbix.conf.bak sed -i "s?# php_value date.timezone Europe/Riga?php_value date.timezone Asia/Shanghai?g" zabbix.conf
Here we mainly modify the time zone configuration of php.
Start zabbix and configure startup, restart httpd
systemctl enable zabbix-server systemctl start zabbix-server systemctl restart httpd
Configure zabbix
Browser input IP/zabbix/setup.php
The default username and password are Admin. After entering zabbix, click sing in to complete the login. At this point, the zabbix-server installation is complete.