首先,准备好前期环境,搭建LAMP,也可以使用yum安装:
[[email protected] ~]#yum install make mysql-server httpd php mysql-devel gcc net-snmp-devel curl-devel perl-DBI php-gd php-mysql php-bcmath php-mbstring php-xml unixODBC-devel OpenIPMI-devel libxml2-devel
启动httpd,mysql:
# service httpd start # service mysqld start
安装Zabbix:
1,创建zabbix用户:
[[email protected] ~]# useradd zabbix -s /sbin/nologin
2,mysql中创建zabbix数据库,数据库名zabbix,用户zabbix,密码zabbix,并给用户授权:
mysql> create database zabbix default charset utf8; Query OK, 1 row affected (0.02 sec) mysql> grant all on zabbix.* to [email protected] identified by ‘zabbix‘; Query OK, 0 rows affected (0.00 sec) mysql> flush privileges; Query OK, 0 rows affected (0.00 sec)
3,下载zabbix,并且导入数据库:
[[email protected] ~]# cd /usr/local/src/ [[email protected] src]# wget "http://downloads.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.2.2/zabbix-2.2.2.tar.gz?r=http%3A%2F%2Fwww.zabbix.com%2Fdownload.php&ts=1395066528&use_mirror=jaist" [[email protected] src]# tar xvzf zabbix-2.2.2.tar.gz [[email protected] src]# cd zabbix-2.2.2/database/mysql/ [[email protected] mysql]# mysql -uzabbix -pzabbix zabbix < schema.sql [[email protected] mysql]# mysql -uzabbix -pzabbix zabbix < images.sql [[email protected] mysql]# mysql -uzabbix -pzabbix zabbix < data.sql
4,编译安装zabbix:
[[email protected] zabbix-2.2.2]# ./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2 --with-openipmi --with-unixodbc [[email protected] zabbix-2.2.2]# make && make install
5,编辑Apache的httpd.conf文件,使其支持index.php
[[email protected] zabbix-2.2.2]# vim /etc/httpd/conf/httpd.conf DirectoryIndex index.php index.html index.html.var
6,修改zabbix_server配置文件
[[email protected] zabbix-2.2.2]# vim /usr/local/zabbix/etc/zabbix_server.conf DBName=zabbix DBUser=zabbix DBPassword=zabbix DBPort=3306
7,复制启动脚本并修改路径
[[email protected] zabbix-2.2.2]# cp misc/init.d/fedora/core5/zabbix_server /etc/init.d/ [[email protected] zabbix-2.2.2]# cp misc/init.d/fedora/core5/zabbix_agentd /etc/init.d/ 修改脚本中路径: [[email protected] zabbix-2.2.2]# vim /etc/init.d/zabbix_server ZABBIX_BIN="/usr/local/zabbix/sbin/zabbix_server" [[email protected] zabbix-2.2.2]# vim /etc/init.d/zabbix_agentd ZABBIX_BIN="/usr/local/zabbix/sbin/zabbix_agentd"
8,修改php.ini文件支持大小
[[email protected] zabbix-2.2.2]# vim /etc/php.ini max_execution_time = 300 max_input_time = 300 date.timezone =Asia/Shanghai post_max_size = 32M
重启httpd是php配置生效:
[[email protected] zabbix-2.2.2]# service httpd restart Stopping httpd: [ OK ] Starting httpd: [ OK ]
9,复制zabbix的php项目到http目录下,并且给权限
[[email protected] zabbix-2.2.2]# cp -r frontends/php /var/www/html/zabbix [[email protected] zabbix-2.2.2]# chown -R apache.apache /var/www/html/zabbix/
10,将zabbix,httpd,mysql加入到开机启动,并且启动zabbix [[email protected] zabbix-2.2.2]# chkconfig httpd on [[email protected] zabbix-2.2.2]# chkconfig mysqld on [[email protected] zabbix-2.2.2]# chkconfig zabbix_server on [[email protected] zabbix-2.2.2]# chkconfig zabbix_agentd on [[email protected] zabbix-2.2.2]# /etc/init.d/zabbix_server start Starting Zabbix Server: [ OK ] [[email protected] zabbix-2.2.2]# /etc/init.d/zabbix_agentd start Starting Zabbix Agent: [ OK ]
11,浏览器访问http://ip/zabbix 默认下一步
条件检测,必选满足所有条件才可以:
填写数据库信息,并且测试连接,连接ok就下一步
接下来就一直默认,然后下一步,到最后安装完成
安装完成之后,转到登陆界面,登陆zabbix,默认用户名:Admin,密码:zabbix
登陆后界面
zabbix汉化方法:
zabbix安装完默认是英文,zabbix自带多种语言包,当然也包含中文,可以切换到中文语言
点击“save”,之后,界面会显示中文。
虽然整个界面是中文,但是图形的中文会出现乱码,因为zabbix使用DejaVuSan.ttf字体,不支持中文,导致中文出现乱码。解决方法很简单,把我们电脑里面字体文件传到zabbix服务器上
找到本地C:\Windows\Fonts\simkai.ttf(楷体)上传到服务器zabbix网站目录fonts目录下。
[[email protected] fonts]# ls DejaVuSans.ttf simkai.ttf
将simkai.ttf重名名为DejaVuSans.ttf覆盖之前的DejaVuSans.ttf
[[email protected] fonts]# mv simkai.ttf DejaVuSans.ttf
到此,汉化结束。
agent客户端安装步骤
客户端不需要LAMP环境,直接安装就可以
1,创建zabbix用户:
[[email protected] ~]# useradd zabbix -s /sbin/nologin
2,编译安装zabbix_agent:
[[email protected] zabbix-2.2.2]# ./configure --with-net-snmp --with-libcurl --enable-agent --prefix=/usr/local/zabbix [[email protected] zabbix-2.2.2]# make && make install
3,复制启动脚本并修改路径
[[email protected] zabbix-2.2.2]# cp misc/init.d/fedora/core5/zabbix_agentd /etc/init.d/ 修改脚本中路径: [[email protected] zabbix-2.2.2]# vim /etc/init.d/zabbix_agentd ZABBIX_BIN="/usr/local/zabbix/sbin/zabbix_agentd"
4,修改zabbix的配置文件
[[email protected] zabbix-2.2.2]# vim /usr/local/zabbix/etc/zabbix_agentd.conf Server=192.168.217.132 Hostname=linux test server
完成后保存退出。
5,启动zabbix_agent
[[email protected] zabbix-2.2.2]# /etc/init.d/zabbix_agentd start Starting Zabbix Agent: [ OK ]