zabbix 3.0.0beta1安装-centos6.8版本

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了zabbix 3.0.0beta1安装-centos6.8版本相关的知识,希望对你有一定的参考价值。

zabbix 3.0安装

zabbix最低需要mysql 5.5 php5.3

查询mysql版本
yum list installed | grep mysql
##mysql-libs.x86_64 5.1.73-5.el6_6 @anaconda-CentOS-201508042137.x86_64/6.7

卸载mysql
yum remove mysql*

指定mysql源
rpm -ivh http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm

安装mysql
yum install mysql-server

安装vim 文本编辑器
yum install vim -y

修改mysql配置
vim /etc/my.cnf

[mysqld]
innodb_file_per_table

启动mysql服务
service mysqld start

更新配置
mysql_secure_installation
Enter current password for root (enter for none):

Set root password? [Y/n]

Remove anonymous users? [Y/n]

Disallow root login remotely? [Y/n]

Remove test database and access to it? [Y/n]

Reload privilege tables now? [Y/n]

登陆mysql数据库
mysql -u root -p

创建zabbix的数据库
CREATE DATABASE zabbix CHARACTER SET utf8 COLLATE utf8_bin;
授权zabbix系统访问Mysql数据库的用户和密码:
GRANT ALL PRIVILEGES ON zabbix.* TO [email protected] IDENTIFIED BY ‘zabbix‘;

查询数据库信息
mysql> show databases;
+--------------------+
Database
+--------------------+
information_schema
mysql
performance_schema
zabbix
+--------------------+
4 rows in set (0.00 sec)
If everything is fine then exit the database for now.

exit

Zabbix 3.0 requires PHP to be at least version 5.4 or higher. Our CentOS 6.7 repositories come with PHP 5.3.3 therefore we need to install a newer one.

指定zabbix源
rpm -ivh http://repo.webtatic.com/yum/el6/latest.rpm

安装php等支持库
yum install httpd php56w php56w-gd php56w-mysql php56w-bcmath php56w-mbstring php56w-xml php56w-ldap

编辑php配置
vim /etc/php.ini
post_max_size=16M
max_execution_time=300
max_input_time=300
date.timezone=Europe/Riga
always_populate_raw_post_data=-1

启动Apache服务
service httpd start

防火墙放行80端口
iptables -I INPUT -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables-save > /etc/sysconfig/iptables
查询防火墙
ip a

创建zabbix用户
groupadd zabbix
useradd -g zabbix zabbix

创建zabbix下载路径并进入
mkdir /home/zabbix/downloads
cd /home/zabbix/downloads

安装 wget下载工具
yum install wget -y

下载zabbix3.0gz包
wget "https://sourceforge.net/projects/zabbix/files/ZABBIX Latest Development/3.0.0beta1/zabbix-3.0.0beta1.tar.gz"
wget "https://sourceforge.net/projects/zabbix/files/ZABBIX Latest Development/3.0.0alpha2/zabbix-3.0.0alpha2.tar.gz"
解压
tar -zxvf zabbix-3.0.0beta1.tar.gz

导入数据库
cd /home/zabbix/downloads/zabbix-3.0.0beta1/database/mysql
mysql -u zabbix -p zabbix < schema.sql
mysql -u zabbix -p zabbix < images.sql
mysql -u zabbix -p zabbix < data.sql

安装依赖库
yum install gcc mysql-community-devel libxml2-devel unixODBC-devel net-snmp-devel libcurl-devel libssh2-devel OpenIPMI-devel openssl-devel openldap-devel

cd ../..
查看编译帮助
./configure --help
Configure all components required for Zabbix.
编译
./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2 --with-unixodbc --with-ssh2 --with-openipmi --with-openssl
安装zabbix
make install

配置zabbix-server
vim /usr/local/etc/zabbix_server.conf

DBName=zabbix
DBUser=zabbix
DBPassword=your_password

创建服务路径
mkdir /var/www/html/zabbix
cd /home/zabbix/downloads/zabbix-3.0.0beta1/frontends/php/

cp -a . /var/www/html/zabbix/

创建规则,以允许我们的Web服务器来访问前端文件。
chcon -Rv --type=httpd_sys_content_t /var/www/html

selinux未关闭赋予权限
setsebool -P httpd_can_network_connect=1
setsebool -P zabbix_can_network=1
Set Apache user as owner of the web interface files.

赋予权限
chown -R apache:apache /var/www/html/zabbix
chmod +x /var/www/html/zabbix/conf/

拷贝数据
cp /home/zabbix/downloads/zabbix-3.0.0beta1/misc/init.d/fedora/core/zabbix_server /etc/init.d/zabbix_server
cp /home/zabbix/downloads/zabbix-3.0.0beta1/misc/init.d/fedora/core/zabbix_agentd /etc/init.d/zabbix_agentd
Add Zabbix server and Zabbix agent as services.

自启动
chkconfig --add /etc/init.d/zabbix_server
chkconfig --add /etc/init.d/zabbix_agentd
chkconfig httpd on
chkconfig mysqld on
chkconfig zabbix_server on
chkconfig zabbix_agentd on

启动服务
service zabbix_server start
service zabbix_agentd start

#####修改中文支持

开启中文支持
locales.inc.php
‘zhCN‘ => [‘name‘ => (‘Chinese (zh_CN)‘), ‘display‘ => true]

解决中文乱码
defines.inc.php
#修改第93行
define(‘ZBX_FONT_NAME‘, ‘msyh‘);
#修改第45行改为
define(‘ZBX_GRAPH_FONT_NAME‘, ‘msyh‘)

以上是关于zabbix 3.0.0beta1安装-centos6.8版本的主要内容,如果未能解决你的问题,请参考以下文章

hadoop-3.0.0-beta1运维手册(002):安装Guest操作系统

zabbix客户端安装

hadoop-3.0.0-beta1运维手册(003):安装全分布式HDFS3.0.0-准备软件

hadoop-3.0.0-beta1运维手册(004):安装分布式hdfs3.0.0-配置JDK

Zabbix安装部署六————监控nginx

hadoop-3.0.0-beta1运维手册(001):定制虚拟机