码迷,mamicode.com
首页 > 其他好文 > 详细

zabbix 3.0.0beta1安装-centos6.8版本

时间:2018-10-15 20:27:01      阅读:169      评论:0      收藏:0      [点我收藏+]

标签:mat   iptables   collate   post   dir   ml2   init   用户   usr   

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 zabbix@localhost 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版本

标签:mat   iptables   collate   post   dir   ml2   init   用户   usr   

原文地址:http://blog.51cto.com/jiafm/2300020

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!