一、前提条件
1.一台Centos 73的虚拟机
2.配置好和登陆用户、登陆密码
3.配置好IP地址192.168.0.45,能够上外网
[root@zabbix ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=Ethernet
BOOTPROTO=none
NAME=ens33
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.0.45
GATEWAY=192.168.0.2
PREFIX=24
DNS1=114.114.114.114
DNS2=8.8.8.8
4.配置好防火墙和selinux
systemctl stop firewalld
systemctl disable firewalld
[root@zabbix ~]# grep -v "#" /etc/selinux/config | grep -iw "selinux"
SELINUX=disable
[root@zabbix ~]# getenforce 0
Permissive
二、zabbix-server安装操作
- 安装数据库和zabbix-server
[root@zabbix ~]#rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
[root@zabbix ~]#rpm -ivh http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
[root@zabbix ~]#yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent mysql-server zabbix-get
2.启动数据库,并设置mysql密码, root密码设置为zabbix
[root@zabbix ~]#systemctl start mysqld
[root@zabbix ~]#mysql_secure_installation
3.登陆数据库,创建数据库zabbix并给授权
[root@zabbix ~]#mysql -uroot -pzabbixcreate database zabbix character set utf8 collate utf8_bin;
grant all privileges on zabbix. to zabbix@localhost identified by 'zabbix';
flush privileges;
\q
4.导入zabbix表
[root@zabbix ~]#zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -u zabbix -B zabbix -pzabbix
5.配置zabbix连接数据库
[root@zabbix ~]#vi /etc/zabbix/zabbix_server.conf
DBName=zabbix //数据库名字,默认即可
DBUser=zabbix //连接数据库的用户名,默认即可
DBPassword=zabbix //连接数据库的密码,新增此行
[root@zabbix ~]#systemctl start zabbix-server //启动zabbix-server
6.配置http
[root@zabbix ~]#vi /etc/httpd/conf.d/zabbix.conf
php_value date.timezone Asia/Shanghai //设置时区
[root@zabbix ~]#systemctl start http //启动http
7.将http、zabbix-server、mysql设置成开机自启动
[root@zabbix ~]#systemctl enable zabbix-server httpd mysqld
三、登陆测试,借用zabbix3.4的图
http://192.168.0.45/zabbix 用户名:Admin 密码:zabbix
3.1选择下一步
3.2看最后一栏,如果都是OK,则选择下一步
3.3填写数据库端口和数据库zabbix用户登陆密码,选择下一步
3.4选择下一步
3.5下一步
3.6下一步
3.7下一步
转载于:https://blog.51cto.com/14093666/2376023