本文仅做个人学习记录,供参考,请以官方文档为准
安装环境:
centos7.2
apache
php7.1
mariadb
zabbix3.4.2
准备一台全新CENTOS7环境,yum upgrade
关闭SELINUX
#vi /etc/selinux/config
SELINUX=disabled
关闭防火墙,视环境决定是否开启,开启后添加相应规则:80|10051端口
#systemctl stop firewalld.service
#systemctl disable firewalld.service
#firewall-cmd –state
安装mariadb,如果使用mysql,请自行卸载mariadb
yum install mariadb mariadb-server
#systemctl start mariadb
#systemctl enable mariadb
#mysql_secure_installation[设置mariadb初始化参数]
配置MariaDB的字符集
#vi /etc/my.cnf
在[mysqld]标签下添加
init_connect='SET collation_connection = utf8_unicode_ci' init_connect='SET NAMES utf8' character-set-server=utf8 collation-server=utf8_unicode_ci skip-character-set-client-handshake
#vi /etc/my.cnf.d/client.cnf
在[client]中添加
default-character-set=utf8
#vi /etc/my.cnf.d/mysql-clients.cnf
在[mysql]中添加
default-character-set=utf8
#systemctl restart mariadb
查看MariaDB字符集
mysql> show variables like "%character%";show variables like "%collation%";
安装Apache
CentOS/RHEL 7.x:
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
CentOS/RHEL 6.x:
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
#yum install httpd
#systemctl enable httpd
安装PHP及扩展,注意版本:
For PHP7.1:
yum install php71w-common mod_php71w php71w-opcache php71w-gd php71w-mysql php71w-mbstring php71w-pecl-redis php71w-pecl-memcached php71w-devel php71w-bcmath php71w-ldap systemctl restart httpd
For PHP5:
yum install php-common php php-gd php-mysql php-mbstring php-pecl-redis php-pecl-memcached php-devel php-bcmath systemctl restart httpd
#yum install OpenIPMI fping net-snmp
设置zabbix源:
rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm yum install zabbix-server-mysql yum install zabbix-proxy-mysql yum install zabbix-web-mysql
创建ZABBIX数据库设置字符集UTF-8:
#mysql -uroot -p
#mysql>create database zabbix character set utf8;
#mysql>grant all on zabbix.* to root@localhost identified by ‘password‘;
#flush privileges;
#exit
导入zabbix数据库
# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uroot -p zabbix-db
配置ZABBIX服务配置文件
# vi /etc/zabbix/zabbix_server.conf
DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=<password>
添加zabbix server到开机启动
# systemctl enable zabbix-server
# service zabbix-server start
打开http://ip/zabbix网页安装向导,根据提示修改/etc/php.ini的相关参数