I. Environment Introduction
Zabbix depends on the LAMP (Apache, Mysql, and PhP) environment. Apache can also be replaced by Nginx. To save time, there are many one-click installation scripts on the Internet. download and execute the installation.
System: rhel 5.5 X86_64
Software: nginx-0.8.53
Mysql-5.1.56
Php-5.2.17
Zabbix 2.0.3
LNMP one-key: http://bbs.linuxtone.org/docs/autoinstall/lemp_auto_v1.0.6.tar.gz
Zabbix: http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/2.0.3/zabbix-2.0.3.tar.gz/download
Ii. LNMP Installation
Follow the instructions below tar zxvf lemp_auto_v1.0.6.tar.gz cd lemp./lemp. sh.
The first is to start the installation, and the second is to complete the installation. You can see the installation directory information of each software package from the second figure.
I would like to thank the script of the linuxtone forum for saving a lot of time for the experiment.
It should be noted that php compilation requires the following parameters: -- enable-mbstring, -- with-gettext, -- enable-bcmath, -- with-gd, my php compilation parameters are as follows:
. /Configure -- prefix =/usr/local/php -- with-config-file-path =/usr/local/php/etc -- with-mysql =/usr/local/mysql -- with-apxs2 =/usr/local/apache/bin/apxs -- with-ttf -- with-freetype-dir =/usr/local -- with-iconv-dir =/usr/local -- -curl =/usr/local -- with-zlib -- with-gettext -- with-libxml-dir =/usr/local -- with-gd =/usr/local -- with-png- dir -- enable-mbstring -- enable-exif -- enable-force-cgi-redirect -- enable-sysvmsg -- enable-sysvsem -- enable-sysvshm -- enable-calendar -- enable-gd-native- ttf -- enable-gd-jis-conv -- disable-debug -- disable-path-info-check -- enable-soap -- silent -- enable-sockets -- with-openssl -- enable-bcmath -- with-snmp -- with-jpeg-dir =/usr/local
Iii. Zabbix Installation
(1) other components required for zabbix installation in yum
yum -y install net-snmp-devel curl-devel
(2) Add zabbix users
Groupadd zabbix add zabbix group useradd zabbix-g zabbix create zabbix user and add it to zabbix Group
(3) decompress the software
tar zxvf zabbix-2.0.3.tar.gz cd zabbix-2.0.3
(4) Create a database for zabbix and add a user
Note: Use/etc/init. d/mysqld start to start the database in mysql-uroot-p and enter the default password 1 to log on to the database. Create database zabbix character set utf8; # create a database named zabbix grant all on zabbix. * to zabbix @ localhost identified by 'redhat'; # authorize zabbix to only allow zabbix users to log on locally. The password of zabbix users is redhat.
(5) import the data in the zabbix source code package to the newly created zabbix database.
Note: zabbix2.3 is different from other old versions. In Version 2.3, the structure and name of the database have changed, and the import must follow the order strictly. Mysql-uzabbix-p 'redhat 'zabbix </zabbix/zabbix-2.0.3/database/mysql/schema. SQL # This is the database table structure of zabbix, to pilot. Mysql-uzabbix-p 'redhat' zabbix </zabbix/zabbix-2.0.3/database/mysql/images. SQL mysql-uzabbix-p 'redhat' zabbix </zabbix/zabbix-2.0.3/database/mysql/data. SQL
(6) Compile and install
./configure --prefix=/usr/local/zabbix --enable-server --enable-proxy --enable-agent --with-mysql=/usr/local/mysql-5.2.17/bin/mysql_config --with-net-snmp --with-libcurlmakemake install
(7) Add a port for zabbix server
Vim/etc/services Add the following information: Listen-agent 10050/tcp zabbix Agent Zabbix-agent 10050/udp zabbix Agent Zabbix-trapper 10051/tcp zabbix Trapper Zabbix-trapper 10051
(8) copy the configuration file to the response directory.
Note: This step is also changed in version 2.0.3. The previous configuration files were stored in the misc/conf/directory under the source package. This is not the case. Mkdir/etc/zabbix cp-rf/zabbix/zabbix-2.0.3/conf/*/etc/zabbix # Note: versions above 2.0 do not need this step, the configuration files are installed in the/usr/local/zabbix/etc/directory by default.
(9) change the user name and password related to the database in the configuration file
Vim/etc/zabbix/zabbix_server.conf # files earlier than 2.0 and later versions are the files:/usr/local/zabbix/etc/zabbix_server.conf modify the following three items: DBName = zabbix DBUser = zabbix DBPassword = redhat Note: DBPassword is commented out by default.
(10) Soft link to the zabbix server program
cd /usr/local/zabbix/bin/ for i in *;do ln -s /usr/local/zabbix/bin/${i} /usr/bin/${i};done cd /usr/local/zabbix/sbin/ for i in *;do ln -s /usr/local/zabbix/sbin/${i} /usr/sbin/${i};done
(11) Add the database Lib file location to/etc/ld. so. conf and make it take effect.
echo /usr/local/mysql-5.1.48/lib/mysql/ >> /etc/ld.so.conf ldconfig
(12) copy the corresponding web program to the relevant WEB service directory
cp -r zabbix-2.0.3/frontends/php /data/www/wwwroot/zabbix
(13) copy the zabbix server and client STARTUP script to the/etc/init. d directory.
Note: the directory structure of the script stored in this place has also changed, and there is no redhat Directory, so the startup script in my cp gentoo directory can be read for specific differences. Cp zabbix-2.0.3/misc/init. d/zabbix_server/etc/init. d chmod + x/etc/init. d/zabbix_server # Add executable rights to the script cp zabbix-2.0.3/misc/init. d/zabbix_agentd/etc/init. d chmod + x/etc/init. the d/zabbix_agentd document says that you want to change the path in the startup script, but it is incorrect after I change it, so it is not changed.
(14) Start zabbix and add auto-start upon startup
Service zabbix-server start service zabbix-agentd start # start the chkconfig zabbix-server on chkconfig zabbix-agentd on # start automatically
(15) Add a zabbix vm to the Nginx Service
vim /usr/local/nginx/conf/vhosts/monitor.conf server { listen 80; server_name zabbixA.cyhd.com.cn; #access_log logs/zabbix_access.log main; location / { root /data/www/wwwroot/zabbix; index index.html index.htm index.php; } location ~ \.php$ { root /data/www/wwwroot/zabbix; fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_index index.php; include fastcgi_params; } }
(16) Start nginx and add auto-start upon startup
service nginx start chkconfig nginx on
(17) modify the PHP configuration file php. ini content
Vim/usr/local/The php-5.2.17/etc/php. ini date. timezone = Asia/Shanghai post_max_size = 32 M max_execution_time = 300 M max_input_time = 300 M Note: restart nginx and php after the change
(18) Start and restart php
Default boot is started pkill php # Close php can also be through the following command/usr/local/php-5.2.17/sbin/php-fpm start | stop boot restart is best to use ps-ef | grep php View
4. browser Installation
(1) Open the newly installed zabbix in the browser.
Http: // IP
(2) Check php components. Click next only when all php components are OK.
Note: Some changes need to be made here. PHP gettext in the last column must be in the No state. Because PHP gettext is not added to LNMP, php is compiled dynamically. Cd lemp/packages # This directory is a key to install the source package storage location tar-zxvf php-5.2.17.tar.gz # extract php source package cd php-5.2.17/ext/gettext # php comes with this, only the/usr/local/php-5.2.17/bin/phpize # command is not added during compilation. /configure -- with-php-config =/usr/local/php-5.2.17/bin/php-config # recompile php make & make install # Installation
Vim/usr/local/php-5.2.17/etc/php. ini
The last 16th rows are changed to extension = "gettext. so"
Save and exit. Restart php!
(3) connect to the zabbix Database
(4) set the zabbix service IP address and port. The name can be ignored.
(5) preview settings
(6) If you forget this step, click Down to download the php generated file to your local computer and upload it to/data/www/wwwroot/zabbix/conf, you can also use the local notepad to open zabbix. conf. php, copy the content in the file, in vim/data/www/wwwroot/zabbix/conf/zabbix. conf. php, paste the copied content to the next time, save and exit, and click try connection test. OK is displayed.
(7) enter the user name and password to log on
Default username: admin Password: zabbix
The installation on this server is complete.