centos7.2编译安装zabbix-3.0.4

安装zabbix-3.0.4

#安装必备的包

yum -y install gcc* make php php-gd php-mysql php-bcmath php-mbstring php-xml curl curl-devel net-snmp net-snmp-devel perl-DBI httpd mariadb* mysql-devel libxml2-devel curl-devel unixODBC-devel net-snmp-devel OpenIPMI-devel openldap openldap-devel libevent-devel

 

#增加zabbix用户和组

groupadd zabbix
useradd -g zabbix zabbix

 

#编译安装zabbix

tar -xf zabbix-3.0.4.tar.gz
cd zabbix-3.0.4/
./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2 --with-openipmi --with-unixodbc
make
make install

 

systemctl start mariadb.service

#初始化mysql

mysql_secure_installation

#创建数据库
create database zabbix character set utf8 collate utf8_bin;
grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';


#导入数据

[root@devops zabbix-3.0.4]# mysql -uzabbix -pzabbix zabbix <./database/mysql/schema.sql
[root@devops zabbix-3.0.4]# mysql -uzabbix -pzabbix zabbix <./database/mysql/images.sql
[root@devops zabbix-3.0.4]# mysql -uzabbix -pzabbix zabbix <./database/mysql/data.sql


#修改PHP的配置参数
vim /etc/php.ini
date.timezone= Asia/Shanghai
max_execution_time = 300
post_max_size = 32M
memory_limit = 128M
mbstring.func_overload = 1
max_input_time = 300


#拷贝前端文件至/var/www/html并授权目录为apache.apache
[root@devops zabbix-3.0.4]# cp -r frontends/php/ /var/www/html/zabbix
[root@devops zabbix-3.0.4]# chown -R apache.apache /var/www/html/zabbix


#配置zabbix_sercer.configure
AlertScriptsPath=/usr/local/zabbix/server/scripts
LogFile=/tmp/zabbix_server.log
PidFile=/usr/local/zabbix/zabbix_server.pid
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
Timeout=4
LogSlowQueries=3000


#zabbix服务启动脚本
cp misc/init.d/fedora/core/zabbix_server /etc/init.d/

将启动脚本的路径修改为/usr/local/zabbix
vim /etc/init.d/zabbix_server
BASEDIR=/usr/local/zabbix

#安装目录授权
chown -R zabbix.zabbix /usr/local/zabbix/

#开机启动
chkconfig --add zabbix_server
chkconfig zabbix_server on
systemctl enable httpd.service
systemctl enable mariadb.service
systemctl start httpd.service
/etc/init.d/zabbix_server start

 

#web服务初始化

 

 

#输入数据库信息

 

 

 

 ##登陆zabbix

 默认账户密码:Admin  zabbix  登陆成功后第一件事就是更改登陆密码

 

#默认起始页面

 

 #个人喜欢为黑色背景

 

#替换中文字体,使其不乱码

cd  /var/www/html/zabbix/fonts

1、修改配置文件defines.inc.php
cd /var/www/html/zabbix/include/
vi defines.inc.php
54  define('ZBX_GRAPH_FONT_NAME', 'simkai'); 
103 define('ZBX_FONT_NAME', 'simkai');
2、拷贝字体及授权
将win7系统楷体的字体C:\Windows\Fonts,先拷贝桌面,在将simkai字体拷贝/var/www/html/zabbix/fonts
注意权限的问题
cd /var/www/html/zabbix/fonts
chown -R apache.apache *

 

posted @ 2018-03-18 12:15  梦轻尘  阅读(178)  评论(0编辑  收藏  举报