Centos 7.0 zabbix 部署
1、lamp 环境搭建
初次安装可以先关闭selinux 和 firewall
[root@localhost ~]# setenforce 0 [root@localhost ~]# systemctl stop firewalld.service
1.1 mariadb数据库安装,启动、加入启动项
[root@localhost ~]# yum install mariadb-* [root@localhost ~]# systemctl start mariadb.service [root@localhost ~]# systemctl status mariadb.service ● mariadb.service - mariadb database server loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled) active: active (running) since 日 2019-02-24 11:10:49 cst; 16s ago
[root@localhost ~]# systemctl enable httpd.service
1.2 apache安装安装、启动、加入启动项
[root@localhost ~]# yum install httpd.x86_64 root@localhost ~]# systemctl start httpd.service [root@localhost ~]# systemctl status httpd.service ● httpd.service - the apache http server loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled) active: active (running) since 日 2019-02-24 11:19:16 cst; 5s ago [root@localhost ~]# systemctl enable httpd.service
更改mysql root初始密码:
mysql> set password for root@localhost = password('123');
mysql> flush privileges; #立即生效
1.3 php 安装
[root@localhost ~]# yum install php.x86_64
2、zabbix程序包安装部署
2.1 下载并安装zabbix rpm包仓库
[root@localhost ~]# wget http://repo.zabbix.com/zabbix/3.5/rhel/7/x86_64/zabbix-release-3.5-1.el7.noarch.rpm
[root@localhost ~]# rpm -ivh zabbix-release-3.5-1.el7.noarch.rpm
2.2 安装zabbix 相关程序包
yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent #如果zabbix源慢,可以改变阿里源
2.4 安装初始化数据库
创建zabbix数据库,并对zabbix授予权限
mariadb [(none)]> create database zabbix character set utf8; #这里数据库一定要指定字符集,要不在前端历史操作是乱码,因为历史操作是保存在数据库里的。 mariadb [(none)]> flush privileges;
mariadb [(none)]> grant all on zabbix.* to zabbix@localhost identified by '111';
导入数据库
create.sql /usr/share/doc/zabbix-server-mysql-4.0.0
# mysql -u zabbix -p zabbix < create.sql #导入create.sql
启动zabbix server进程
2.5 在zabbix_server.conf中编辑数据库配置
# vim /etc/zabbix/zabbix_server.conf dbhost=localhost dbname=zabbix dbuser=zabbix dbpassword=zabbix
2.6 启动zabbix server进程,并加入启动项
# systemctl status zabbix-server.service
● zabbix-server.service - zabbix server
loaded: loaded (/usr/lib/systemd/system/zabbix-server.service; disabled; vendor preset: disabled)
active: active (running) since 日 2019-02-24 15:59:37 cst; 6s ago# systemctl enable zabbix-server.service
2.7 编辑zabbix前端的php配置
zabbix前端的apache配置文件位于 /etc/httpd/conf.d/zabbix.conf 。一些php设置已经完成了配置。
php_value max_execution_time 300 php_value memory_limit 128m php_value post_max_size 16m php_value upload_max_filesize 2m php_value max_input_time 300 php_value always_populate_raw_post_data -1 php_value date.timezone asia/shanghai #需要重启apache web服务器
# systemctl restart httpd.service
zabbix前端可以在浏览器中通过 http://localhost/zabbix 访问
zabbix登录默认用户名 密码: admin zabbix
zabbix安装完生成/etc/zabbix/web/zabbix.conf.php,可做数据库拆分配置用
2.8 abbix_agentd.conf 配置
server=127.0.0.1 #允许接受某主机发来的数据
serveractive=127.0.0.1
启动zabbix_agentd
上一篇: 美国人眼中最正宗的家乡菜
下一篇: 理想与现实的距离到底有多远?