麒麟系统安装zabbix
时间: 2023-11-24 12:06:27 浏览: 176
银河麒麟编译安装zabbix 4.0TLS.docx
以下是在麒麟系统上安装zabbix的步骤:
1.安装必要的依赖包和工具:
```shell
yum install -y gcc gcc-c++ make cmake wget net-snmp-devel libxml2-devel libcurl-devel libevent-devel
```
2.下载zabbix源码包并解压:
```shell
wget https://cdn.zabbix.com/zabbix/sources/stable/5.4/zabbix-5.4.0.tar.gz
tar -zxvf zabbix-5.4.0.tar.gz
```
3.编译并安装zabbix server:
```shell
cd zabbix-5.4.0
./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2
make install
```
4.创建zabbix用户和用户组:
```shell
groupadd zabbix
useradd -g zabbix zabbix
```
5.创建zabbix数据库和用户:
```shell
mysql -uroot -p
create database zabbix character set utf8 collate utf8_bin;
grant all privileges on zabbix.* to zabbix@localhost identified by 'password';
flush privileges;
quit;
```
6.导入zabbix数据库:
```shell
cd /usr/local/zabbix/share/zabbix/
mysql -uzabbix -p zabbix < create/schema/mysql.sql
mysql -uzabbix -p zabbix < create/data/data.sql
mysql -uzabbix -p zabbix < create/data/images_mysql.sql
```
7.修改zabbix server配置文件:
```shell
cp /usr/local/zabbix/etc/zabbix_server.conf /usr/local/zabbix/etc/zabbix_server.conf.bak
vim /usr/local/zabbix/etc/zabbix_server.conf
```
修改以下配置项:
```shell
DBName=zabbix
DBUser=zabbix
DBPassword=password
```
8.启动zabbix server和agent:
```shell
/usr/local/zabbix/sbin/zabbix_server
/usr/local/zabbix/sbin/zabbix_agentd
```
9.配置zabbix web界面:
```shell
cd /usr/local/zabbix/share/zabbix/
cp -r frontend/php/* /var/www/html/
cp /usr/local/zabbix/etc/zabbix.conf.php.example /var/www/html/conf/zabbix.conf.php
vim /var/www/html/conf/zabbix.conf.php
```
修改以下配置项:
```shell
$DB['DATABASE'] = 'zabbix';
$DB['USER'] = 'zabbix';
$DB['PASSWORD'] = 'password';
$ZBX_SERVER = '127.0.0.1';
$ZBX_SERVER_PORT = '10051';
$ZBX_SERVER_NAME = 'Zabbix Server';
```
10.访问zabbix web界面,进行初始化配置:
在浏览器中输入:http://ip/zabbix,按照提示进行初始化配置。
阅读全文