Construction of lamp+zabbix
Wget http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/2.4.6/zabbix-2.4.6.tar.gz
Wget http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3.0.1/zabbix-3.0.1.tar.gz
Wget http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3.0.4/zabbix-3.0.4.tar.gz
Wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/attic/libmcrypt/libmcrypt-2.5.7.tar.gz
Version 2.4.6 is recommended. Chinese is supported by default.
Lamp+zabbix
Environment
CentOS release 6.5
Httpd-2.4.12.tar.bz2
Cmake-2.8.10.2.tar.gz
Mysql-5.6.16.tar.gz
Php-5.4.19.tar.gz
Zabbix-2.2.6.tar.gz
Prepare the lamp environment
Cd / usr/local/src
# install the compilation environment
Yum-y install vim-enhanced gcc gcc-c++ flex bison autoconf automake bzip2-devel net-snmp-devel net-snmp\
Ncurses-devel zlib-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel libXpm-devel\
Gettext-devel pam-devel libtool libtool-ltdl openssl openssl-devel fontconfig-devel\
Libxml2-devel curl-devel libicu libicu-devel libmcrypt libmcrypt-devel libmhash libmhash-devel
# install apr (apr supports apache portable environment)
Tar-zxf apr-1.5.1.tar.gz
Cd apr-1.5.1
. / configure-- prefix=/usr/local/apr
Make & & make install
Cd..
Tar-zxf apr-util-1.5.4.tar.gz
Cd apr-util-1.5.4
. / configure-prefix=/usr/local/apr-util-with-apr=/usr/local/apr/
Make & & make install
Cd..
# install httpd
Tar-xf httpd-2.4.12.tar.bz2
Cd httpd-2.4.12
/ configure-- prefix=/usr/local/apache-- sysconfdir=/etc/httpd-- enable-so-- enable-rewrite-- enable-cgi-- enable-cgid-- enable-modules=most\
-enable-mods-shared=most-- enable-mpms-shared=all-- with-apr=/usr/local/apr-- with-apr-util=/usr/local/apr-util
Make & & make install
Cd..
# start httpd
/ usr/local/apache/bin/apachectl start
# install mysql (compiled through cmake)
Tar-xf cmake-2.8.10.2.tar.gz
Cd cmake-2.8.10.2
. / bootstrap-- prefix=/usr/local/cmake
Make & & make install
Cd..
Tar-zxf mysql-5.6.16.tar.gz
Cd mysql-5.6.16
/ usr/local/cmake/bin/cmake-DCMAKE_INSTALL_PREFIX=/usr/local/mysql-DSYSCONFDIR=/etc-DMYSQL_DATADIR=/usr/local/mysql/data-DMYSQL_TCP_PORT=3306-DWITH_READLINE=1\
-DMYSQL_UNIX_ADDR=/tmp/mysqld.sock-DMYSQL_USER=mysql-DEXTRA_CHARSETS=all-DWITH_EMBEDDED_SERVER=1-DENABLED_LOCAL_INFILE=1-DWITH_INNOBASE_STORAGE_ENGINE=14
Make & & make install
# initialize the database and start the database
Cd / usr/local/mysql/
. / scripts/mysql_install_db-- user=mysql
Cd / usr/local/src
Cp-p / usr/local/src/mysql-5.6.16/support-files/my-default.cnf / etc/my.cnf
/ usr/local/mysql/bin/mysqld_safe-user=mysql &
# create environment variables
Cat / etc/profile.d/mysqld.sh
Export PATH=$PATH:/usr/local/mysql/bin
Source / etc/profile.d/mysqld.sh
# create a mysql self-starting script
Cp-p / usr/local/src/mysql-5.6.16/support-files/mysql.server / etc/init.d/mysqld
Chmod + x / etc/init.d/mysqld
Chkconfig-add mysqld
# install the php plug-in
# wget http://www.boutell.com/gd/http/gd-2.0.33.tar.gz
# wget ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz
# wget http://nchc.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.8-config.tar.gz
# wget http://www.zlib.net/zlib-1.2.3.tar.gz
# wget http://prdownloads.sourceforge.net/freetype/freetype-2.1.10.tar.gz?download
# install zlib
Tar zxf zlib-1.2.3.tar.gz
Cd zlib-1.2.3
. / configure-prefix=/usr/local/zlib
Make
Make install
Cd..
# install libtool
Tar-zxf libtool-1.5.20.tar.gz
Cd libtool-1.5.20
. / configure
Make & & make install
Cd..
# install jpeg
Tar-zxf jpegsrc.v6b.tar.gz
Cd jpeg-6b
Cp / usr/share/libtool/config/config.guess.
Cp / usr/share/libtool/config/config.sub.
. / configure-enable-shared-enable-static
Make
Make install
Cd..
# install linpng
Tar zxf libpng-1.2.8.tar.gz
Cd libpng-1.2.8
Mv. / scripts/makefile.linux. / makefile
Make & & make install
Cd..
# install freetype
Tar-zxf freetype-2.1.10.tar.gz
Cd freetype-2.1.10
. / configure-- prefix=/usr/local/freetype
Make & & make install
Cd..
# install gd
Tar-zxf gd-2.0.33.tar.gz
Cd gd-2.0.33
. / configure-- with-png-- with-jpeg-- with-freetype=/usr/local/freetype
Make & & make install
Cd..
# install libmcrypt
Tar-xf libmcrypt-2.5.7.tar.gz
Cd libmcrypt-2.5.7
. / configure-- prefix=/usr/local/libmcrypt
Make & & make install
Cd / usr/local/src/php-5.4.19/ext/mcrypt/
. / configure-- with-php-config=/usr/local/php/bin/php-config
Make
Make install
# install php
Tar-zxf php-5.4.19.tar.gz
Cd php-5.4.19
. / configure-- prefix=/usr/local/php-- with-mysql=/usr/local/mysql-- with-openssl-- with-mysqli=/usr/local/mysql/bin/mysql_config-- enable-mbregex\
-with-freetype-dir-- with-jpeg-dir-- with-png-dir-- with-zlib-- with-libxml-dir=/usr-- enable-xml-- enable-sockets-- with-apxs2=/usr/local/apache/bin/apxs\
-with-mcrypt-- with-config-file-path=/etc-- with-config-file-scan-dir=/etc/php.d-- with-bz2-- enable-maintainer-zts-- disable-fileinfo-- with-gd-- enable-gd-native-ttf\
-with-zlib-dir=/usr/local/zlib-- with-png-- with-jpeg-- with-freetype-dir=/usr/local/freetype
Make & & make install
# if the following error occurs, reinstall the zlib library
/ usr/local/zlib/lib/libz.a: could not read symbols: Bad value
Collect2: ld returned 1 exit status
Make: * * [libphp5.la] error 1
Cd / usr/local/src/zlib-1.2.3
CFLAGS= "- O3-fPIC". / configure-- prefix=/usr/local/zlib/
Make
Make install
Make clean
# prepare the configuration file
Cp-p / usr/local/src/php-5.4.19/php.ini-production / etc/php.ini
# modify the apache configuration file to support php and add the following two lines
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
# configure php module
# gettext module
Cd / usr/local/src/php-5.4.19/ext
Cd gettext/
/ usr/local/php/bin/phpize
. / configure-- with-php-config=/usr/local/php/bin/php-config
Make
Make install
Cd..
# bcmath module
Cd bcmath/
/ usr/local/php/bin/phpize
. / configure-- with-php-config=/usr/local/php/bin/php-config
Make
Make install
Cd..
# mbstring module
Cd mbstring/
/ usr/local/php/bin/phpize
. / configure-- with-php-config=/usr/local/php/bin/php-config
Make
Make install
Sed-I'/ tab-width/a\ extension = "gettext.so"\ nextension = "bcmath.so"\ nextension = "mbstring.so" / etc/php.ini
# create a php page and determine whether to connect to mysql successfully
Cat / usr/local/apache/htdocs/index.php
It works!
# restart apache for testing
Elinks-- dump http://192.168.110.130
It works!
Connect to database successfully...
Cd / usr/local/src
# install zabbix
Groupadd zabbix
Useradd-g zabbix-m zabbix
Mkdir-p / etc/zabbix
# prepare the database environment
Create database zabbix character set utf8
Grant all privileges on zabbix.* to zabbix@192.168.110.130 identified by '123456'
Flush privileges
# Import database script
Tar-zxf zabbix-2.2.6.tar.gz
Cd / usr/local/src/zabbix-2.2.6
Mysql-uzabbix-h292.168.110.130-p123456 zabbix < database/mysql/schema.sql
Mysql-uzabbix-h292.168.110.130-p123456 zabbix < database/mysql/p_w_picpaths.sql
Mysql-uzabbix-h292.168.110.130-p123456 zabbix < database/mysql/data.sql
# compile and install zabbix
. / configure-- with-mysql=/usr/local/mysql/bin/mysql_config-- with-net-snmp\
-with-libcurl-- enable-server-- enable-agent-- enable-proxy-- prefix=/usr/local/zabbix
# Note:-- prefix specifies zabbix installation directory,-- enable-server supports zabbix server,-- enable-agent supports zabbix proxy,-- enable-proxy supports zabbix proxy server
-- with-mysql uses the MySQL client library to choose the path mysql_config,--with-net-snmp uses the net-snmp package, optionally specifies the path NET-SNMP configuration, and-- with-libcurl uses the curl package.
Make & & make install
# configure permissions
Cp conf/ {zabbix_server.conf,zabbix_agentd.conf} / etc/zabbix
Chmod 400 / etc/zabbix/zabbix_server.conf
Chown zabbix/ etc/zabbix/zabbix_server.conf
Chown-R zabbix:zabbix / etc/zabbix
Chmod 0755 / etc/zabbix/zabbix_server.conf
Ln-sf / usr/local/zabbix/etc/zabbix_server.conf / etc/zabbix/zabbix_server.conf
# modify parameters to configure zabbix server
Vim / etc/zabbix/zabbix_server.conf
LogFile=/tmp/zabbix_server.log
DBHost=192.168.110.130
Name of the database to which DBName=zabbix zabbix belongs
Users of the database to which DBUser=zabbix zabbix belongs
DBPassword=12345678 zabbix database password
DBSocket=/var/lib/mysql/mysql.sock
Initial value of StartPollers=30 polling (0-1000)
Initial value of StartIPMIPollers=4 IPMI polling (0-1000)
Number of unreachable hosts polled by StartPollersUnreachable=30 (including IPMI 0-1000)
Initial value of StartTrappers=8 capture (0-1000)
Initial value of StartPingers=4 ping (0-1000)
Initial value automatically discovered by StartDiscoverers=0 (0-250)
CacheSize=384M cache size
Frequency of CacheUpdateFrequency=300 cache updates
StartDBSyncers=8 database synchronization time
TrendCacheSize=128M general trend cache size
The location where AlertScriptsPath=/usr/bin scripts are stored
LogSlowQueries=1000 log slow query setting
# AlertScriptsPath=/usr/local/zabbix/scripts # specify the location where alarm scripts are stored
# configure php environment for zabbix
Cd frontends/
Cp-rf php / usr/local/apache/htdocs/
Cd / usr/local/apache/htdocs/
Mv php zabbix
Chown-R zabbix:zabbix zabbix
# Note: vi / etc/php.ini
Date.timezone = Asia/Shanghai
Sed-I "swarms, alwayspopulated, populated, rawable, postural data =-1#always_populate_raw_post_data =-1cm g" / etc/php.ini
Sed-I "fixtures _ pathin _ footing _ 0g" / etc/php.ini
Vim / etc/php.ini
Date.timezone = Asia/Shanghai
Max_execution_time = 300
Max_input_time = 300
Post_max_size = 32m
Memory_limit = 128m
# mbstring.func_overload = 2
# configure zabbix.conf.php # automatically generate web setup.php after running (modified according to environment)
Vi / usr/local/apache/htdocs/zabbix/conf/zabbix.conf.php