[iyunv@localhost mysql]# vi /etc/my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Recommended in standard MySQL setup
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES character-set-server=utf8 #设置字符集为utf8
innodb_file_per_table=1 #让innodb的每个表文件单独存储
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
启动MySQL
[iyunv@localhost mysql]# service mysqld start
修改root用户密码
[iyunv@localhost mysql]# mysql -uroot -proot
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.6.26 MySQL Community Server (GPL)
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database zabbix character set utf8;
Query OK, 1 row affected (0.00 sec)
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
mysql> quit
Bye
[iyunv@localhost mysql]#
导入Zabbix-Server表结构和数据
[iyunv@localhost mysql]# mysql -uzabbix -pzabbix
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.6.26 MySQL Community Server (GPL)
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use zabbix;
Database changed
mysql> source /usr/share/doc/zabbix-server-mysql-2.4.6/create/schema.sql;
mysql> source /usr/share/doc/zabbix-server-mysql-2.4.6/create/images.sql;
mysql> source /usr/share/doc/zabbix-server-mysql-2.4.6/create/data.sql; Zabbix-Server的配置
Zabbix-Server端默认情况下只需要修改连接MySQL数据库的密码即可(其它参数可根据实际环境需求修改):
修改内容:
常见问题:
1、添加完防火墙过滤规则后,执行service iptables restart出错(Center OS 7),如下所示:
[iyunv@localhost sysconfig]# service iptables restart
Redirecting to /bin/systemctl restart iptables.service
Failed to issue method call: Unit iptables.service failed to load: No such file or directory.
[iyunv@localhost sysconfig]#
主要是因为没有安装iptables service导致的,所以当修改防火墙设置后,重启该服务无效。在Center OS7 或RHEL7 中防火墙引入进来管理iptables,在IMHO中,对于服务器环境而言,防火墙比工作站更安全、可靠。
所以可以通过如下办法解决:
依赖关系解决
===============================================================================================================================================================================================
Package 架构 版本 源 大小
===============================================================================================================================================================================================
正在安装:
iptables-services x86_64 1.4.21-13.el7 base 49 k
事务概要
===============================================================================================================================================================================================
安装 1 软件包
总下载量:49 k
安装大小:23 k
Is this ok [y/d/N]: t
Is this ok [y/d/N]: y
Downloading packages:
iptables-services-1.4.21-13.el7.x86_64.rpm | 49 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : iptables-services-1.4.21-13.el7.x86_64 1/1
warning: /etc/sysconfig/iptables created as /etc/sysconfig/iptables.rpmnew
验证中 : iptables-services-1.4.21-13.el7.x86_64 1/1
已安装:
iptables-services.x86_64 0:1.4.21-13.el7
完毕!
[iyunv@localhost sysconfig]# systemctl start iptables
[iyunv@localhost sysconfig]# service iptables restart
Redirecting to /bin/systemctl restart iptables.service
[iyunv@localhost sysconfig]# service iptables save
参考网址:http://stackoverflow.com/questions/24756240/how-can-i-use-iptables-on-centos-7
2、防火墙配置问题
如果连接不上80或者10051或者10050,需在/etc/sysconfig/iptables中添过滤规则:
[iyunv@localhost create]# vi /etc/sysconfig/iptables
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited # http
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
# zabbix-server
-A INPUT -m state --state NEW -m tcp -p tcp --dport 10051 -j ACCEPT
# zabbix-agent
-A OUTPUT -m state --state NEW -m tcp -p tcp --dport 10050 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --sport 10050 -j ACCEPT
COMMIT
[iyunv@localhost create]# service iptables restart
如果还有问题,可以用如下命令尝试刷新路由表:
[iyunv@localhost conf.d]# service httpd restart
如果依然存在问题,则进行如下操作:
[iyunv@localhost conf.d]# vi /etc/php.ini
[Date]
; Defines the default timezone used by the date functions
; http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone
date.timezone = Asia/Shanghai