您好,登錄后才能下訂單哦!
操作系統版本: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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。