今天用centos7安装zabbix 我用的是虚拟机,怎么用虚拟机整centos系统,之前演示过(和Linux一样的,就是镜像不一样) 记住:一定要用NAT模式
用虚拟机的centos系统时,网络适配器一定要用NAT(与主机共享网络)
vim /etc/sysconfig/network-scripts/ifcfg-(网卡名)修改此文件,ens33是我的网卡名字,可ifconfig查看
改为dhcp,最后改为yes
重启网卡 systemctl restart network
ifconfig查看
知道ip 就可以用远程软件连接了,也可以不连(我是用xshell)
关闭防火墙
[[email protected] ~]# systemctl stop firewalld.service
[[email protected] ~]# systemctl disable firewalld.service
关闭selinux
[[email protected] ~]# vim /etc/selinux/config 或[[email protected] ~]# vim /etc/sysconfig/selinux
SELINUX=后面改为disabled
安装环境(lamp)
安装Apache
[[email protected] ~]# yum -y install http*
开启服务,下次开机自动开启
[[email protected] ~]# systemctl restart httpd.service
[[email protected] ~]# systemctl enable httpd.service
安装MySQL
MySQL要钱的,我们安装mariadb
[[email protected] ~]# yum -y install mariadb*
开启服务,下次开机自动开启
[[email protected] ~]# systemctl restart mariadb.service
[[email protected] ~]# systemctl enable mariadb.service
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
检查是否安装成功 exit退出
安装PHP
[[email protected] ~]# yum -y install php*
安装zabbix包,先下载(也可以直接复制我下面的链接)
可以用谷歌或火狐浏览http://mirrors.aliyun.com
不同版本
我选4.1—rhel—7—x86 64(我创建的系统是64位的)
右键复制链接地址
rpm -ivh https://mirrors.aliyun.com/zabbix/zabbix/4.1/rhel/7/x86_64/zabbix-release-4.1-1.el7.noarch.rpm
安装zabbix包
[[email protected] ~]# yum install -y zabbix-server-mysql zabbix-get zabbix-web zabbix-web-mysql zabbix-agent zabbix-sender
创建一个zabbix库并设置为utf8的字符编码格式(进MySQL)
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
创建账户并且授权设置密码
MariaDB [(none)]> grant all privileges on zabbix.* to [email protected] identified by 'zabbix';
给来自loclhost的用户zabbxi分配可对数据库zabbix所有表进行所有操作的权限,并且设定密码为zabbix
退出数据库
导入表
[[email protected] ~]# cd /usr/share/doc/zabbix-server-mysql-4.2.0/
[[email protected] zabbix-server-mysql-4.2.0]# ls
解压create.sql.gz
[[email protected] zabbix-server-mysql-4.2.0]# gunzip create.sql.gz
进数据库
配置zabbix文件
开启服务,下次开机自动开启
[[email protected] mysql]# systemctl restart zabbix-server.service
[[email protected] mysql]# systemctl enable zabbix-server.service
配PHP
时间改为上海的
重启http服务
[[email protected] conf.d]# systemctl restart httpd.service
登陆zabbix网址设置(谷歌或火狐)我是用的谷歌
Ip地址/zabbix(我这是192.168.50.128/zabbix)
password是我们设置的数据库密码zabbix
登陆账户是Admin(大写A)
密码是zabbix
改中文
中文乱码解决方法
从我们电脑里面找到黑体右键复制到桌面然后拉到zabbix服务器上面
直接修改字体名字
进/usr/share/zabbix/fonts/ 把字体拉进此目录,(用连接软件方便),把原先的graphfont.ttf改成graphfont.ttf.bak 把拉进来的改为graphfont.ttf
[[email protected] conf.d]# cd /usr/share/zabbix/fonts/
[[email protected] fonts]# ls
graphfont.ttf
[[email protected] fonts]# rz -E
rz waiting to receive.
[[email protected] fonts]# ls
graphfont.ttf simhei.ttf
[[email protected] fonts]# mv graphfont.ttf graphfont.ttf.bak
[[email protected] fonts]# ls
graphfont.ttf.bak simhei.ttf
[[email protected] fonts]# mv simhei.ttf graphfont.ttf
[[email protected] fonts]# ls
graphfont.ttf graphfont.ttf.bak
[[email protected] fonts]#