CentOS 7上安裝Zabbix(快速安裝監控工具Zabbix)

來源:互聯網
上載者:User

標籤:

前提要求(optional)

安裝Zabbix監控工具前,先安裝必要的運行工具包

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
安裝httpd
yum install httpd -y#啟動apachesystemctl start httpd

瀏覽你的安裝主機http://{httpd_ip}/

Install MariaDB
yum install -y mariadb-server mariadb 

啟動MariaDB,即MySQL服務。

systemctl start mariadb

設在MySQL的root屬性:

 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 currentpassword for the root user.  If you‘ve just installed MariaDB, andyou 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 MariaDBroot user without the proper authorisation.Set root password? [Y/n] y ## Enter Y and press EnterNew password:   ## Enter new passwordRe-enter new password:  ## Enter password againPassword updated successfully!Reloading privilege tables.. ... Success!By default, a MariaDB installation has an anonymous user, allowing anyoneto log into MariaDB without having to have a user account created forthem.  This is intended only for testing, and to make the installationgo a bit smoother.  You should remove them before moving into aproduction environment.Remove anonymous users? [Y/n] y  ## Enter Y and press Enter ... Success!Normally, root should only be allowed to connect from ‘localhost‘.  Thisensures 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 canaccess.  This is also intended only for testing, and should be removedbefore 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 farwill 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 MariaDBinstallation should now be secure.Thanks for using MariaDB!
安裝PHP

安裝php命令:

#最簡單方法,如果想瞭解php構建過程,推薦手工打包安裝yum install -y php php-mysql php-gd php-pear 

測試是否安裝成功:

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

瀏覽php測試檔案
http://{httpd_ip}/testphp.php

設定php配置屬性:

post_max_size = 16M
max_execution_time = 300
max_input_time = 300
date.timezone = Asia/Shanghai
always_populate_raw_post_data = -1

具體的時區,可以參考 日期時區

安裝Zabbix
#Configure the ZabbixZone package repository rpm --import http://repo.zabbix.com/RPM-GPG-KEY-ZABBIXrpm -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

設定zabbix

vi /etc/httpd/conf.d/zabbix.conf#設定zabbix的時區php_value date.timezone  **Asia/Shanghai**systemctl restart httpd

建立MySQL的Zabbix資料已經匯入資料庫結構與資料

mysql -u root -pWelcome to the MariaDB monitor. Commands end with ; or \g.Your MariaDB connection id is 10Server version: 5.5.41-MariaDB MariaDB ServerCopyright (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)]> exitBye

匯入資料

#download zabbix source codewget 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.gzcd zabbix-2.4.5#匯入資料mysql -u zabbix -p zabbix < database/mysql/schema.sqlmysql -u zabbix -p zabbix < database/mysql/images.sqlmysql -u zabbix -p zabbix < database/mysql/data.sql

啟動Zabbix

#If you use SELinux, run the following command to allow #Apache to communicate with Zabbix.setsebool -P httpd_can_connect_zabbix=1systemctl start zabbix-serversystemctl start zabbix-agentsystemctl restart httpdsystemctl restart mariadb

添加zabbix使用者為Apache的www-data的系統使用者組

# set the userusermod -aG apache zabbixcd /opt/zabbix-2.4.5#setup the zabbix frontend php filescp -rf frontends/php/* /var/www/html/# restart apachesystemctl restart httpd.service

在瀏覽器上,設定Zabbix。

下載對應的檔案或者修改對應目錄下的模板檔案。

登陸zabbix

NOTES: 設定系統預設啟動:

systemctl enable httpdsystemctl enable mariadbsystemctl enable zabbix-serversystemctl enable zabbix-agent

CentOS 7上安裝Zabbix(快速安裝監控工具Zabbix)

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.