zabbix 3.0离线安装手册(其他版本同样适用)

zabbix 3.0离线安装手册

一.环境介绍

操作系统:CentOS-7-x86_64-Minimal-1511.iso
最小化安装,语言选择英文
iso下载地址:http://mirrors.163.com/centos/7.2.1511/isos/x86_64/CentOS-7-x86_64-Minimal-1511.iso
zabbix:zabbix 3.0.2
rpm包下载地址:http://dl.cactifans.org/zabbix/mysql.tar.gz
http://dl.cactifans.org/zabbix/rpm.tar.gz
安装方式:rpm包安装

二.安装依赖包

由于使用离线安装方式,因此通过rpm包安装所有依赖包。

1.设置基本环境

关闭selinux

<figure class="highlight plain">

|

<pre>

vi /etc/sysconfig/selinux
把SELINUX=enforcing改为SELINUX=disabled

保存并退出,执行

设置好并重启服务器

2.安装数据库

centos7 采用mariadb 数据库(mysql分支)
mysql.tar.gz 上传到服务器,并解压

tar zxvf mysql.tar.gz

cd mysql

rpm -Uvh mariadb-libs-5.5.47-1.el7_2.x86_64.rpm

升级默认的mariadb客户端包
安装mariadb

rpm -ivh mariadb-5.5.47-1.el7_2.x86_64.rpm \

mariadb-server-5.5.47-1.el7_2.x86_64.rpm \

perl-5.16.3-286.el7.x86_64.rpm \

perl-Carp-1.26-244.el7.noarch.rpm \

perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64.rpm \

perl-Compress-Raw-Zlib-2.061-4.el7.x86_64.rpm \

perl-constant-1.27-2.el7.noarch.rpm \

perl-Data-Dumper-2.145-3.el7.x86_64.rpm \

perl-DBD-MySQL-4.023-5.el7.x86_64.rpm \

perl-DBI-1.627-4.el7.x86_64.rpm \

perl-Encode-2.51-7.el7.x86_64.rpm \

perl-Exporter-5.68-3.el7.noarch.rpm \

perl-File-Path-2.09-2.el7.noarch.rpm \

perl-File-Temp-0.23.01-3.el7.noarch.rpm \

perl-Filter-1.49-3.el7.x86_64.rpm \

perl-Getopt-Long-2.40-2.el7.noarch.rpm \

perl-HTTP-Tiny-0.033-3.el7.noarch.rpm \

perl-IO-Compress-2.061-2.el7.noarch.rpm \

perl-libs-5.16.3-286.el7.x86_64.rpm \

perl-macros-5.16.3-286.el7.x86_64.rpm \

perl-Net-Daemon-0.48-5.el7.noarch.rpm \

perl-parent-0.225-244.el7.noarch.rpm \

perl-PathTools-3.40-5.el7.x86_64.rpm \

perl-PlRPC-0.2020-14.el7.noarch.rpm \

perl-Pod-Escapes-1.04-286.el7.noarch.rpm \

perl-podlators-2.5.1-3.el7.noarch.rpm \

perl-Pod-Perldoc-3.20-4.el7.noarch.rpm \

perl-Pod-Simple-3.28-4.el7.noarch.rpm \

perl-Pod-Usage-1.63-3.el7.noarch.rpm \

perl-Scalar-List-Utils-1.27-248.el7.x86_64.rpm \

perl-Socket-2.010-3.el7.x86_64.rpm \

perl-Storable-2.45-3.el7.x86_64.rpm \

perl-Text-ParseWords-3.29-4.el7.noarch.rpm \

perl-threads-1.87-4.el7.x86_64.rpm \

perl-threads-shared-1.43-6.el7.x86_64.rpm \

perl-Time-HiRes-1.9725-3.el7.x86_64.rpm \

perl-Time-Local-1.2300-2.el7.noarch.rpm

注意是直接复制执行,就会安装mariadb

3.设置mariadb

设置开机启动

systemctl enable mariadb

修改数据库编码

[mysqld] 段加入如下

character-set-server=utf8

max_connections = 10000

完整的my.cnf内容如下

[mysqld]

datadir=/var/lib/mysql

socket=/var/lib/mysql/mysql.sock

#Disabling symbolic-links is recommended to prevent assorted security risks

symbolic-links=0

#Settings user and group are ignored when systemd is used.

If you need to run mysqld under a different user or group,

#customize your systemd unit file for mariadb according to the

instructions in http://fedoraproject.org/wiki/Systemd

character-set-server=utf8

max_connections = 10000

[mysqld_safe]

log-error=/var/log/mariadb/mariadb.log

pid-file=/var/run/mariadb/mariadb.pid

include all files from the config directory

!includedir /etc/my.cnf.d

启动mariadb数据库

systemctl start mariadb

设置mariadb,执行

mysql_secure_installation

这里可以设置root密码,我们设置为123456 ,具体过程

[root@localhost mysql]# mysql_secure_installation

/usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not found

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

New password:

Re-enter new password:

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

... 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

... 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

  • 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

... 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!

4.创建zabbix数据库

mysql -uroot -p123456

create database zabbix;

grant all on zabbix.* to zabbix@localhost identified by 'zabbixpwd123';

flush privileges;

exit;

这里我们创建了zabbix 数据库,并且建立了一个用户zabbix,密码为zabbixpwd123,并把zabbix授权给zabbix用户

二.安装zabbix

1.安装软件包

