Centos7 install zabbix detailed steps

Preparation before installation:
1.1 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
possible failure problem: Cannot find a valid baseurl for repo: base/7/x86_64
solution : Modify DNS

1.2 Turn off the firewall:
systemctl stop firewalld.service
systemctl disable firewalld.service
needs to turn off selinux, be sure to turn off this, turning on selinux will cause a series of problems, even the discovery function of zabbix cannot be used normally
sed -i “s/SELINUX=enforcing/SELINUX =disabled/g” /etc/selinux/config
to confirm whether the modification is successful
grep SELINUX /etc/selinux/config
and then restart the system to
reboot
1. Install zabbix server 3.0 on centos 7
According to official requirements of zabbix server 3.0, currently zabbix Server3.0 cannot be installed with yum on centos6 OS. If you must install zabbix server3.0 on centos6 OS, it is strongly recommended to compile and install through source code, and you also need to pay attention to the version of PHP.
Considering these factors, here we are installing zabbix server3.0 with yum on the centos7 OS.
Note: Although zabbix server3.0 cannot be installed by yum on centos6 OS, zabbix-agent3.0 can be installed by yum on centos6 OS.
1.1 Build the lamp environment
Before installing zabbix server 3.0 on centos7, we first build the lamp environment required by zabbix.
Download the latest yum source, as follows:
wget -P /etc/yum.repos.d http://mirrors.aliyun.com/repo/Centos-7.repo
Here, the yum source of Alibaba Cloud may not be used directly, you need to install Centos -7.repo file in r e l e a s e s e r v e r change become 7 basearch changed to X86_64.
[root@zabbix ~]#sed -i '/ releaseserver/7/g’    [root@zabbix ~]#sed -i ‘/ basearch/x86_64/g'
write picture description here
Before starting the installation, it is also necessary to explain that the mysql that comes with centos7 is mariadb. We can check it with the following command:
yum search mysql|tac
write picture description here

Now start installing the lamp environment and use the following command:
[root@zabbix ~]# yum -y install mariadb mariadb-server php php-mysql
write picture description here
httpd httpd2.4 and maradb5.5, this fully meets the requirements of zabbix3.0 for the software version.
After lamp is installed, we now configure the mysql database.
Set up self-start mysql at boot, and start mysql, use the following command:
[root@zabbix ~]# systemctl enable mariadb.service
[root@zabbix ~]# systemctl start mariadb.service
write picture description here
Start mariadb service:
[root@zabbix ~]# systemctl Start mariadb.service to
initialize the mysql database and configure the root user password. Use the following command:
[root@zabbix ~]# mysql_secure_installation
write picture description here
write picture description here
write picture description here
Note: At Enter current passwdord for root in the above figure, we can just hit the Enter key. Because the default root user password of mysql on centos7 is empty.
The above figure mainly configures the password for the root user and refreshes the relevant permissions. (The password is set to 123456, only for experimental use, customized for production environment)
Remove anonymous users? Delete anonymous users?
Disallow root login remotely? Prohibit root remote login
Remove test database and access to it? Delete the test database and access it Reload
privilege tables now?
and other related configurations.
After mysql is initialized, let's now create the zabbix database and its users, using the following commands:
[root@zabbix ~]# mysql -uroot -p123456 -e "create database zabbix default character set utf8 collate utf8_bin;"
[root@zabbix ~ ]# mysql -uroot -p123456 -e "grant all on zabbix.* to "zabbix"@"%" identified by "zabbix";" Now to test whether the zabbix
write picture description here
user just created can connect to the mysql database, as follows:
@zabbix ~]# mysql -uzabbix -pzabbix
MariaDB [(none)]> show databases;
MariaDB [(none)]> quit From
write picture description here
the above figure, we can clearly see that zabbix users can connect to the database normally.
Start apache and open port 80 as follows:
[root@zabbix ~]# systemctl start httpd.service
[root@zabbix ~]# netstat -ltun The
write picture description here
write picture description here
lamp environment has all been set up.
write picture description here

