centos6.8安装zabbix

前后用了两台电脑来实验,前后画风不一样,请忽略

 

一、安装php环境

移除目前系统安装的 PHP 组件
yum remove php* -y

安装 PHP 的 YUM 源 
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm

检查 YUM 源是否已经存在 
ll /etc/yum.repos.d/webtatic.repo

 

安装 PHP 环境
 yum -y install `yum list|grep php71w|awk '{printf ("%s ",$1)}'` --skip-broken

 



修改 PHP 参数以安装 ZABBIX 的安装需求 
sed -i "s/;date.timezone =/date.timezone = Asia\/Shanghai/g" /etc/php.ini
sed -i "s#`grep max_execution_time /etc/php.ini`#max_execution_time = 300#g" /etc/php.ini
sed -i "s#`grep post_max_size /etc/php.ini`#post_max_size = 32M#g" /etc/php.ini 
sed -i "s#`grep max_input_time = /etc/php.ini`#max_input_time = 300#g" /etc/php.ini 
sed -i "s#`grep memory_limit /etc/php.ini`#memory_limit = 128M#g" /etc/php.ini

 

这句报错,无法执行,我是用vim编辑替换的

sed -i "s#`grep max_input_time = /etc/php.ini`#max_input_time = 300#g" /etc/php.ini 


启动 PHP-FPM 服务
 
service php-fpm start

 


检查程序是否正常启动
netstat -lntup|grep php-fpm
 
将其加入开机自启动
 
chkconfig php-fpm on

 

 二、YUM 安装相关依赖组件

 
安装 WEB 及数据库服务
 
yum install -y ntpdate mailx dos2unix vim zcat wget net-snmp-utils gcc gcc-c++ autoconf httpd libxml* mysql mysql-server  httpd-manual mod_ssl mod_perl mod_auth_mysql mysql-connector-odbc mysql-devel libdbi-dbd-mysql net-snmp-devel curl-devel unixODBC-devel OpenIPMI-devel java-devel fping



启动 MYSQL 服务 
service mysqld start
chkconfig mysqld on

 


创建库及授权 
mysql -uroot -e "create database zabbix character set utf8;" 
mysql -uroot -e "grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';"
mysql -uroot -e "flush privileges;"

创建 ZABBIX 用户及组 
groupadd zabbix -g 201 
useradd -g zabbix -u 201 -m -s /sbin/nologin zabbix


 三、ZABBIX 相关组件安装部署
 
安装 ZABBIX 源 
rpm -ivh http://repo.zabbix.com/zabbix/3.2/rhel/6/x86_64/zabbix-release-3.2-1.el6.noarch.rpm 
ll /etc/yum.repos.d/zabbix.repo

 


创建下载目录下载相关软件包 
mkdir /software && cd /software
wget -c --timeout=10 http://repo.zabbix.com/zabbix/3.2/rhel/6/x86_64/deprecated/zabbix-server-mysql-3.2.7-1.el6.x86_64.rpm
wget -c --timeout=10 http://repo.zabbix.com/zabbix/3.2/rhel/6/x86_64/deprecated/zabbix-web-3.2.7-1.el6.noarch.rpm
wget -c --timeout=10 http://repo.zabbix.com/zabbix/3.2/rhel/6/x86_64/deprecated/zabbix-web-mysql-3.2.7-1.el6.noarch.rpm
wget -c --timeout=10 http://repo.zabbix.com/zabbix/3.2/rhel/6/x86_64/zabbix-agent-3.2.7-1.el6.x86_64.rpm

安装 ZABBIX 相关组件 
yum localinstall -y zabbix-server-mysql* zabbix-web-mysql* zabbix-agent zabbix-web*

导入数据库 
cd /usr/share/doc/zabbix-server-mysql-3.2.7
zcat create.sql.gz | mysql -uroot zabbix

设置 MYSQL 密码 
mysqladmin -uroot password "mysqladmin"

拷贝网页文件 
cd /usr/share/
cp -r ./zabbix/ /var/www/html/zabbix

修改配置文件 
echo "DBPassword=zabbix" >> /etc/zabbix/zabbix_server.conf

启动相关服务 
service httpd start 
service zabbix-server start 
service zabbix-agent start 
chkconfig httpd on 
chkconfig mysqld on 
chkconfig php-fpm on
chkconfig zabbix-server on 
chkconfig zabbix-agent on

zabbix-agent 安装失败,重新安装

cd /software
find / -name zabbix-agent*
rpm -ivh zabbix-agent-3.2.7-1.el6.x86_64.rpm

 

 
四、WEB界面配置
 
浏览器访问: http://127.0.0.1/zabbix/setup.php
用户名密码: zabbix/zabbix

 


 
登录 admin/zabbix

 




 







posted @ 2019-01-26 08:10  鸽子飞扬  阅读(1497)  评论(0编辑  收藏  举报