🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
[TOC] # zabbix的安装 * * * * * ## 1. Ubuntu下安装 1.安装server ~~~ wget http://repo.zabbix.com/zabbix/3.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.0-1+trusty_all.deb dpkg -i zabbix-release_3.0-1+trusty_all.deb apt-get update apt-get install php5 zabbix-frontend-php php5-mysql sudo apt-get install zabbix-server-mysql #会安装MySQL sudo vim /etc/zabbix/zabbix_server.conf DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=zabbix # 配置PHP sudo vim /etc/php5/apache2/php.ini修改项: post_max_size = 16M max_execution_time = 300 max_input_time = 300 date.timezone = "Asia/Shanghai" ~~~ * 修改完成后重启apache2 ` /etc/init.d/apache2 restart ` * 配置数据库 首先mysql配置 ~~~ cd /etc/mysql sudo vim my.cnf 注释掉下面这行 #bind-address = 127.0.0.1 ~~~ ~~~ mysql>create database zabbix character set utf8 collate utf8_bin; mysql>grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix'; mysql> flush privileges; sudo apt-get install zabbix-frontend-php(数据库root,root,root) ~~~ ` sudo cp -r /usr/share/zabbix /var/www/html/zabbix ` * 初始化数据库 ~~~ cd /usr/share/doc/zabbix-server-mysql ls gunzip create.sql.gz mysql -uzabbix -pzabbix zabbix <create.sql ~~~ * 重启 ~~~ sudo /etc/init.d/zabbix-server stop sudo /etc/init.d/zabbix-server start ~~~ 访问: http://192.168.56.130/zabbix * 安装agent(不用重复做) ~~~ wget http://repo.zabbix.com/zabbix/3.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.0-1+trusty_all.deb dpkg -i zabbix-release_3.0-1+trusty_all.deb apt-get install zabbix-agent ~~~ `sudo vim /etc/zabbix/zabbix_agentd.conf` * 做以下修改 ~~~ Server=192.168.0.157 ServerActive=192.168.0.157 Hostname=bigdata2 ~~~ * 因为安装agent时会启动agent进程,在修改配置文件后要重启agent服务。 `sudo service zabbix-agent restart` ## 2. 配置中文环境 * 首先启用中文 `sudo vim /usr/share/zabbix/include/locales.inc.php` * 把zh_CN后面参数写true,然后安装中文包 `sudo apt-get install language-pack-zh-hant language-pack-zh-hans` `接着,配置相关环境变量:` `sudo vim /etc/environment` * 在文件中增加语言和编码的设置: ~~~ LANG="zh_CN.UTF-8" LANGUAGE="zh_CN:zh:en_US:en" ~~~ * 接着,重新设置本地配置: ` sudo dpkg-reconfigure locales` * 最后重启php服务 `sudo service php5-fpm restart` ![](https://box.kancloud.cn/977a17a2a10c25a63abb0386aa3d2296_1910x559.png) ## 3.解决中文乱码 * 在zabbix的frontend页面所在目录中,可以这样查找目录 ~~~ sudo find / -name defines.inc.php -print ~~~ 1. 到网上下载simkai.ttf文件,上传到/usr/share/zabbix/fonts目录下 2. 修改配置 `sudo vim /usr/share/zabbix/include/defines.inc.php` ![](https://box.kancloud.cn/923203a1846d0253bd92ec7a14bc34f3_810x354.png) 重启web服务。 ~~~ sudo service php5-fpm restart ~~~