- 安裝mariadb(mysql)
// 執(zhí)行安裝命令
# yum -y install mariadb mariadb-server mariadb-devel
// 啟動(dòng)服務(wù)
# systemctl start mariadb
// 設(shè)置為開(kāi)機(jī)啟動(dòng)
# systemctl enable mariadb
// 修改root登錄密碼
# mysql_secure_installation
Enter current password for root (enter for none): [回車]
Set root password? [Y/n] y
New password:
Re-enter new password:
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] n
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y
// 測(cè)試登陸
# mysql -uroot -ppassword
// 設(shè)置root訪問(wèn)權(quán)限
# mysql -uroot -ppassword
MariaDB [(none)]> grant all privileges on *.* to 'root'@'%' identified by 'qwe123' with grant option;
MariaDB [(none)]> flush privileges;
MariaDB [(none)]> exit;
- 安裝依賴庫(kù)
// 以下二選一
// 最小
# yum -y install gcc net-snmp-devel libxml2-devel libcurl-devel libevent libevent-devel
// 完全
# yum -y install gcc net-snmp-devel net-snmp net-snmp-utils libxml2 libxml2-devel libcurl libcurl-devel libevent libevent-devel
- 下載源碼,并配置安裝
下載地址:
https://www.zabbix.com/download
https://downloads.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.4.4/zabbix-3.4.4.tar.gz
上傳zabbix-3.4.4.tar.gz到/home目錄下
# cd /home
# tar -zxf zabbix-3.4.4.tar.gz
# cd zabbix-3.4.4
# ./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --enable-java --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2
# make && make install
- 初始化數(shù)據(jù)
# mysql -uroot -ppassword
MariaDB [none]> create database if not exists zabbix default character set utf8 collate utf8_general_ci;
MariaDB [none]> use zabbix;
MariaDB [zabbix]> source /home/zabbix-3.4.4/database/mysql/schema.sql;
MariaDB [zabbix]> source /home/zabbix-3.4.4/database/mysql/images.sql;
MariaDB [zabbix]> source /home/zabbix-3.4.4/database/mysql/data.sql;
- 安裝fping
zabbix 3之后把ping更換為fping了,所以需要安裝fping
# wget http://www.fping.org/dist/fping-4.0.tar.gz
# tar -zxvf fping-4.0.tar.gz
# cd fping-4.0
# ./configure --prefix=/usr/local/fping
# make && make install
- 配置
// server配置
# cd /usr/local/zabbix/
# vi ./etc/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=root
DBPassword=password
AllowRoot=1
FpingLocation=/usr/local/fping/sbin/fping
// agent配置
# vi ./etc/zabbix_agentd.conf
Server=0.0.0.0/0
Hostname=Zabbix server #注釋掉
AllowRoot=1
- 啟動(dòng)服務(wù)
# /usr/local/zabbix/sbin/zabbix_server
# /usr/local/zabbix/sbin/zabbix_agent
- 配置前端環(huán)境
// 安裝apache+php
# yum -y install httpd httpd-devel php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml php-bcmath
// 復(fù)制前端代碼到站點(diǎn)下
# cp -r /home/zabbix-3.4.4/frontends/php /var/www/html/zabbix
// 關(guān)閉防火墻
# systemctl stop firewalld
# setenforce 0
# vi /etc/selinux/config
SELINUX=disabled
// 修改php配置
# vi /etc/php.ini
memory_limit=128M
post_max_size=16M
upload_max_filesize=20M
max_execution_time=300
max_input_time=300
date.timezone=Asia/Shanghai
// 重啟站點(diǎn)
# systemctl restart httpd
訪問(wèn)站點(diǎn)按提示進(jìn)行配置即可
http://localhost/zabbix