zabbix部署

zabbix编译安装

系统环境:centos7
安装包版本:mysql5.7 zabbix4.0.1 php5.4

1.mysql安装

#我这里采用yum安装mysql5.7
#安装rpm源
rpm -ivh https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
#安装mysql
yum install -y mysql-server mysql mysql-deve
/bin/systemctl enable  mysqld.service
/bin/systemctl start  mysqld.service
#修改初始密码的步骤省略

2.安装zabbix

#创建数据库账号
mysql -uroot -p密码
create database zabbix character set utf8 collate utf8_bin;
grant all privileges on zabbix.* to zabbix@localhost identified by '密码';

#下载zabbix
wget https://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/4.0.1/zabbix-4.0.1.tar.gz/download
mv download zabbix-4.0.1.tar.gz
#创建zabbix用户组,不能用root用户
groupadd zabbix
useradd -g zabbix zabbix
#导入数据
cd database/mysql
mysql -uzabbix -p密码 zabbix < schema.sql
mysql -uzabbix -p密码 zabbix < images.sql
mysql -uzabbix -p密码 zabbix < data.sql
#编译
yum install zlib-devel libxml2-devel net-snmp-devel libevent-devel curl-devel pcre
yum install pcre-devel

cd zabbix-4.0.1
./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2

#如果报错zabbix_server: error while loading shared libraries: libmysqlclient.so.20: cannot open shared object file: No such file or directory
#执行入下操作
#ln -s /usr/local/mysql/lib/libmysqlclient.so.20  /usr/lib/
#执行配置
#ldconfig

make install

#修改配置文件
vim /usr/local/etc/zabbix_server.conf
#修改mysql配置
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=mysql密码
#mysql.sock所在位置
DBSocket=/var/lib/mysql/mysql.sock

#启动zabbix
zabbix_server
zabbix_agentd
#查看是否成功
ps aux | grep zabbix

安装界面

#安装apache
yum install -y httpd
systemctl enable httpd
systemctl start httpd
#安装php
yum install -y php php-mysql
#cp文件
cd frontends/php
cp -r * /var/www/html/
/bin/systemctl restart httpd.service

进入http://ip/index.php即可

你可能感兴趣的:(技术运维)