zabbix服務端

## zabbix安裝php

zabbix服務器初始化腳本mysql

```bashlinux

#!/bin/bashgit


# 增長zabbix3yum源web

cat > /etc/yum.repos.d/zabbix.repo <<EOFsql

[zabbix3.0]數據庫

name=zabbix3.0vim

baseurl=http://mirrors.aliyun.com/zabbix/zabbix/3.0/rhel/7/x86_64/瀏覽器

gpgcheck=0bash

EOF


# 安裝git

yum install git -y

# 安裝iftop,用於網絡監控

yum install iftop -y

```


zabbix運行環境準備腳本

```bash

#!/bin/bash


#安裝httpd提供zabbix服務

yum install -y httpd php php-mysql mariadb-server


# 啓動httpd和數據庫,設置開機啓動

systemctl start httpd.service

systemctl start mariadb.service

systemctl enable httpd.service

systemctl enable mariadb.service


# 導入數據庫

mysql <<EOF

CREATE DATABASE zabbix CHARACTER SET utf8;

GRANT ALL ON zabbix.* TO 'zbxuser'@'localhost' IDENTIFIED BY 'zbpass';

GRANT ALL ON zabbix.* TO 'zbxuser'@'127.0.0.1' IDENTIFIED BY 'zbpass';

EOF

```


zabbix安裝

```bash

yum install zabbix-agent zabbix-get zabbix-sender zabbix-server-mysql zabbix-web zabbix-web-mysql -y

#下面三步是給zabbix提供數據庫支持,建立一些數據庫表

cd /usr/share/doc/zabbix-server-mysql-3.0.9/

gunzip create.sql.gz

mysql -uzbxuser -hlocalhost -p"zbpass" -Dzabbix < create.sql

```


## 設置zabbix

編輯/etc/zabbix/zabbix_server.conf

```bash

#編輯配置文件更改以下幾行數據庫主機、數據庫名字、數據庫用戶、數據庫密碼

DBHost=localhost

DBName=zabbix

DBUser=zbxuser

DBPassword=zbxpass

```


啓動服務,開機啓動

```

systemctl start zabbix-server.service

systemctl enable zabbix-server.service

```


關閉linux系統圖形界面

```

systemctl set-default multi-user.target

```




編輯/etc/php.ini

```bash

# 更改時區

date.timezone = Asia/Shanghai

systemctl restart httpd.service

```


使用瀏覽器訪問http://172.16.16.16/zabbix/setup.php


默認的用戶名和密碼admin/zabbix


更改瀏覽器訪問路徑爲http://172.16.16.16的方法


```

vim /etc/httpd/conf/httpd.conf


DocumentRoot "/usr/share/zabbix"


systemctl restart httpd

```

相關文章
相關標籤/搜索