查看自己得数据库版本
yum list installed | grep mysql
----------------------------------------
Expected output:
mysql-libs.x86_64 5.1.73-5.el6_6 @anaconda-CentOS-201508042137.x86_64/6.7
----------------------------------------
删除自己得老版本数据库
yum remove mysql*
添加新得数据库下载
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
启动数据库
service mysqld start
修改数据库默认用户密码以及匿名登录
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 < p_w_picpaths.sql
mysql -u zabbix -p zabbix < data.sql
下载依赖包
yum install -y gcc mysql-community-devel libxml2-devel unixODBC-devel net-snmp-devel libcurl-devel libssh3-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-ssh3 --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
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。