把rpm.tar.gz 上传到服务器,并解压

tar zxvf rpm.tar.gz

cd rpm

rpm -ivh apr-1.4.8-3.el7.x86_64.rpm \

apr-util-1.5.2-6.el7.x86_64.rpm \

dejavu-fonts-common-2.33-6.el7.noarch.rpm \

dejavu-sans-fonts-2.33-6.el7.noarch.rpm \

fontpackages-filesystem-1.44-8.el7.noarch.rpm \

fping-3.10-1.el7.x86_64.rpm \

httpd-2.4.6-40.el7.centos.1.x86_64.rpm \

httpd-tools-2.4.6-40.el7.centos.1.x86_64.rpm \

iksemel-1.4-2.el7.centos.x86_64.rpm \

libjpeg-turbo-1.2.90-5.el7.x86_64.rpm \

libpng-1.5.13-7.el7_2.x86_64.rpm \

libtool-ltdl-2.4.2-21.el7_2.x86_64.rpm \

libX11-1.6.3-2.el7.x86_64.rpm \

libX11-common-1.6.3-2.el7.noarch.rpm \

libXau-1.0.8-2.1.el7.x86_64.rpm \

libxcb-1.11-4.el7.x86_64.rpm \

libXpm-3.5.11-3.el7.x86_64.rpm \

libxslt-1.1.28-5.el7.x86_64.rpm \

libzip-0.10.1-8.el7.x86_64.rpm \

mailcap-2.1.41-2.el7.noarch.rpm \

net-snmp-libs-5.7.2-24.el7_2.1.x86_64.rpm \

OpenIPMI-libs-2.0.19-11.el7.x86_64.rpm \

OpenIPMI-modalias-2.0.19-11.el7.x86_64.rpm \

php-5.4.16-36.1.el7_2.1.x86_64.rpm \

php-bcmath-5.4.16-36.1.el7_2.1.x86_64.rpm \

php-cli-5.4.16-36.1.el7_2.1.x86_64.rpm \

php-common-5.4.16-36.1.el7_2.1.x86_64.rpm \

php-gd-5.4.16-36.1.el7_2.1.x86_64.rpm \

php-ldap-5.4.16-36.1.el7_2.1.x86_64.rpm \

php-mbstring-5.4.16-36.1.el7_2.1.x86_64.rpm \

php-mysql-5.4.16-36.1.el7_2.1.x86_64.rpm \

php-pdo-5.4.16-36.1.el7_2.1.x86_64.rpm \

php-xml-5.4.16-36.1.el7_2.1.x86_64.rpm \

t1lib-5.1.2-14.el7.x86_64.rpm \

unixODBC-2.3.1-11.el7.x86_64.rpm \

zabbix-agent-3.0.2-1.el7.x86_64.rpm \

zabbix-server-mysql-3.0.2-1.el7.x86_64.rpm \

zabbix-web-3.0.2-1.el7.noarch.rpm \

zabbix-web-mysql-3.0.2-1.el7.noarch.rpm

启动httpd

systemctl enable httpd

systemctl start httpd

设置php.ini参数

vi /etc/php.ini

修改如下参数,并保存
max_execution_time = 300

max_input_time = 300

post_max_size = 16M

date.timezone = Asia/Shanghai

设置好之后重启httpd服务

systemctl restart httpd

导入数据库

cd /usr/share/doc/zabbix-server-mysql-3.0.2

zcat create.sql.gz | mysql -uroot -p123456 zabbix

2.web页面初始化

浏览器打开http://ip/zabbix (推荐使用chrome浏览器)就可以看到zabbix 安装的web页面
点击Next step

1

检查每个选项是不是ok,查看页面都是ok,直接点Next step
2

输入zabbix数据库密码,别的都不用改(zabbix数据库的密码为zabbixpwd123,前面设置的)
3

直接点Next step,不用修改默认就成
4

这里概显示了设置,确认无误,直接点Next step
5

点击Finish完成web页面初始化
6

登录zabbix,默认的用户名为admin,密码为zabbix
7

3.zabbix服务初始化

修改zabbix server配置文件

vi /etc/zabbix/zabbix_server.conf

修改以下选项

DBPassword=zabbixpwd123

启动zabbix server,并设置开机启动

systemctl start zabbix-server

systemctl enable zabbix-server

启动zabbix agent,并设置开机启动

systemctl start zabbix-agent

systemctl enable zabbix-agent

再次查看zabbix web页面,显示zabbix server 已处于运行状态

8

在web页面启用zabbix server自己的监控,依次点击Congfiguration——>Hosts,点击zabbix server后面的Disabled,启用zabbix server主机的自身监控

4.问题诊断

可通过命令查看zabbix server和zabbix agent的日志,查看错误,根据错误解决问题
zabbix server日志

tail -f /var/log/zabbix/zabbix_server.log

zabbix agent 日志

tail -f /var/log/zabbix/zabbix_agentd.log

---转自当代张思德博客

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 206,126评论 6 481
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 88,254评论 2 382
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 152,445评论 0 341
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 55,185评论 1 278
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 64,178评论 5 371
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,970评论 1 284
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,276评论 3 399
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,927评论 0 259
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 43,400评论 1 300
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,883评论 2 323
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,997评论 1 333
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,646评论 4 322
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,213评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 30,204评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,423评论 1 260
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 45,423评论 2 352
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,722评论 2 345

推荐阅读更多精彩内容