查看自己得数据库版本
yum list installed | grep MysqL
----------------------------------------
Expected output:
MysqL-libs.x86_64 5.1.73-5.el6_6 @anaconda-CentOS-201508042137.x86_64/6.7
----------------------------------------
添加新得数据库下载
rpm -ivh http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
----------------------------------------
Expected output:
Retrieving http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
Preparing... ########################################### [100%]
1:MysqL-community-release########################################### [100%]
----------------------------------------
安装数据库和vim编译器
yum install MysqL-server vim -y
配置my.cnf文件
vim /etc/my.cnf
[MysqLd]
innodb_file_per_table
修改数据库默认用户密码以及匿名登录
MysqL_secure_installation
Enter current password for root (enter for none):
Set root password? [Y/n]
Remove anonymous users? [Y/n]
Disallow root login remotely? [Y/n]
Remove test database and access to it? [Y/n]
Reload privilege tables now? [Y/n]
Normally you should answer “Yes” to all these questions.
添加zabbix数据库
MysqL -u root -p
CREATE DATABASE zabbix CHARACTER SET utf8 COLLATE utf8_bin;
GRANT ALL PRIVILEGES ON zabbix.* TO zabbix@localhost IDENTIFIED BY 'zabbix';
----------------------------------------
Expected output:
MysqL> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| MysqL |
| performance_schema |
| zabbix |
+--------------------+
4 rows in set (0.00 sec)
----------------------------------------
配置web服务
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*
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
service httpd start
调整防火墙配置
iptables -I INPUT -p tcp -m multiport --destination-port 80,10050:10051 -j ACCEPT
service iptables save
配置NTP时间
ntpdate time.windows.com
---------------------------------------------------------------------------------------------------------------
((((以上配置如果没有问题 输入 ip a s 查看自己得地址。尝试http登陆 会发现web服务得界面就基本表示OK了))))
----------------------------------------------------------------------------------------------------------------
开始zabbix的安装
创建用户
groupadd zabbix
useradd -g zabbix zabbix
创建下载文件夹(zabbix就丢这里面)
mkdir /home/zabbix/downloads
cd /home/zabbix/downloads
下载
wget http://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.2.0/zabbix-3.2.0.tar.gz
解压
tar -zxvf zabbix-3.2.0.tar.gz
进入zabbix文件数据库 (如有提示密码就是zabbix用户得密码 ”zabbix“)
cd /home/zabbix/downloads/zabbix-3.2.0/database/MysqL
MysqL -u zabbix -p zabbix < schema.sql
MysqL -u zabbix -p zabbix < images.sql
MysqL -u zabbix -p zabbix < data.sql
下载依赖包
yum install -y gcc MysqL-community-devel libxml2-devel unixODBC-devel net-snmp-devel libcurl-devel libssh2-devel OpenIPMI-devel openssl-devel openldap-devel
cd ../..
编译安装
./configure --enable-server --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
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
创建zabbix-web页面文件夹
mkdir /var/www/html/zabbix
cd /home/zabbix/downloads/zabbix-3.2.0/frontends/PHP/
cp -a . /var/www/html/zabbix/
关闭selinux
setenforce 0
创建一个规则允许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/
启动脚本
cp /home/zabbix/downloads/zabbix-3.2.0/misc/init.d/fedora/core/zabbix_server /etc/init.d/zabbix_server
chkconfig --add /etc/init.d/zabbix_server
启用Zabbix服务器,Apache和MysqL服务启动
chkconfig httpd on
chkconfig MysqLd on
chkconfig zabbix_server on
全面启动service zabbix_server start
原文链接:https://www.f2er.com/centos/380303.html