Install Zabbix3.X on CentOS 7.2
1. Install CentOS7
Disable selinux # setenforce0 temporarily disable
Selinux must be disabled. Enabling selinux will cause a series of problems, even zabbix's discovery function cannot be used normally # sed-I "s/SELINUX = enforcing/SELINUX = disabled/g"/etc/selinux/config to check whether the modification is successful # grep SELINUX/ etc/selinux/config and then restart the system # reboot
Disable Firewall
Systemctl start firewalld. service # start firewallsystemctl stop firewalld. service # stop firewallsystemctl disable firewalld. service # disable firewall startup
Install YUM Source: cd/etc/yum. repos. d/
Wgethttp: // mirrors.163.com/.help/centos base-163.repo
Yumclean all
Yummakecache
Ii. Install LAMP
1. Install MySQL
Starting from the latest linux system, the default version is Mariadb rather than mysql! Installing repos with the built-in system is simple: # yum install-y mariadb-server to start mariadb # The service management commands before systemctl start mariadb can also be set with # service mariadb start to enable automatic startup # systemctl enable mariadb Security Initialization, set the root password and so on # mysql_secure_installation test logon # mysql-uroot-p123456 // password 123456
2. install Apache Software
# Yum-y install httpd # systemctl start httpd. service # systemctl enable httpd. service # systemctl status httpd. service // check whether the "enabled" status indicates that the httpd service has been set to startup, and "active (running)" indicates that the httpd service is running.
3. install PHP
# Yum-y install php-mysql
Php-mysql is a module used to allow PHP programs to use the MySQL database. To install this module, run the following command:
# Yum-y install php-mysql
# Systemctl restart httpd // restart the httpd service
After the installation is complete, PHP will generate a configuration file/Etc/httpd/conf. d/php. conf, because the configuration file is in the/etc/httpd/conf. d directory, it will be read by Apache. PHP also generates a configuration file/Etc/httpd/conf. modules. d/10-php.conf. The configuration file will also be read by Apache. Its settings allow Apache to load the PHP module. However, the configuration file of the PHP software is actually/Etc/php. ini.
Test: to test whether Apache can call PHP normally, create a phpinfo. php file in the/var/www/html directory. The content is as follows:
<? Php phpinfo ();?> // <? Php?> It is the syntax of the PHP program. phpinfo () is a function library provided by the PHP program. This function library can display information about your web server.
Access http: // ip/phpinfo. php
Reference Web http://www.linuxidc.com/Linux/2015-06/118818.htm
3. Install Zabbix
Package: http://www.zabbix.com/download.php
1. Documents: https://www.zabbix.com/documentation/3.2/manual/installation/install_from_packages
2. Import Source:
rpm -ivh http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm
3. Install the zabbix package
yum -y install zabbix-server-mysql zabbix-web-mysql
4. We also installed the client on the local machine.
yum -y install zabbix-agent
5. initialize the database
Mysql> create database zabbix character set utf8 collate utf8_bin; Query OK, 1 row affected (0.00 sec) mysql> grant all privileges on zabbix. * to zabbix @ localhost identified by 'zabbix'; // The password is zabbix Query OK, 0 rows affected (0.00 sec) mysql> quitBye
Enter this directory
#cd /usr/share/doc/zabbix-server-mysql-3.2.1#lsAUTHORS ChangeLog COPYING create.sql.gz NEWS README
Run commands
# Zcat create. SQL .gz | mysql-uroot-p zabbix // The password zabbix corresponds to the newly created zabbix database in the database
6. Start the zabbix server Service
# Vim/etc/zabbix/zabbix_server.confDBHost = localhostDBName = zabbixDBUser = zabbixDBPassword = zabbix in fact, my configuration file changes the DBHost and DBPassword to remove the previous.
Start zabbix and set auto-start
#systemctl start zabbix-server#systemctl enable zabbix-server
7. Edit the PHP configuration of zabbix frontend.
Php_value max_execution_time 300php_value memory_limit 128Mphp_value post_max_size 16Mphp_value limit 2Mphp_value limit 300php_value limit-1php_value date. timezone Asia/Shanghai // major remove # change to Shanghai
Adjust time synchronization: install ntpdate, yum-y install ntpdate
# Ntpdate cn.pool.ntp.org
NTP reference link: http://www.linuxidc.com/Linux/2015-11/124911.htm
Start apache and set Automatic startup
#systemctl start httpd#systemctl enable httpd
8. log on to zabbix
http://IP/zabbix/http://IP/zabbix/setup.php
Default username/password: Admin/zabbix
The text in the image is displayed □□solution:
Refer:
http://www.cnblogs.com/enjoycode/p/zabbix_3_installation_on_centos_7.html
Win + R open and run, enter fonts, press enter to enter the Windows Font directory, find -Regular font, copy it and change the file name to msyh. ttf, and then upload it to/usr/share/zabbix/fonts
After the upload is successful, Edit
Vim/usr/share/zabbix/include/defines. inc. php: Change 'graphfont 'to msyh
After modification, define ('zbx _ GRAPH_FONT_NAME ', 'msyh'); // font file name
You can also directly execute the command:
View font configuration # grep FONT_NAME/usr/share/zabbix/include/defines. inc. php-n45: define ('zbx _ GRAPH_FONT_NAME ', 'graphfont'); // font file name93: define ('zbx _ FONT_NAME ', 'graphfont '); check whether the font name can be replaced by # grep graphfont/usr/share/zabbix/include/defines. inc. php-n45: define ('zbx _ GRAPH_FONT_NAME ', 'graphfont'); // font file name93: define ('zbx _ FONT_NAME ', 'graphfont '); execute quick replace # sed-I "s/graphfont/msyh/g"/usr/share/zabbix/include/defines. inc. php check whether the replacement is successful # grep FONT_NAME/usr/share/zabbix/include/defines. inc. php-n45: define ('zbx _ GRAPH_FONT_NAME ', 'msyh'); // font file name93: define ('zbx _ FONT_NAME', 'msyh ');