zabbix-server3.4搭建历史记录

zabbix-server3.4搭建历史记录

作者:蓝眼泪

实验环境:vm15虚拟机,win7旗舰版,xshell7,xftp7,cenos7.9。
具体操作过程如下:

第一步,关闭防火墙和selinux

cd /usr/local
service iptables stop
chkconfig iptables off
iptables -F
vim /etc/selinux/config

第二步,设置主机名

hostnamectl set-hostname zabbix-server
hostname
uname -a
cat /etc/redhat-release #查看centos版本

第三步,安装apache

sudo yum install -y httpd
sudo rpm -qa|grep httpd
sudo systemctl enable httpd.service
sudo systemctl start httpd
sudo systemctl status httpd.service
sudo lsof -i:80

第四步,安装mariadb数据库

sudo yum install -y mariadb mariadb-server
sudo rpm -qa mariadb
sudo rpm -qa mariadb-server
sudo systemctl enable mariadb.service
sudo systemctl start mariadb.service
sudo lsof -i:3306
mysql

第五步,安装php软件

sudo yum install -y php php-mysql
sudo rpm -qa|grep php

第六步,安装zabbix-server和zabbix-agent

mkdir /home/tools
cd /home/tools/
sudo wget http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
sudo yum install -y zabbix-release-3.4-2.el7.noarch.rpm
rpm -qa |grep zabbix
sudo rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
yum install zabbix-get
yum install -y zabbix-server-mysql zabbix-get zabbix-web zabbix-web-mysql zabbix-agent zabbix-sender
sudo rpm -qa zabbix-server-mysql zabbix-get zabbix-web zabbix-web-mysql zabbix-agent zabbix-sender

第七步,数据初始化和导入数据。

mysql -uroot -p
create database zabbix character set utf8 collate utf8_bin;
create user zabbix@localhost identified by ‘password’;
grant all privileges on zabbix.* to zabbix@localhost;
sudo rpm -qa zabbix-server-mysql
cd /usr/share/doc/zabbix-server-mysql-3.4.15
gunzip create.sql.gz
mysql -uzabbix -p

第八步,启动zabbix-server和zabbix-agent服务

cd /etc/zabbix
sudo vim zabbix_server.conf
sudo systemctl enable zabbix-server.service
sudo systemctl start zabbix-server.service
sudo ps -ef |grep zabbix_server

第九步,编辑zabbix-server前端参数,并设置时区

cd /etc/httpd/conf.d
vim /etc/httpd/conf.d/zabbix.conf
cat /etc/httpd/conf.d/zabbix.conf
sudo systemctl restart httpd.service

第十步,拷贝字体,解决乱码问题

cd /usr/share/zabbix/fonts
sudo cp graphfont.ttf graphfont.ttf_bak
sudo rz -y
mv simhei.ttf graphfont.ttf
sudo systemctl restart zabbix-agent.service
cat /etc/httpd/conf.d/welcome.conf
cd /var/www/html/
cp -r /home/upload/* /var/www/html/
chmod -R 777 /var/www/html/*
service httpd restart
cat /etc/httpd/conf.d/welcome.conf
cp -r /usr/share/httpd/noindex/* /var/www/html/
chmod -R 777 /var/www/html/*
service httpd restart
cd /etc/httpd
 ./run
cd /run
service network restart
systemctl enable network

注意事项:

1.编辑yum源

vim /etc/yum.repos.d/zabbix.repo

2.mysql数据库初始密码获取

grep password /var/log/mysqld.log

mysql_secure_installation y y n y y

3.mysql数据导入数据库命令

create database zabbix character set utf8 collate utf8_bin;
create user zabbix@localhost identified by ‘password’;
grant all privileges on zabbix.* to zabbix@localhost;
flush privileges;
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p"password" zabbix

猜你喜欢

转载自blog.csdn.net/qq_31086997/article/details/114262977
今日推荐