Zabbix installation (Ubuntu)

Source: Internet
Author: User
Tags fpm openssl snmp

Installation of Zabbix
  • The Zabbix monitoring architecture requires at least server,agent,web modules. MySQL, Web Parts, and servers are installed on the same machine.
  • Zabbix pre-installation server to do time synchronization (NTP)

1. Create users and user groups (Zabbix by default with Zabbix users)

Groupadd Zabbix adduser Zabbix adduser Zabbix Zabbix

1. Installation dependencies
    • There may be a lack of dependencies during the installation process, install it slowly! A little Keng.
sudo apt-get install libxml2-devsudo apt-get  install Libxml2sudo apt-get  Install Makesudo apt-get  install Zlib1g.devsudo apt-get  Install Zlib1gsudo apt-get install libcurl4-openssl-devsudo apt-get install libjpeg- Devsudo apt-get install Libpng-dev

  • This error occurred, missing BZIP2

Workaround: Download bzip2-1.0.6.tar.gz
Make && sudo make install

2. Install PHP
#安装编译套件sudo apt-get install build-Essential #安装php前端需要的包sudo apt-get Install Libmysqlclient15-dev php5-gd php5-mysql libfreetype6-dev# Install Zabbix required package, Snmp\curl\ssl\fpingsudo apt-get Install SNMP libsnmp-dev snmpd libcurl4-openssl-Dev fpingsudo apt-get install  PHP5-FPM

  • Download PHP
wget http://cn2.php.net/get/php-5.5.35.tar.gz/from/this/mirror

  • Install compile
MV Mirror php-5.5. *. tar.gz && Tar xvf php-5.5. *. tar.gz && CD php-5.5. *./configure--prefix=/usr/local/product/php-5.5. *--with-config-file-path=/usr/local/product/php-5.5. */etc--with-bz2--with-curl--enable-ftp--enable-sockets--disable-ipv6--with-gd--with-jpeg-dir=/usr/local-- With-png-dir=/usr/local--with-freetype-dir=/usr/local--enable-gd-native-ttf--with-iconv-dir=/usr/local-- Enable-mbstring--enable-calendar--with-gettext--with-libxml-dir=/usr/local--with-zlib--with-pdo-mysql=mysqlnd- -with-mysqli=mysqlnd--with-mysql=mysqlnd--enable-dom--enable-xml--enable-fpm--with-libdir=lib64--enable-Bcmathmake&&Make Installln-s/usr/local/product/php-5.5. */usr/local/PHPCP php.ini-production/usr/local/php/etc/Php.inicd/usr/local/php/etc/cp PHP-fpm.conf.defaultPhp-fpm.conf

  • To modify the PHP parameters, you can use the Find command to view
Find/-name php.ini-/etc/php5/cgi/php.ini

  • Make the following changes
sudo vim/etc/php5/apache2/= "  Asia/shanghai"

3.MySQL part
mysql> use mysql,mysqlset  utf8, MySQL>grant all privileges in zabbix.* to [email protect Ed]'%''zabbix'; MySQL>flush privileges;  

  • Importing database tables
CD  zabbix-3.2.  6/database/-uroot-proot Zabbix <-uroot-proot Zabbix <-uroot-proot Zabbix < Data.sql

4. Compile and install zabbix4.1 download and install Zabbix

Url:

-xvzf zabbix-3.2. 6 . TAR.GZCD Zabbix-3.2. 6/sudo. /configure--prefix=/usr/local/zabbix--enable-server--enable-agent--enable-proxy--with-mysql--WITH-NET-SNMP-- With-libcurl--enable--j4make Install

After executing the above command, Zabbix is installed successfully, the location is/usr/local/zabbix, and –enable-server and –enable-agent are both server and agent enabled. And the following parameters are added to the server

  • Modify the configuration server file
Mkdir-p/etc/-R zabbix-3.2. 6/conf* / /etc/zabbix/chown-r Zabbix:zabbix/etc/zabbix vim/etc/zabbix/zabbix_server.conf 

  • Make the following changes
logfile=/tmp/zabbix_server.logpidfile=/tmp/zabbix_server.piddbname=Zabbixdbuser= Zabbixdbpassword=zabbixdbport=3306   

进入zabbix的安装目录下,sbin/zabbix_server启功server,关闭用kill
vim /etc/zabbix/zabbix_agentd.conf

  • Set Zabbix boot up
sudo cp misc/init.d/debian/zabbix-server/etc/init.dsudo CP misc/init.d/debian/zabbix-agent/etc/!  755 zabbix-*sudo update-rc.d zabbix-server defaultssudo update-RC.D zabbix-agent Defaults

  • Make the following changes
server=127.0. 0.1   #允许server获取数据 (changed to ServerIP)     serveractive=127.0.  0.1  #主动给server推送数据 (changed to ServerIP)    Hostname=zabbix Server

4.2 Agent Installation
  • Install Agent only
