|
一、zabbix安装
1、下载zabbix安装包
wget http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3.2.6/zabbix-3.2.6.tar.gz/download
2、创建zabbix普通用户:useradd -s /sbin/nologin zabbix
3、解压zabbix tar -zxvf zabbix-3.2.6.tar.gz
4、安装zabbix_server
4.1、安装依赖库:
Centos6的依赖
yum -y install curl curl-devel net-snmp net-snmp-devel perl-DBI
yum -y install gcc
yum install mysql-devel
| Centos7的依赖包
yum install php php-gd php-mysql php-bcmath php-mbstring php-xml curl curl-devel net-snmp net-snmp-devel perl-DBI gcc gcc-c++ mysql-devel libxml2 libxml2-devel -y
| 4.2、源码编译安装zabbix_server
./configure --prefix=/usr/local/zabbix/ --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl
make -j8
make -j8 install
ln -s /usr/local/zabbix/sbin/zabbix_* /usr/local/sbin/ 创建软连接
| 4.3、拷贝启动脚本到启动目录cp misc/init.d/tru64/zabbix_server zabbix_agent /etc/init.d/
5、安装mysql
yum install mysql mysql-devel mysql-server //centos6
yum install mariadb mariadb-devel mariadb-server // centos7
systemctl start mariadb.service 或者 systemctl start mysqld.service
systemctl stop mariadb.service 或者 systemctl stop mysqld.service
| 6、安装zabbix_web
6.1、先安装apache在安装php,apache会在动整合:
yum install httpd httpd-devel httpd-tools -y
yum php php-devel php-mysql
cp -a /root/zabbix-3.2.6/frontends/php/* /var/www/html/
| 6.2、升级php {Centos6需要执行下面的代码来升级PHP}
卸载原有的php: yum remove php* -y
rpm -Uvh http://repo.webtatic.com/yum/el6/latest.rpm //下载并安装php源
rpm -ivh 跟源 //安装php
yum install php56w.x86_64 php56w-cli.x86_64 php56w-common.x86_64 php56w-gd.x86_64 php56w-ldap.x86_64 php56w-mbstring.x86_64 php56w-mcrypt.x86_64 php56w-mysql.x86_64 php56w-pdo.x86_64 -y --skip-broken
| 6.3、重启服务
/etc/init.d/zabbix_server restart
/etc/init.d/httpd restart
systemctl start httpd //Centos7
/etc/init.d/mysqld restart
systemctl start mariadb.service //Centos7
systemctl stop firewalld.service //Centos7
| 7、在浏览器中访问该服务器报错如下图:

7.1) 解决上图报错脚本如下:
centos6的解决办法
yum install php56w-mbstring php56w-bcmath php56w-gd php56w-xml -y
yum install gd gd-devel -y
centos7的解决办法
yum install php php-gd php-mysql php-bcmath php-mbstring php-xml curl curl-devel net-snmp net-snmp-devel perl-DBI gcc gcc-c++ mysql-devel libxml2 libxml2-devel -y
共同修改的文件
sed -i '/post_max_size/s/8/16/g;/max_execution_time/s/30/300/g;/max_input_time/s/60/300/g;s/\;date.timezone.*/date.timezone \= PRC/g;s/\;always_populate_raw_post_data/always_populate_raw_post_data/g' /etc/php.ini
/etc/init.d/httpd restart
| 
7.2、创建数据库并授权
create database zabbix charset=utf8;
grant all on zabbix.* to zabbix@localhost identified by '123456';
flush privileges;
| 7.3、解压zabbix软件包并将Zabbix基础SQL文件导入数据至Zabbix数据库:
[table][tr][td=1,1,561]mysql -uzabbix -p123456 zabbix |
|
|
|
|
|
|