搭建zabbix(yum安裝zabbix,ngixn,mysql,源碼安裝php)
1.安裝zabbix的repo
2.yum 安裝
3.yum安裝mariadb mariadb-server
4.創庫zabbix,賦權給zabbix用戶
5.將zabbix文件的庫導入mysql中
6.修改zabbix_server.conf配置文件
7.啟動開機自啟zabbix_server.service
8.yum安裝nginx
9.修改nginx.conf配置文件,用nginx -t檢查,如果代碼沒問題,檢查80端口有沒有被占用
10.啟動開機自啟nginx.service
11.給於/etc/zabbix/web屬主屬組nginx
12.頁面訪問:http://IP/index.php
13.頁面安裝zabbix
14.以上有幾個點值得註意!!!
======推薦mysql5.7版本,不要使用mysql8.0,不是別的,實在以筆者的水平駕馭不了
======php源碼安裝之前也有寫,這裏就不重復了,細心就好,
======編譯安裝和yum安裝都做過一般會有兩個配置文件,需要看程序是運行的哪一個
15.安裝代碼
rpm -ivh http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm
yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-get zabbix-agent
vim /etc/my.cnf
skip-grant-tables
wq
systemctl restart mariadb.service
systemctl enable mariadb.service
mysql_secure_installation
mysql -uroot -plixiang45.bbyA!
create database zabbix character set utf8 collate utf8_bin;
grant all privileges on zabbix. to zabbix@‘localhost‘ identified by ‘lixiang45.bbyA!‘;grant all privileges on zabbix. to zabbix@‘%‘ identified by ‘lixiang45.bbyA!‘;
grant all privileges on zabbix.* to zabbix@‘127.0.0.1‘ identified by ‘lixiang45.bbyA!‘‘
flush privileges;
cd /usr/share/doc/zabbix-server-mysql-3.2.11/
zcat create.sql.gz | mysql -uzabbix -plixiang45.bbyA! zabbix
vim /etc/zabbix/zabbix_server.conf
DBHost=10.18.42.163
DBName=zabbix
DBUser=zabbix
DBPassword=password
wq
systemctl restart zabbix-server.service
systemctl enable zabbix-server.service
vim /etc/nginx/nginx.conf
location / {
root /usr/share/zabbix;
}
location ~ "\.php$" {
fastcgi_pass 10.18.42.163:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/zabbix/$ fastcgi_script_name;
include fastcgi_params;
}
wq
nginx -t
systemctl status httpd
systemctl stop httpd
systemctl disable httpd
systemctl start nginx
systemctl enable nginx
lsof -i:9000
systemctl status zabbix-server.service
ll /etc/zabbix/web/
chown -R nginx.nginx /etc/zabbix/web
vim /etc/php.ini
systemctl restart php-fpm.service
vim /usr/local/php/lib/php.ini
systemctl restart php-fpm.service
systemctl status zabbix-server.service
搭建zabbix(yum安裝zabbix,ngixn,mysql,源碼安裝php)