Tar-xvzf zabbix-3.2. 6 . TAR.GZCD Zabbix-3.2. 6/. /configure--prefix=/opt/zabbix--enable--G Zabbix Zabbix #sudo gpasswd-a  Zabbix-p/etc/  -R zabbix-3.2. 6/conf* / /etc/zabbix/chown-r zabbix:zabbix/etc/zabbixvim/etc/zabbix/zabbix_agent.conf server=192.168.0.157 serveractive=192.168.0.157 Hostname=bigdata2 (with a unique name)

5.nginx (Web Configuration)
  • Co-locate Zabbix Web services for Nginx access
sudo mkdir/usr/share/nginx/html/zabbix/cd Zabbix-3.2. 6/frontends/-R php/*  /usr/share/nginx/html/zabbix#/usr/share/nginx/html/zabbix/ conf/zabbix.conf.php Saving Zabbix connection Information

  • modifying Nginx configuration Files
sudo vim/etc/nginx/Nginx.confuser www-data;worker_processes4;p ID/run/nginx.pid;events {worker_connections768; # multi_accept on;}    HTTP {# # # Basic Settings # # sendfile on;    Tcp_nopush on;    Tcp_nodelay on; Keepalive_timeout $; Types_hash_max_size2048;    # Server_tokens off; # server_names_hash_bucket_size -;    # server_name_in_redirect off; Include/etc/nginx/mime.types; Default_type Application/octet-stream; # # # # Logging Settings # # Access_log/var/log/nginx/Access.log; Error_log/var/log/nginx/Error.log;    # # # gzip Settings # # gzip on; Gzip_disable"Msie6"; # # # Virtual Host configs # # include/etc/nginx/conf.d/*. conf;    include/etc/nginx/sites-enabled/*;        server {Listen 8088; server_name localhost;         # Access_log/var/log/nginx/zabbix.log Main;        root/usr/share/nginx/html/zabbix/; Index index.php;location/{try_files $uri $uri//index.php? $args;}        Location ~ \.php$ {try_files $uri = 404;    Fastcgi_split_path_info ^ (. +\.php) (/.+) $; # # Note:you should has "cgi.fix_pathinfo = 0;" In PHP.ini # # # with php5-cgi alone: # fastcgi_pass 1    27.0.0.1:9000;        # # with Php5-fpm:fastcgi_pass Unix:/var/run/php5-fpm.sock;        Fastcgi_index index.php;        Fastcgi_param Script_filename/usr/share/nginx/html$fastcgi_script_name;    Include Fastcgi_params; }}}

6. Install under Ubuntu

1. Install the server

wget http://repo.zabbix.com/zabbix/3.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.0-1+ Trusty_all.deb dpkg-i zabbix-release_3. 0-1+trusty_all.deb apt-get  update apt-get install  php5 zabbix-frontend-php php5-mysql sudo apt-get install zabbix-server-/etc/zabbix/  zabbix_server.conf  dbhost=localhost   DBName=Zabbix   DBUser=  Zabbix   Dbpassword

# Configure PHP sudo vim/etc/php5/apache2/php.ini Modify Entry: Post_max_size=16M Max_execution_time= -Max_input_time= -Date.timezone="Asia/shanghai"Restart apache2 After the modification is complete/etc/init.d/apache2 Restart configuration database First MySQL configuration CD/etc/Mysqlsudo vim my.cnf comment out the following line #bind-address =127.0.0.1MySQL>create Database Zabbix characterSetUTF8 collate utf8_bin; MySQL>grant all privileges in zabbix.* to [e-mail protected] identified by'Zabbix'; MySQL>flush Privileges; sudo apt-GetInstall zabbix-frontend-PHP (Database root,root,root) sudo cp-r/usr/share/zabbix/var/www/html/zabbix

    • Initializing the database
cd/usr/share/doc/zabbix-server-

    • Restart
sudo/etc/init.d/zabbix-Server Stop     

    • Install agent (do not repeat)
wget http://repo.zabbix.com/zabbix/3.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.0-1+ Trusty_all.deb dpkg-i zabbix-release_3. 0-1+trusty_all.deb apt-get install Zabbix-agent

sudo vim/etc/zabbix/zabbix_agentd.conf make the following modifications to Server=192.168. 0.157 serveractive=192.168. 0.157 Hostname=bigdata2

    • Because the agent process is started when the agent is installed, the agent service is restarted after the configuration file is modified.
sudo service zabbix-agent restart

7. Configure the Chinese environment
/usr/share/zabbix/include/locales.inc.php put the zh_cn back parameter write true and then install the Chinese package sudo apt-get Install Language-pack-zh-hant language-pack-zh-/etc/Environment Add language and encoding settings to the file: LANG="zh_ CN. UTF-8"  LANGUAGE="zh_CN:zh:en_US:en" Next, reset the local configuration: dpkg -reconfigure locales last restart Apache,server service

7. Solve Chinese garbled characters
    • In the directory where the frontend page of Zabbix is located, you can find the directory like this
sudo find / -name defines.inc.php  -print

1. Download the Simkai.ttf file to the web and upload it to the/usr/share/zabbix/fonts directory.

2. Modify the configuration
sudo vim /usr/share/zabbix/include/defines.inc.php


Restart the Web service.

restart

Zabbix installation (Ubuntu)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.