first, environmental preparedness
Host and software preparation
Os:centos 6.7x86_64
Zabbix version: zabbix-3.0.2
MySQL version: MariaDB10.1.13
Nginx Version: nginx-1.8.0
PHP Version: php-5.6.1
Host IP Planning:
Host ip:192.168.3.45
Host Resource planning:
Memory: More than 2GB
Host partition:/TMP partition at least 2G above, MySQL data disk 20G above
Second, basic component Installation (LNMP)
1), the basic software Installation
#yum-y install curlcurl-devel net-snmp SNMP net-snmp-devel libssh2-devel
2), MARIADB installation
Refer to "install_mariadb.sh"
3), Nginx installation
Refer to "install_nginx.sh "
4), PHP installation
Refer to "install_php.sh"
Third, installation configuration
1), create Zabbix process users and groups
#groupadd Zabbix
#useradd-G zabbix-s/sbin/nologin-m Zabbix
2), extract the uploaded Zabbix file to the specified directory/mnt/tmp/
#tar ZXVF zabbix-3.0.2.tar.gz
#cd zabbix-3.0.2
3), create Zabbix database and import Zabbix database data (server)
Mysql-uroot-p
Enter Password
MySQL >create database Zabbix character set UTF8;
MySQL >grant all privileges on zabbix.* to zabbix@localhostidentified by ' 123456 ';
MySQL >flush privileges;
MySQL >use Zabbix
MySQL >source/tmp/zabbix-3.0.2/database/mysql/data.sql
MySQL >source/tmp/zabbix-3.0.2/database/mysql/images.sql
Validating databases and tables
MySQL > Use Zabbix
MySQL >selectcount (*) tables, table_schema from information_schema.tables where table_schema= ' Zabbix ' GROUP by Table_ Schema
Partial screenshot:
iv. Zabbix Compilation and service opening:
1), Zabbix compile installation
#cd/tmp/zabbix-3.0.2
#./configure--prefix=/usr/local/zabbix--enable-server--enable-agent--with-mysql--with-net-snmp--with-libcurl-- WITH-LIBXML2--WITH-SSH2
If the results are displayed when the compilation is complete, you can perform make&& make install
# make&& make Install
Verifying installation Results
Server-side Program validation:
# cd/usr/local/zabbix/sbin/
#./zabbix_server-v
If you have an error:
Error while loading shared Libraries:libmysqlclient.so.18:cannot open shared object File:no such
Workaround: Add mysqlclient dynamic link library
# ln-s/usr/local/mysql/lib/libmysqlclient.so.18/usr/lib64/libmysqlclient.so.18
Client program Validation
# cd/usr/local/zabbix/sbin/
#./zabbix_agentd-v
At this point, the compilation installation completes
2), service start-up and configuration:
Copy-supplied INIT.D boot script to the system
#cd/tmp/zabbix-3.0.2
#\cp-rfp misc/init.d/fedora/core/*/etc/init.d/
Edit the startup script to suit your installation environment
To modify a server-side startup file:
#vi/etc/init.d/zabbix_server
Replace basedir=/usr/local/with Basedir=/usr/local/zabbix (where the above step is compiled)
To modify client-side startup files:
#vi/etc/init.d/zabbix_agentd
Replace basedir=/usr/local/with Basedir=/usr/local/zabbix (where the above step is compiled)
3), edit zabbix_server configuration file (/usr/local/zabbix/etc/zabbix_server.conf)
Modifying the Zabbix server configuration file
#cd/usr/local/zabbix/etc
#cp zabbix_server.conf Zabbix_server.conf.bak
#vi zabbix_server.conf
Dbhost=localhost #数据库连接地址
Dbname= Zabbix #zabbix使用的数据库名称
Dbuser=zabbix #zabbix数据库连接用户名
dbpassword=123456
dbport=3306
Logfile=/var/log/zabbix/zabbix_server.log #日志存放路径设置
logfilesize=10 #日志大小限制
# #没有特殊需求配置到这里就OK了
Startpollers=30 #开启多线程数, generally not more than 30
Starttrappers=20 #trapper线程数
startpingers=10 #fping线程数
startdiscoverers=120
maxhousekeeperdelete=5000
cachesize=1024m #用来保存监控数据的缓存数, according to the number of monitoring host appropriate adjustment
Startdbsyncers=8 #数据库同步时间
historycachesize=1024m
trendcachesize=128m #总趋势缓存大小
historytextcachesize=512m
logslowqueries=1000
4), add Zabbix service corresponding port:
#vi/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
5), Zabbix.log directory creation and authorization
#mkdir/var/log/zabbix
#chown Zabbix:zabbix/var/log/zabbix
#chmod-R 775/var/log/zabbix/
6), service start-up and configuration verification
Zabbix_server End Verification:
#/etc/init.d/zabbix_server start
#/etc/init.d/zabbix_serverstatus
7), add boot service
#chkconfig--add Zabbix_server
#chkconfig--level Zabbix_server on
#chkconfig--add Zabbix_agentd
#chkconfig--level Zabbix_agentd on
At this point, the program configuration is complete
Fifth, the replication and installation of Web files
1), Web file copy
#cd/tmp/zabbix-3.0.2
#mkdir-P/var/www/zabbix
#\cp-rfp frontends/php/*/var/www/zabbix/-R
#chown-R Root.root/var/www/zabbix
2), configure Nginx:
Add the following content
#vi/usr/local/nginx/conf/nginx.conf
server {
Listen 80;
server_name localhost;
Root/var/www/zabbix;
Index index.html index.htm index.php;
Location/{
Try_files $uri $uri//index.php$is_args$args;
}
Location ~ \.php$ {
Try_files $uri = 404;
Include fastcgi.conf;
Fastcgi_pass 127.0.0.1:9010;
}}
Restart the Nginx service
#service nginx Restart
3), perform setup.php start installation
Then enter in the browser: http://192.168.3.45 and then "NEXT"
Check the PHP support environment
The default php.ini of this step are generally error:
Modify/usr/local/php56/etc/php.ini to resolve
Post_max_size = 16M
Max_execution_time = 300
Max_input_time = 300
Date.timezone = "Asia/shanghai"
Always_populate_raw_post_data =-1
Restart PHP-FPM
#/etc/init.d/php-fpm56 restart
Refresh the page, all errors have been resolved, click Next
"Database Host" here recommends you enter 127.0.0.1
To handle this fail is to download the zabbix.conf.php to the local computer and upload it to the server specified directory/var/www/zabbix/conf
Refresh the page and click Finish
If there is no exception, you can click "Finish".
Login account: admin password: Zabbix
http://192.168.3.45
Exception resolution:
1), Chinese font garbled problem
Replace the Dejavusans.ttf file
# Ls/var/www/zabbix/fonts/dejavusans.ttf
2), open the Web interface Chinese support
#vi/var/www/zabbix/include/locales.inc.php
This ' ZH_CN ' => Array (' name ' => _ (' Chinese (zh_cn) '), ' Display ' => true)
3), Guest user must be closed
Click "Admin"--> user group--> Select guests--> Click "Disable"