博客列表 >centos6用yum安装LAMP+编译zabbix-3.2.4

centos6用yum安装LAMP+编译zabbix-3.2.4

Altura的博客
Altura的博客原创
2017年07月28日 10:54:09974浏览

关闭防火墙  selinux

/etc/init.d/iptables stop
chkconfig iptables off

sed -ri '/^SELINUX=/c\SELINUX=disabled' /etc/selinux/config

setenforce 0


配置源
cd /etc/yum.repos.d/
\cp CentOS-Base.repo CentOS-Base.repo.$(date +%F)


wget https://mirrors.163.com/.help/CentOS6-Base-163.repo
yum -y install epel-release
rpm -ivh https://repo.webtatic.com/yum/el6/latest.rpm
rpm -ivh https://repo.mysql.com/mysql-community-release-el6-7.noarch.rpm

yum clean  all
yum makecache

安装依赖包:

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

安装启动mysql:

yum -y install mysql mysql-server

/etc/init.d/mysqld restart



登录数据库 创建zabbix
mysql
CREATE DATABASE zabbix CHARACTER SET utf8 COLLATE utf8_bin;
GRANT ALL PRIVILEGES ON zabbix.* TO zabbix@localhost IDENTIFIED BY 'zabbix';
flush privileges;

更改mysql密码
set password=password('123456789');
flush privileges;
exit


下载zabbix包 可以上传到Linux里面

groupadd zabbix
useradd -g zabbix zabbix
cd /usr/local/src/
tar -xvf zabbix-3.2.4.tar.gz
cd zabbix-3.2.4/database/mysql/


mysql -uzabbix -pzabbix zabbix < schema.sql
mysql -uzabbix -pzabbix zabbix < images.sql
mysql -uzabbix -pzabbix zabbix < data.sql



cd /usr/local/src/zabbix-3.2.4/
./configure --enable-server  --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2 --with-unixodbc --with-ssh2 --with-openipmi --with-openssl


make  install



修改配置文件
vim /usr/local/etc/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix


创建zabbix-web页面文件夹
mkdir /var/www/html/zabbix
cd /usr/local/src/zabbix-3.2.4/frontends/php/
cp -a . /var/www/html/zabbix/



创建一个规则允许web服务器访问前端文件
chcon -Rv --type=httpd_sys_content_t /var/www/html

运行Apache和zabbix访问外网
setsebool -P httpd_can_network_connect=1
setsebool -P zabbix_can_network=1


设置Apache用户web接口文件的所有者
chown -R apache:apache /var/www/html/zabbix

为zabbix web界面添加权限
chmod +x /var/www/html/zabbix/conf/
复制zabbix_server和zabbix_agent的启动脚本
cp /usr/local/src/zabbix-3.2.4/misc/init.d/fedora/core/zabbix_server /etc/init.d/zabbix_server
cp /usr/local/src/zabbix-3.2.4/misc/init.d/fedora/core/zabbix_agentd /etc/init.d/zabbix_agent

chkconfig --add /etc/init.d/zabbix_server
chkconfig --add /etc/init.d/zabbix_agent



chkconfig httpd on
chkconfig mysqld on
chkconfig zabbix_server on
chkconfig zabbix_agent on


启动httpd和zabbix_server、zabbix_agent服务
/etc/init.d/httpd start
service zabbix_server start
service zabbix_agent start

查看zabbix_server端口:10051    agent端口是10050
netstat -antlup | grep 10051

更改php配置文件
vim /etc/php.ini
post_max_size = 8M       改成  post_max_size=16M
max_execution_time = 30   改成  max_execution_time=300
max_input_time = 60       改成   max_input_time=300
;date.timezone =          改成   date.timezone=Asia/Shanghai
;always_populate_raw_post_data = -1     改成    always_populate_raw_post_data=-1


/etc/init.d/httpd restart

打开浏览器 输入  ip/zabbix就可安装

声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议