Original link: http://www.leleblog.top/daily/more?id=6
Zabbix Source Code Compilation
Environment:
CentOS7, mysql5.6.21 (already present).
Mission Brief:
Server set up Zabbix operation and maintenance detection tools, monitoring server CPU, memory and other parameters, because the server already exists 5.6 version of MySQL, version conflict, can not use the Zabbix official installation process. Only source installation can be selected.
Steps:
1. Download Zabbix Source Package
wget http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3.4.2/zabbix-3.4.2.tar.gz/download
2. Install the compilation environment
(1), install the Yum Warehouse can be installed
Yum-y Install libxml2-devel libcurl-deve libevent libevent-devel
(2), net-snmp-devel requirements of the database version, so this also requires source code compilation installation.
3, Net-snmp-devel source installation
(1), download the source code
wget http://downloads.sourceforge.net/project/net-snmp/net-snmp/5.7.3/net-snmp-5.7.3.tar.gz
(2), unzip the source package
TAR-XZVF net-snmp-5.7.3.tar.gz
(3), configuration compilation
./configure--PREFIX=/USR/LOCAL/NET-SNMP
All direct carriage returns are encountered in the selection.
(4), compiling
Make && make install
There may be a problem with cloud not find Perl. Download Perl:
Yum Install Perl
(5), Configuration snmpd.conf
Copy the example.conf file to/usr/local/net-snmp/share/snmp first, and then rename it to snmpd.conf
sudo cp example.conf/usr/local/net-snmp/share/snmp/snmpd.conf
(6), start SNMP, enter the SNMP sbin directory.
./snmpd-c. /share/snmp/snmpd.conf
4. Configuring Zabbix Compilation Options
./configure--prefix=/usr/local/zabbix--enable-server--enable-agent--with-mysql=/usr/local/mysql57/bin/mysql_ Config--enable-ipv6--with-net-snmp--with-libcurl--with-libxml2
--prefix set Zabbix installation directory,--with-mysql set MySQL Mysql_config
A problem occurred: Mysqlclinet.so could not find it.
5, soft connection mysqlclinet to the public lib below.
A. Locate the mysqlclinet.so file using the Locate or find command
Example: Locate mysqlclinet.so
If you are prompted that the locate command does not exist, install Yum installed locate
B, the path found above the soft connection to/usr/local/lib/below
Ln-s/data/aicmp/reviewboard-2.5.16-0/mysql/lib/libmysqlclient.so/usr/local/lib//libmysqlclient.so
6. Compiling Zabbix
Back to the Zabbix source package directory, execute
Make && make install
The compilation is complete.
7. Start command set to service process
(1), CP misc/init.d/fedora/core/zabbix_server/etc/init.d/
(2), Chkconfig--add zabbix_server
(3), Chkconfig zabbix_server on
(4), CP misc/init.d/fedora/core/zabbix_agentd/etc/init.d/
(5), Chkconfig--add Zabbix_agentd
(6), Chkconfig Zabbix_agentd on
8. Configure zabbix-server R configuration file zabbix-server.conf
Vi/etc/zabbix/zabbix_server.conf
Modify the following options:
Dbhost=localhost # Data Host name
Dbname=zabbix # DB Instance
Dbuser=zabbix # User Name
Dbpassword=zabbix # Password
9. Start Zabbix Service
(1), service Zabbix_server start
(2), service Zabbix_agentd start
10, copy the Web application,/data/html is Nginx or Apache running PHP program directory, here use Apache server
MV zabbix/frontends/php//var/www/html/zabbix
11, configure the Apache server PHP page parsing. (PHP is not installed, the configuration file is written first)
At this time found that Zabbix Web services are written by PHP, so you need to install PHP and configure the APAHCE server PHP page parsing.
Vi/etc/httpd/conf/httpd.conf
Add the following options:
AddType application/x-compress. Z
AddType application/x-gzip. gz. tgz
AddType application/x-httpd-php. php
12, install PHP.
The direct installation of PHP is not feasible, CentOS7 comes with PHP version 5.4, for php-mysql support problems, here choose to install 5.6.
(1), Upgrade the Software warehouse
RPM-UVH https://mirror.webtatic.com/yum/el7/epel-release.rpm
RPM-UVH https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
(2), install PHP and its components
Yum install-y php56w php56w-opcache php56w-xml php56w-mcrypt php56w-gd php56w-devel php56w-intl php56w-mbstring php56w-f Pm
Php56w-mysql here because the MySQL version of the reason can not install, to find the corresponding Php-mysql download.
13, RPM installation Php-mysql, PHP-MYSQLND, Php-mysqli
Http://rpmfind.net is a RPM package link offering website.
wget download some rpm dependency packages:
Wget http://rpmfind.net/linux/mageia/distrib/5/x86_64/media/core/updates/lib64php5_common5-5.6.20-1.mga5.x86_64.rpm
RPM-IVH Command Installation
RPM-IVH lib64php5_common5-5.6.20-1.mga5.x86_64.rpm
And so on, install Php-mysql, PHP-MYSQLND, Php-mysqli
14. php-v command to check if PHP is running properly
Error:
PHP warning:php startup:unable to load Dynamic Library '/usr/lib64/php/modules/mysqlnd.so '-/usr/lib64/php/modules/mys Qlnd.so:cannot open Shared object file:no such file or directory in Unknown on line 0
PHP warning:php startup:unable to load Dynamic Library '/usr/lib64/php/modules/mysql.so '-/usr/lib64/php/modules/mysql . So:cannot open Shared object file:no such file or directory in Unknown on line 0
Obviously not normal, this is again mysql.so and mysqlnd.so these two things not in/usr/lib64/php/modules directory, mysqli.so is not, information is not posted out.
These three so files are below the/usr/lib64/php/extensions/, the three files are all soft connected to usr/lib64/php/modules under the OK.
For example:
Ln-s/usr/lib64/php/extensions/mysql.so/usr/lib64/php/modules/mysql.so
There are two extrapolate left.
At this time Php-v found that the operation is normal.
15. Start Apache Server
Service httpd Start
16. Visit http://ip:prot/zabbix/
A problem occurred:
Some parameters need to be set.
17. Set PHP Parameters
Vim/etc/php.ini
The options are as follows:
PHP option Memory_limit
128M
PHP option Post_max_size
16M
PHP option Upload_max_filesize
2M
PHP option Max_execution_time
300
PHP option Max_input_time
300
PHP Time Zone
Asia/shanghai
If there are other, follow the red letter prompts to set the options.
If you are prompted for a database that is not supported, then you have a problem with installing Php-mysql or php-mysqli before you check back.
18, set the order, login after the setup is complete.
Default account: admin Password: Zabbix
19, turn on the monitoring of the machine
The default is to turn off native monitoring
Manually turn on:configuration-> hosts-> Status--click not monitored
You can then view the CPU, memory, and other diagrams in the top menu bar graphs.
Daily work Zabbix source code compilation, compatible with mysql5.6