1.2 Install zabbix server3.0
After the lamp environment is set up, we will now officially install zabbix3.0.
The EPEL source and the yum source of zabbix required to install zabbix3.0 are as follows:
rpm -ivh http://mirrors.aliyun.com/epel/7/x86_64/e/epel-release-7-8.noarch.rpm
write picture description here
rpm - ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
write picture description here
After the above installation is complete, we will now officially install zabbix3.0, using the following Command:
[root@zabbix ~]# yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-get From
write picture description here
the above figure, we can clearly see that the current zabbix server is version 3.0.5.
After the above installation is complete, we now start to configure zabbix.
Import the zabbix database structure as follows:
[root@zabbix ~]# cd /usr/share/doc/zabbix-server-mysql-3.0.5/
[root@zabbix zabbix-server-mysql-3.0.5]# zcat create. sql.gz | mysql -uroot -pDe123456 zabbix
write picture description here
After the database is imported, let's modify the configuration file of zabbix sever as follows:
[root@zabbix ~]# vi /etc/zabbix/zabbix_server.conf
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=0
PidFile= /var/run/zabbix/zabbix_server.pid

DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix

SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
Timeout=4
AlertScriptsPath=/usr/lib/zabbix/alertscripts
ExternalScripts=/usr/lib/zabbix/externalscripts
LogSlowQueries=3000

In the above configuration file, we only need to pay attention to DBHost, DBName, DBUser,
DBPassword. These items are the parameters for configuring the zabbix server to connect to the mysql database.
After the above modification is completed, let's modify the zabbix.conf file again.
Before modification:
write picture description here
After modification:
write picture description here
php_value date.timezone Asia/Chongqing mainly defines the time zone of php.
After the above modification is completed, we will add zabbix-server to boot and start zabbix-server, as follows:
[root@zabbix ~]# systemctl start zabbix-server.service
[root@zabbix ~]# systemctl enable zabbix-server. service
write picture description here
finally restarts apache, as follows:
[root@zabbix ~]# systemctl restart httpd.service

3. Configure
zabbix http://ip/zabbix/setup.php
write picture description here
next step
write picture description here
Next step
write picture description here
What needs to be filled in the above picture is that the zabbix database we created earlier has a user and password, Next step
write picture description here
Next step
write picture description here
Next step
write picture description here
finish The
write picture description here
default username is Admin Password zabbix and then click sign in
write picture description here
Fourth, install zabbix agent
We installed zabbix server3.0 before, this chapter we introduce the installation of zabbix agent. The installation of zabbix agent is relatively simple, we only need to install the corresponding warehouse, and then execute the installation command.
4.1 Install zabbix agent To install agent
on centos os, use the following command:
[root@zabbix ~]# yum clean all
[root@zabbix ~]# yum -y install zabbix zabbix-agent
write picture description here
write picture description here

During installation, the error shown in the above figure appears because the two versions of the software are inconsistent. After careful observation, it is found that these two software packages use different repositories. Turn off epel (enabled=0, located in /etc/yum.repos .d/epel.repo) and reinstall

4.2 Configuring zabbix agent
The configuration of zabbix agent is very simple, you only need to modify the three items of Server, ServerActive and Hostname in the zabbix agent configuration file.
Among them, Server and ServerActive are the IP address of the zabbix server, and Hostname is the IP address of the monitored terminal, as follows:
[root@zabbix ~]# vi /etc/zabbix/zabbix_agentd.conf
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=0
Server=127.0.0.1
ServerActive=127.0.0.1
Hostname=127.0.0.1
Include=/etc/zabbix/zabbix_agentd.d/
After the above configuration is complete, we are in zabbix web When adding the monitoring machine on the client side, you only need to match the honst name with the hostname in the configuration file. As follows:
Server=server ip address
ServerActive=server ip address
Hostname=client ip address
Server passive ServerActive active At
this point , the zabbix agent has been installed.
start the client
[root@zabbix ~]# zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf
[root@zabbix ~]# systemctl start zabbix-agent
[root@zabbix ~]# systemctl restart zabbix-agent
[root@zabbix ~]# systemctl enable zabbix-agent

write picture description here
write picture description here

Check the status
write picture description here
write picture description here
5. Chinese display and optimization of
zabbix web 5.1 Chinese display of zabbix web
By default , zabbix web displays English. In fact, zabbix supports Chinese. We can open Chinese by modifying the web source file.
Modify the /usr/share/zabbix/include/locales.inc.php file and change the false of the line where zh_CN is located to true, as follows:
[root@zabbix ~]# vim /usr/share/zabbix/include/locales. Inc.php +55
Before correction: After
write picture description here
correction:
write picture description here
Finally, click on the head avatar in the upper right corner of the zabbix web monitoring page, and select the Chinese language in the pop-up tab. As follows:
Before
write picture description here
correction: After correction:
write picture description here
5.2 Chinese display optimization
Install Chinese support package
The specific steps are omitted.

Reprinted from http://blog.csdn.net/u014057054/article/details/66476990

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325770180&siteId=291194637