您好,登录后才能下订单哦!
操作系统版本:CentOS 7
首先,要先搭建Zabbix运行环境:LNMP(Linux + nginx+ MySQL + PHP(5.4以上))
CentOS 7
Ningx 1.9.10
Php7
Mysql 5.6
1.2.1官网安装包更新地址:
http://www.zabbix.com/download.php
2.2 3.0 下载:
cd /usr/local/src
wget http://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.0.0/zabbix-3.0.0.tar.gz
2.3安装依赖包:
yum install net-snmp-devel OpenIPMI-developenssl-devel fping-devel libcurl-devel perl-DBI gcc
2.4添加zabbix用户
useradd -d /usr/local/zabbix-3.0.0/lib/zabbix-s /sbin/nologin zabbix
cd /usr/local/src
tar xzvf zabbix-3.0.0.tar.gz
cd zabbix-3.0.0
cd ./configure --prefix=/usr/local/zabbix--enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp--with-libcurl --with-libxml2
make install
chown –R zabbix.zabbix /usr/local/zabbix
vim /etc/services
zabbix-agent 10050/tcp # Zabbix Agent
zabbix-agent 10050/udp # Zabbix Agent
zabbix-trapper 10051/tcp # Zabbix Trapper
zabbix-trapper 10051/udp # Zabbix Trapper
启动 mysql:
service mysqld start
mysql -uroot –p
建立zabbix数据库:
mysql> create database zabbix characterset utf8 collate utf8_bin;
mysql> grant all on zabbix.* to'zabbix'@'127.0.0.1' identified by '123' with grant option;
#mariadb 数据库使用:mysql> grant all privileges on zabbix.* tozabbix@localhost identified by 'zabbix';
mysql> source/usr/local/src/zabbix-3.0.0/
mysql> flush privileges;
mysql> exit;
从 zabbix 源码目录导入sql脚本:
mysql –uroot –p密码 zabbix < /usr/local/src/zabbix-3.0.0/database/mysql/schema.sql
mysql –uroot –p密码 zabbix < /usr/local/src/zabbix-3.0.0/database/mysql/data.sql
mysql –uroot –p密码 zabbix < /usr/local/src/zabbix-3.0.0/database/mysql/p_w_picpaths.sql
cd /usr/local/zabbix/etc
vi /usr/local/zabbix/etc/zabbix_server.conf
DBName=zabbix #数据库名称
DBUser=zabbix #数据库用户名
DBPassword=123456 #数据库密码
ListenIP=127.0.0.1 #数据库ip地址
2.6.1从源码目录复制启动脚本到/etc/init.d/
cp /usr/local/src/zabbix-3.0.0/misc/init.d/fedora/core5/zabbix_server /etc/init.d/
cp /usr/local/src/zabbix-3.0.0/misc/init.d/fedora/core5/zabbix_agend /etc/init.d/
2.6.2设置运行权限
chmod 700 /etc/init.d/zabbix_*
2.6.3修改启动脚本程序目录正确路径
vim/etc/init.d/zabbix_server
修改:
ZABBIX_BIN="/usr/local/sbin/zabbix_server"
为:
ZABBIX_BIN="/usr/local/srcx/sbin/zabbix_server"
vim/etc/init.d/zabbix_agentd
修改:
ZABBIX_BIN="/usr/local/sbin/zabbix_agentd"
为:
ZABBIX_BIN="/usr/local/src/sbin/zabbix_agentd"
2.6.4启动服务并设置开机启动
/etc/init.d/zabbix_server start
/etc/init.d/zabbix_agentd start
2.6.5设置开机启动
chkconfig –level 2345 zabbix_server on
chkconfig –level 2345 zabbix_agentd on
3.1.1从解压目录拷贝web代码
cp -rf /usr/local/src/zabbix-3.0.0/frontends/php /data/wwwroot/zabbix
代码目录 zabbix web 项目目录
3.1.2配置web目录权限归属为nginx运行用户www
Chown –R www:www /data/wwwroot/zabbix
3.2.1修改php/etc/php-fpm.d/www.conf.default或/etc/php.ini,下面值是最低要求:
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
# php_value date.timezone Europe/Riga
3.2.2修改php.ini
vim /usr/local/php/etc/php.ini
----------------------------------------->
date.timezone = Asia/Shanghai
post_max_size = 16M
max_execution_time = 300
max_input_time = 300
3.2.3启动php-fpm
service php-fpm start
vi/usr/local/nginx/conf/vhost/zabbix.test.com.conf
输入:
server {
listen 80;
server_name zabbix.test.com; #访问域名
access_log/data/wwwlogs/zabbix/zabbix.test.com_nginx.log combined;
index index.html index.htm index.php;
include /usr/local/nginx/conf/none.conf;
root /data/wwwroot/zabbix; #web根目录
location ~ [^/]\.php(/|$) {
#fastcgi_pass remote_php_ip:9000;
fastcgi_passunix:/dev/shm/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~.*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ {
expires 30d;
access_log off;
}
location ~ .*\.(js|css)?$ {
expires 7d;
access_log off;
}
}
启动nginx
service nginx start
打开nginx 配置的域名链接http://zabbix.test.com/setup.php,按如下配置:
LNMP 平台 php7 ,zabbix 安装可能会出现的问题 always-populate-raw-post-data = -1,解决方案:
vim /目录/zabbix/include/classes/setup/CFrontendSetup.php,找到下面代码、关于always-populate-raw-post-data;
添加 $current = -1;
public functioncheckPhpAlwaysPopulateRawPostData() {
$current =ini_get('always_populate_raw_post_data');
$current = -1;
return array(
'name' => _('PHPalways_populate_raw_post_data'),
'current' =>($current != -1) ? _('on') : _('off'),
'required' =>_('off'),
'result' =>($current != -1) ? self::CHECK_FATAL : self::CHECK_OK,
'error' => _('PHPalways_populate_raw_post_data must be set to -1.')
);
}
再回到页面刷新,正常:
输入要连接的数据库地址及zabbix数据库名:
可默认,下一步:
显示确认信息,下一步:
提示安装成功:
输入默认用户:Admin,密码:zabbi,点击”Sign in”登录,进入zabbix 界面:
登录后页面:
到时此,zabbix 安装完成。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。