主机名称 IP 端口 用途 操做系统
server 127.0.0.1 10050 zabbix-server ubuntu 16.04
agent 127.0.0.1 10051 zabbix-agent ubuntu 16.04php
2、下载安装软件html
一、下载软件包mysql
wget https://repo.zabbix.com/zabbix/3.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.0-2+xenial_all.deb dpkg -i zabbix-release_3.0-2+xenial_all.deb apt update
二、安装软件nginx
apt install zabbix-server-mysql zabbix-frontend-php zabbix-agent
三、建立并初始化数据库web
mysql -uroot -p password #第一次进入这不用输入密码 mysql> create database zabbix character set utf8 collate utf8_bin; mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'passwordstring'; #注意记住这里的密码,后续在配置文件以及web配置页面中都会用到 mysql> quit;
四、导入初始模式和数据。系统会提示您输入刚才建立的密码。sql
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
五、修改配置文件
编辑 /etc/zabbix/zabbix_server.conf数据库
DBPassword=password #这里的密码就是上面设置的密码
编辑 /etc/zabbix/apache.conf (也能够是nginx,取决于你使用的web server)apache
php_value date.timezone Asia/Shanghai
六、启动服务ubuntu
systemctl restart zabbix-server zabbix-agent apache2 systemctl enable zabbix-server zabbix-agent apache2
3、登录Web页面并配置 bash
一、配置web-server
我这里用的是nginx,因此在/etc/hosts和/etc/nginx/sites-available/default中作了配置。
127.0.0.1 www.localzabbix.com
server { listen 80; server_name www.localzabbix.com; #root /opt/wwwroot/sixfoot-server/public; root /usr/share/zabbix/; index index.php; location / { index index.html index.htm index.php l.php; try_files $uri $uri/ /index.php?$query_string; autoindex on; } location ~ \.php(.*)$ { #fastcgi_pass 127.0.0.1:9000; include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php7.3-fpm.sock; #fastcgi_index index.php; fastcgi_split_path_info ^((?U).+\.php)(/?.+)$; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; include fastcgi_params; } }
二、打开网址 www.localzabbix.com,登陆Admin,密码默认zabbix。进入欢迎界面,next
三、须要如下选项都要OK,须要改具体的web-server配置,而后重启生效。
三、DB配置页面,用户名密码就是以前在mysql中配置的
四、服务器端配置(注意端口,服务器端通常默认是10050)
五、安装
六、安装成功
参考: https://blog.csdn.net/u010948569/article/details/82384158