Install Zabbix on CentOS 7 (Quick Install monitoring tool Zabbix)

Source: Internet
Author: User
Tags snmp


Prerequisite requirements (optional)


Before installing the ZABBIX monitoring tool, install the necessary run kit first


yum install gcc gcc-c++ make openssl-devel curl wget net-snmp net-snmp-utils net-snmp-libs net-snmp-devel gnutls gnutls-devel libxml2 libxml2-devel
Installing httpd
yum install httpd -y#start apachesystemctl start httpd


Browse your Installation host http://{httpd_ip}/





Install MariaDB
-y mariadb-server


Start Mariadb, which is the MySQL service.


start mariadb


The root property is set in MySQL:


mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we‘ll need the current
password for the root user.  If you‘ve just installed MariaDB, and you haven‘t set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none): 
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] y ## Enter Y and press Enter New password: ## Enter new password Re-enter new password: ## Enter password again Password updated successfully!
Reloading privilege tables..
 ... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y ## Enter Y and press Enter ... Success!
Normally, root should only be allowed to connect from ‘localhost‘.  This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y ## Enter Y and press Enter ... Success!
By default, MariaDB comes with a database named ‘test‘ that anyone can
access.  This is also intended only for testing, and should be removed before moving into a production environment.
Remove test database and access to it? [Y/n] y ## Enter Y and press Enter - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y ## Enter Y and press Enter ... 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!
Install PHP


To install the PHP command:


#The easiest way, if you want to understand the php build process, it is recommended to manually package and install
yum install -y php php-mysql php-gd php-pear 


To test whether the installation was successful:


vi /var/www/html/testphp.php
<?php phpinfo(); ?>


Explore PHP Test files
http://{httpd_ip}/testphp.php






To set PHP configuration properties:



Post_max_size = 16M
Max_execution_time = 300
Max_input_time = 300
Date.timezone = Asia/shanghai
Always_populate_raw_post_data =-1



Specific time zone, you can refer to the date time zone


Installing Zabbix
 
#Configure the ZabbixZone package repository 
rpm --import http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX rpm -Uv http://repo.zabbix.com/zabbix/2.4/rhel/7/x86_64/zabbix-release-2.4-1.el7.noarch.rpm  #Install the necessary server packages 
yum install mysql-server zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-java-gateway


Set Zabbix


vi /etc/httpd/conf.d/zabbix.conf
#Set the time zone of zabbix
php_value date.timezone ** Asia / Shanghai **

systemctl restart httpd


Creating MySQL Zabbix data has been imported into the database structure and data


mysql -u root -p
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 10 Server version: 5.5.41-MariaDB MariaDB Server
Copyright (c) 2000, 2014, Oracle, MariaDB Corporation Ab and others. Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.
MariaDB [(none)]> create database zabbix character set utf8;
Query OK, 1 row affected (0.05 sec)
MariaDB [(none)]> grant all privileges on zabbix.* to ‘zabbix‘@‘localhost‘ identified by ‘password‘;
Query OK, 0 rows affected (0.21 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> exit Bye


Import data


#download zabbix source code
wget http: //sourceforge.net/projects/zabbix/files/ZABBIX \ Latest \ \ Stable / 2.4.5 / zabbix-2.4.5.tar.gz

#
tar xvf zabbix-2.4.5.tar.gz
cd zabbix-2.4.5
#Import Data
mysql -u zabbix -p zabbix <database / mysql / schema.sql
mysql -u zabbix -p zabbix <database / mysql / images.sql
mysql -u zabbix -p zabbix <database / mysql / data.sql 


Start Zabbix


 
 
#If you use SELinux, run the following command to allow #Apache to communicate with Zabbix.
setsebool -P httpd_can_connect_zabbix=1

systemctl start zabbix-server
systemctl start zabbix-agent
systemctl restart httpd
systemctl restart mariadb


Add a System user group for the Zabbix user for Apache Www-data


 
 
# set the user
usermod -aG apache zabbix


cd /opt/zabbix-2.4.5
#setup the zabbix frontend php files
cp -rf frontends/php/* /var/www/html/
# restart apache
systemctl restart httpd.service


On the browser, set the Zabbix.


















Download the corresponding file or modify the template file in the corresponding directory.



Login Zabbix






NOTES: Set system default boot:


systemctl enable httpd
systemctl enable mariadb
systemctl enable zabbix-server systemctl enable zabbix-agent


Install Zabbix on CentOS 7 (Quick Install monitoring tool Zabbix)


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.