1. 程式人生 > >zabbix安裝部署(一)

zabbix安裝部署(一)

for cti spa soc x86 cor ges symlink web

一、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

zabbix安裝部署(一)