zabbix安装部署(一)

一、zabbix安装

1.系统环境

[root@zabbix ~]# cat /etc/redhat-release 
CentOS Linux release 7.4.1708 (Core) 
#关闭selinux和防火墙

2.安装数据库

[root@zabbix ~]# yum install mariadb-server mariadb -y
[root@zabbix ~]# systemctl enable mariadb
[root@zabbix ~]# systemctl start mariadb

3.zabbix安装

[root@zabbix ~]# rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm
[root@zabbix ~]# yum install zabbix-server-mysql zabbix-web-mysql

4.创建数据库

[root@zabbix ~]# systemctl start mariadb
[root@zabbix ~]# mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.56-MariaDB MariaDB Server

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by '123456';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> exit
Bye

5.导入数据

[root@zabbix ~]# zcat /usr/share/doc/zabbix-server-mysql-3.4.12/create.sql.gz | mysql -uzabbix -p123456 zabbix

6.配置zabbix连接数据库的用户和密码

[root@zabbix ~]# cat /etc/zabbix/zabbix_server.conf | grep -v '^#' | grep -v '^$'
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=0
PidFile=/var/run/zabbix/zabbix_server.pid
SocketDir=/var/run/zabbix
DBName=zabbix
DBUser=zabbix
DBPassword=123456
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
Timeout=4
AlertScriptsPath=/usr/lib/zabbix/alertscripts
ExternalScripts=/usr/lib/zabbix/externalscripts

7.配置zabbix前端的PHP配置

[root@zabbix ~]# cat /etc/httpd/conf.d/zabbix.conf
Alias /zabbix /usr/share/zabbix

<Directory "/usr/share/zabbix">
    Options FollowSymLinks
    AllowOverride None
    Require all granted

    <IfModule mod_php5.c>
        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 max_input_vars 10000
        php_value always_populate_raw_post_data -1
        php_value date.timezone Asia/Shanghai
    </IfModule>
</Directory>

<Directory "/usr/share/zabbix/conf">
    Require all denied
</Directory>

<Directory "/usr/share/zabbix/app">
    Require all denied
</Directory>

<Directory "/usr/share/zabbix/include">
    Require all denied
</Directory>

<Directory "/usr/share/zabbix/local">
    Require all denied
</Directory>

8.启动zabbix和httpd
9.初始化zabbix

Zabbix前端可以在浏览器中通过 http://zabbix-hostname/zabbix 进行访问。默认的用户名/密码为 Admin/zabbix

相关文章
相关标签/搜索