CentOS 6.5 Zabbix-server安装
安装
配置前先关闭iptables和SELINUX,避免安装过程中报错
service iptables stop
3,禁用SELINUX
# vi /etc/selinux/config
SELINUX=disabled
让SELINUX生效
#setenforce 0
4,修改主机名
# vi /etc/sysconfig/network
HOSTNAME=hqzabbix
# vi /etc/hosts
10.117.180.37 hqzabbix
121.41.113.14 hqzabbix
6,yum安装
#rpm -ivh http://repo.zabbix.com/zabbix/2.4/rhel/6/x86_64/zabbix-release-2.4-1.el6.noarch.rpm
yum install MysqL -y
yum install MysqL-server -y
yum install PHP -y
yum install PHP-gd -y
yum install PHP-xmlwriter -y
yum install PHP-bcmath -y
yum install PHP-mbstring -y
yum install zabbix-server-MysqL -y
yum install zabbix-agent -y
yum install zabbix-server -y
yum install zabbix-web-MysqL -y
启动数据库
# /etc/init.d/MysqLd start 或者使用service MysqLd start启动。
创建用户
# MysqL -u root
MysqL> create database hqzabbix character set utf8 collate utf8_bin;
MysqL> grant all privileges on hqzabbix.* to hqzabbix@localhost identified by 'hqzabbix';
MysqL> \q
导入建表语句
# cd /usr/share/doc/zabbix-server-MysqL-2.4.8/create
# chmod 775 * //设置权限
# MysqL -uroot hqzabbix < schema.sql
# MysqL -uroot hqzabbix < images.sql
# MysqL -uroot hqzabbix < data.sql
设置MysqL【root】密码
# MysqL -u root
MysqL> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('hqzabbix');
MysqL> \q
# vi /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=hqzabbix
DBUser=hqzabbix
DBPassword=hqzabbix
ListenIP=127.0.0.1
# vi /etc/PHP.ini
查找/; tab-width: 4
PHP_value max_execution_time 300
PHP_value memory_limit 128M
PHP_value post_max_size 16M
PHP_value upload_max_filesize 2M
PHP_value max_input_fime 300
max_execution_time = 300
max_input_time = 300
post_max_size = 32M
memory_limit = 128M
date.timezone = Asia/Shanghai
# vi /etc/httpd/conf/httpd.conf
ServerName 127.0.0.1:80
配置防火墙
# vi /etc/sysconfig/iptables
-A INPUT -m state �Cstate NEW -m tcp -p tcp �Cdport 22 -j ACCEPT
-A INPUT -m state �Cstate NEW -m tcp -p tcp �Cdport 7900 -j ACCEPT
上面的只是一个示范,一定要在dport 22下面增加
/etc/init.d/iptables restart //最后重启防火墙使配置生效
当前时间
# yum install ntpdate -y
# ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
# ntpdate us.pool.ntp.org
使用 date 查看
设置开机启动
chkconfig httpd on
chkconfig zabbix-server on
chkconfig zabbix-agent on
chkconfig MysqLd on
新建文件夹
# mkdir /var/www/html/zabbix
上传 "zabbix-2.4.6.tar.gz" 文件到/usr/local/文件夹下
# cd /usr/local
# tar -zxvf zabbix-2.4.6.tar.gz
# cp -a /usr/local/zabbix-2.4.6/frontends/PHP/* /var/www/html/zabbix/
# chown -R apache.apache /var/www/html/zabbix/
启动服务
# /etc/init.d/zabbix-server start
# /etc/init.d/httpd start
重启
# reboot
打开网页
172.16.1.247/zabbix
看见启动后的界面点击 next ==> OK了点击next输入MysqL用户名密码
database name hqzabbix
user hqzabbix
password hqzabbix
验证OK后再点击next==> next==> next==> Finish
默认账户密码 Admin/zabbix
汉化
登陆后点击右上角的Profile==> Language选择Chinese(zh_CN)Update
解决乱码
把windows下的simkai.ttf 上传到zabbix服务器。
windows字体路径C:\Windows\Fonts找到中文包(楷体 常规)复制到桌面
查找zabbix使用的语言包
find / -name *font* -print | grep zabbix
/usr/share/zabbix/fonts
把simkai.ttf上传到这个目录下
# vi /usr/share/zabbix/include/defines.inc.PHP
//define('ZBX_FONT_NAME','DejaVuSans');
define('ZBX_FONT_NAME','simkai');
//define('ZBX_GRAPH_FONT_NAME','DejaVuSans');
define('ZBX_GRAPH_FONT_NAME', 'simkai');
find / -name 'graphfont'
刷新网页还是乱码
# vi /etc/my.cnf
default-character-set = utf8
查看服务端口,没有80,Nginx没有启动
netstat -ant -p
添加服务端口【如果有就不需要加了】
vim /etc/services
zabbix-agent 10050/tcp # Zabbix Agent
zabbix-agent 10050/udp # Zabbix Agent
zabbix-trapper 10051/tcp # Zabbix Trapper
zabbix-trapper 10051/udp # Zabbix Trapper
zabbix-agent 10161/udp # Zabbix Agent
zabbix-trapper 10161/tcp # Zabbix Trapper
看日志
vi /etc/zabbix/zabbix_server.conf
vi /var/log/zabbix/zabbix_server.log
vi /etc/httpd/conf/httpd.conf
vi /var/log/httpd/error_log
查找
find / -name my.cnf
原文链接:https://www.f2er.com/centos/378269.html