zabbix安装

 

一,zabbix-server 安装

参考
https://www.zabbix.com/documentation/3.4/zh/manual/installation/install_from_packages
1、Install Repository with MySQL database

rpm -i http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm

2、Install Zabbix server, frontend, agent

yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent


3、Initial database

# mysql -uroot -p
password
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'password';
mysql> quit;

4、Import initial schema and data. You will be prompted to enter your newly created password.

# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix

5、Configure the database for Zabbix server

vim /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbixAdmin
DBPassword=zabbixPasswd@2018

6、Start Zabbix server and agent processes

[root@teacher ~]# systemctl start zabbix-server
[root@teacher ~]# lsof -i:10051
COMMAND
PID
USER
zabbix_se 93711 zabbix
FD
5u
TYPE DEVICE SIZE/OFF NODE NAME
IPv4
77862

7、Configure PHP for Zabbix frontend

Edit file /etc/httpd/conf.d/zabbix.conf
# php_value date.timezone Asia/Shanghai
0t0
TCP *:zabbix-trapper (LISTEN)8、Configure Zabbix frontend Connect to your newly installed Zabbix frontend:
http://server_ip_or_name/zabbix

9、Setting permission for nginx + php
 

[root@teacher nginx]# ll /etc/zabbix/
total 28
drwxr-x---. 2 apache apache
33 Apr 12 17:50 web
-rw-r--r--. 1 root root
10588 Apr
3 19:21 zabbix_agentd.conf
drwxr-xr-x. 2 root root
-rw-r-----. 1 root zabbix 15814 Apr 12 18:01 zabbix_server.conf
38 Apr 12 17:51 zabbix_agentd.d
[root@teacher nginx]# chown -R nginx.nginx /etc/zabbix/web
[root@teacher nginx]# ll /etc/zabbix/
total 28
drwxr-x---. 2 nginx nginx
33 Apr 12 17:50 web
-rw-r--r--. 1 root root
drwxr-xr-x. 2 root root
10588 Apr
3 19:21 zabbix_agentd.conf
-rw-r-----. 1 root zabbix 15814 Apr 12 18:01 zabbix_server.conf
38 Apr 12 17:51 zabbix_agentd.d
[root@teacher nginx]#
Start using Zabbix

 

源码包安装

参考::https://www.zabbix.com/documentation/3.4/manual/installation/install
1 Download the source archive

[root@teacher ~]# tar xfz zabbix-3.4.8.tar.gz -C /tmp
[root@teacher tmp]# cd zabbix-3.4.8/
[root@teacher zabbix-3.4.8]#


2 Create user account

groupadd zabbix
useradd -g zabbix zabbix


3 Create Zabbix database Having created a Zabbix database, proceed to the following steps of compiling
Zabbix.

[root@teacher zabbix-3.4.8]# ls
aclocal.m4 compile configure.ac include Makefile.in README
AUTHORS conf COPYING INSTALL man sass
bin config.guess database install-sh misc src
build config.sub depcomp m4 missing upgrades
ChangeLog configure frontends Makefile.am NEWS
[root@teacher zabbix-3.4.8]# ls database/
elasticsearch
ibm_db2
Makefile.am
Makefile.in
[root@teacher zabbix-3.4.8]# ls database/mysql/
mysql
oracle
postgresql
sqlite3data.sql
images.sql
schema.sql
[root@teacher zabbix-3.4.8]# mysql -pQianfeng@2018
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.
Commands end with ; or \g.
Your MySQL connection id is 35
Server version: 5.7.21 MySQL Community Server (GPL)
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database zabbix2 default character set utf8;
Query OK, 1 row affected (0.00 sec)
mysql> grant all privileges on zabbix2.* to 'zabbixAdmin'@'10.18.42.251' identified by
'zabbixPasswd@2018';
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> grant all privileges on zabbix2.* to 'zabbixAdmin'@'localhost' identified by
'zabbixxPasswd@2018';
Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql> grant all privileges on zabbix2.* to 'zabbixAdmin'@'127.0.0.1' identified by
'zabbixxPasswd@2018';
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> \q
Bye
[root@teacher zabbix-3.4.8]# mysql -uzabbixAdmin -pzabbixPasswd@2018 zabbix2 <
database/mysql/schema.sql
mysql: [Warning] Using a password on the command line interface can be insecure.
[root@teacher zabbix-3.4.8]# mysql -uzabbixAdmin -pzabbixPasswd@2018 zabbix2 <
database/mysql/images.sql
mysql: [Warning] Using a password on the command line interface can be insecure.
[root@teacher zabbix-3.4.8]# mysql -uzabbixAdmin -pzabbixPasswd@2018 zabbix2 <
database/mysql/data.sql
mysql: [Warning] Using a password on the command line interface can be insecure.
[root@teacher zabbix-3.4.8]#


4 Configure the sources

yum install net-snmp-devel
libevent-devel
./configure --enable-server --enable-agent
--with-mysql --enable-ipv6 --with-net-snmp -
-with-libcurl --with-libxml2 --prefix=/usr/local/zabbix5 Make and install everything
make install


5. Configure frontends

# vim /etc/nginx/nginx.conf
location / {
root
/usr/share/nginx/html;
}
location ~ "\.php$" {
fastcgi_pass 10.18.42.251:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/$fastcgi_script_name;
include fastcgi_params;
}
[root@teacher zabbix-3.4.8]# rm /usr/share/nginx/html/* -f
[root@teacher zabbix-3.4.8]# cp -r frontends/php/*
/usr/share/nginx/html/
[root@teacher zabbix-3.4.8]# cd /usr/share/nginx/html/
[root@teacher html]# chown -R nginx.nginx *


6、Close firewalld

[root@teacher nginx]# systemctl stop firewalld
[root@teacher nginx]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.


7、configure nginx
 

[root@teacher nginx]# vim nginx.conf
location / {
root
/usr/share/zabbix;
}
location ~ "\.php$" {
fastcgi_pass 10.18.42.251:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/zabbix/$fastcgi_script_name;
include fastcgi_params;
}
[root@teacher nginx]# systemctl restart nginx



 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值