CENTOS7.4安装zabbix3.4 成功安装的办法
原创
©著作权归作者所有:来自51CTO博客作者xcagy的原创作品,请联系作者获取转载授权,否则将追究法律责任
1 vim /etc/ssh/sshd_config
2 Z
3 service sshd restart
4 ifconfig
5 reboot
6 sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
7 sed -i 's/SELINUXTYPE=targeted/#&/' /etc/selinux/config
8 setenforce 0
9 systemctl stop iptables.service
10 systemctl stop firewalld.service
11 reboot
12 localedef -c -f UTF-8 -i zh_CN zh_CN.UTF-8
13 export LC_ALL=zh_CN.UTF-8
14 echo 'LANG=zh_CN.UTF-8' > /etc/locale.conf
15 yum -y install mariadb mariadb-devel mariadb-server
16 systemctl enable mariadb
17 systemctl start mariadb
18 mysqladmin -u root -h localhost password '1'
19 mysql -uroot -p 1
20 mysql -uroot -p
21 rpm -i http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
22 ls
23 yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent
24 zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p 1 zabbix ///这一招不成功,我直接把create.sql.gz 复制到windows上 远程连接mysql导入的
25 vim /etc/zabbix/zabbix_server.conf
26 vim /etc/httpd/conf.d/zabbix.conf
27 systemctl restart zabbix-server zabbix-agent httpd
28 journalctl -xe
29 systemctl restart zabbix-server
30 systemctl restart zabbix-agent httpd
31 systemctl enable zabbix-server zabbix-agent httpd
32 netstat -ntlp
33 curl 127.0.0.1
34 systemctl disable firewalld.service
35 firewall-cmd --state
36 systemctl stop firewalld.service
37 mysql -u root
38 1
39 mysql -uroot -p
40 mysql -uroot -p 1
41 mysql -uroot -p
42 flush privileges;
43 chkconfig --list | grep -i mysql
44 service mysql stop
45 service mysql start
46 systemctl restart mariadb
47 mysql -uroot -p1
48 mysql -uroot -p
49 vim /etc/my.cnf
50 systemctl restart mariadb
51 mysql
52 vim /etc/zabbix/zabbix_server.conf
53 zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p 123 zabbix
54 cd /usr/share/doc/zabbix-server-mysql*/
55 ls
56 zcat create.sql.gz |mysql -uroot zabbix -p
57 zcat create.sql.gz |mysql -uroot
58 zcat create.sql.gz |mysql -uroot zabbix
59 ll
60 netstat -ntlp
61 reboot
62 netstat -ntlp
63 history
3.安装配置zabbix
#安装 MySQL
本教程使用 Mysql 作为数据库,如果不使用 Mysql 可以跳过相关 Mysql 安装和配置
$ yum -y install mariadb mariadb-devel mariadb-server # centos7下安装的是mariadb
$ systemctl enable mariadb
$ systemctl start mariadb
#设置mysql的root密码
$ mysqladmin -u root -h localhost password 'xxxxxxxx'
#创建数据库 zabbix 并授权
$ mysql -uroot -pxxxxxx
> create database zabbix character set utf8 collate utf8_bin;
> grant all privileges on zabbix.* to zabbix@localhost identified by 'xxxxxxxx';
> quit
#安装zabbix-server、zabbix-agent及相关组件
$ rpm -i http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
$ yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent
#导入zabbix初始化数据
$ zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -pxxxxxxxx zabbix
#修改zabbix-server配置文件
$ vim /etc/zabbix/zabbix_server.conf
修改连接数据库的配置
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=xxxxxxxx
#修改PHP时区
$ vim /etc/httpd/conf.d/zabbix.conf
将下面这行修改为亚洲上海
php_value date.timezone Asia/Shanghai
#启动zabbix-server、zabbix-agent、httpd
$ systemctl restart zabbix-server zabbix-agent httpd
$ systemctl enable zabbix-server zabbix-agent httpd
4.配置zabbix前端
打开浏览器,访问http://192.168.2.205/zabbix,会看到如下页面