一、Linxu 服务端安装(源码包安装)
server:redhat6 192.168.1.224
client:windows、redhat6 192.168.1.125 192.168.1.122
1、配置网络yum
源https://blog.csdn.net/weixin_36524613/article/details/80855481
2、安装mysql
yum-yinstall mysql mysql-server mysql-devel
MySQL 配置文件/etc/my.cnf中加入default-character-set=utf8
vim /etc/my.cnf 加入default-character-set=utf8
开启mysql服务
service mysqld start
创建 Root 管理员,设置root密码
mysqladmin-u root password 123456
登陆 MySQL
mysql-uroot-p123456
创建 zabbix 数据库,并设置登陆权限
mysql>create database zabbix character set utf8 collate utf8_bin
添加zabbix用户并设置密码和访问权限
mysql> grant all privileges on zabbix.* to zabbix@localhostidentified by 'zabbix'
如果需要本地连接数据库,添加权限
mysql>GRANT ALL PRIVILEGES ON *.* TO 'zabbix'@'192.168.0.125' IDENTIFIED BY 'zabbix'
mysql> flush privileges;
\q
3、安装zabbixserver
1)安装必要环境
yum install httpd php http-devel php-devel php-pear php-xmlrpc php-bcmath mysql-connector-odbc libdbi-dbd-mysql
httpd-manual mod_ssl mod_perl mod_auth_mysql php-gd php-xml php-mbstring php-ldap net-snmp-devel curl-devel
unixODBC-devel OpenIPMI-devel java-devel libssh2-devel openldap openldap-devel-y
2)配置php环境
sed-i"s/;date.timezone=/date.timezone=Asia\/Shanghai/g" /etc/php.ini
sed-i "s#max_execution_time = 30#max_execution_time = 300#g" /etc/php.ini
sed -i "s#post_max_size = 8M#post_max_size = 32M#g" /etc/php.ini
sed -i "s#max_input_time = 60#max_input_time = 300#g" /etc/php.ini
sed -i "s#memory_limit = 128M#memory_limit = 128M#g" /etc/php.ini
sed -i "s/;mbstring.func_overload = 0/mbstring.func_overload = 0\n/" /etc/php.ini
3)安装zabbix服务端
下载源码包,添加组。
wget
prdownloads.sourceforge.net/zabbix/zabbix-2.4.8.tar.gz
groupadd zabbix -g 201
useradd -g zabbix -u 201 -m zabbix
解压编译,要确认是否安装gcc。
yum install gcc –y
tar zxf zabbix-2.4.8.tar.gz
cd zabbix-2.4.8
./configure --prefix=/usr/local/zabbix-2.4.8--sysconfdir=/etc/zabbix--
enable-server --enable-proxy --enable-agent --
enable-ipv6 --with-mysql=/usr/bin/mysql_config --with-net-snmp --with-libcurl --with-openipmi --with-unixodbc --with-ldap
--with-ssh2 --enable-java
检查出错的话根据提示安装相应工具包。
make install
ln -s /usr/local/zabbix-2.4.8 /usr/local/zabbix
4、添加zabbix到系统服务文件
cat /etc/services |grep zabbix #可以看一眼,没有就加上,默认已经加上
zabbix-agent 10050/tcp # Zabbix Agent
zabbix-agent 10050/udp # Zabbix Agent
zabbix-trapper 10051/tcp # Zabbix Trapper
zabbix-trapper 10051/udp # Zabbix Trapper
5、向zabbix数据库导入sql文件
这个sql文件的导入顺序不能变,不然要报错。
mysql -uzabbix -pzabbix zabbix