添加yum源
get -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo #安装阿里云yum源
wget -P /etc/yum.repos.d/ http://mirrors.aliyun.com/repo/epel-6.repo
一、安装MySQL
安装MySQL
rpm -ivh http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
yum -y install mysql-server mysql-devel
修改MySQL的配置文件,添加以下几行
vim /etc/my.cnf
default-storage-engine = innodb
innodb_file_per_table
collation-server = utf8_general_ci
init-connect = 'SET NAMES utf8'
character-set-server = utf8
设置MySQL自动启动并启动MySQL
chkconfig mysqld on
service mysqld start
/usr/bin/mysqladmin -u root password '123456'
创建Zabbix数据库
mysql -uroot -p123456
mysql> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.04 sec)
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by '123456';
Query OK, 0 rows affected (0.01 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
二、安装PHP
安装PHP
rpm -ivh http://repo.webtatic.com/yum/el6/latest.rpm
yum -y install httpd php56w php56w-gd php56w-mysql php56w-bcmath php56w-mbstring php56w-xml php56w-ldap wget ntpdate net-snmp* gcc mysql-community-devel libxml2-devel unixODBC-devel net-snmp-devel libcurl-devel libssh2-devel OpenIPMI-devel openssl-devel openldap-devel fping libevent-devel pcre-devel
修改PHP配置文件
vim /etc/php.ini
post_max_size=16M
max_execution_time=300
max_input_time=300
date.timezone=Asia/Shanghai
always_populate_raw_post_data=-1
设置HTTP自动启动并启动HTTP(也可以使用nginx)
chkconfig httpd on
service httpd start 点击
三、下载zabbix3.2.0安装包
wget https://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.2.7/zabbix-3.2.7.tar.gz
tar -xvf zabbix-3.2.7.tar.gz -C /usr/share
cd /usr/share/zabbix-3.2.7/database/mysql/
mysql -uzabbix -p123456 zabbix < schema.sql
mysql -uzabbix -p123456 zabbix < images.sql
mysql -uzabbix -p123456 zabbix < data.sql
cd ../../
yum install java* -y #如果不监控Java可以不安装,去掉 --enable-java选项即可
./configure --prefix=/usr/local/zabbix3.2 --enable-server --with-mysql --with-net-snmp --with-libcurl --with-libxml2 --enable-agent --enable-ipv6 --enable-agent --enable-java --with-unixodbc --with-ldap --with-libcurl --with-ssh2
make install
ln -sv /usr/local/zabbix3.2 /usr/local/zabbix
修改配置启动文件
vim /usr/local/zabbix3.2/etc/zabbix_server.conf
DBHost=10.1.1.249
DBName=zabbix
DBUser=zabbix
DBPassword=123456
创建zabbix-web页面文件夹
groupadd -r zabbix
useradd -g zabbix -r -s /sbin/nologin -M zabbix
mkdir /var/www/html/zabbix
cd /usr/share/zabbix-3.2.7/frontends/php/
cp -a . /var/www/html/zabbix/
设置Apache用户web接口文件的所有者
chown -R apache:apache /var/www/html/zabbix
chmod +x /var/www/html/zabbix/conf/
cp /usr/share/zabbix-3.2.7/misc/init.d/fedora/core/zabbix_server /etc/init.d/zabbix-server
cp /usr/share/zabbix-3.2.7/misc/init.d/fedora/core/zabbix_agentd /etc/init.d/zabbix-agentd
vim /etc/init.d/zabbix-server
BASEDIR=/usr/local/zabbix-server #修改为安装目录
vim /etc/init.d/zabbix-agentd
BASEDIR=/usr/local/zabbix-server #修改为安装目录
启动服务
/etc/init.d/zabbix-server start
访问URL: http://10.1.1.249/zabbix/,按提示操作
默认登录账户密码:Admin zabbix
"一劳永逸" 的话,有是有的,而 "一劳永逸" 的事却极少