Install Zabbix 3.0 Beta in CentOS 6

Source: Internet
Author: User

Install Zabbix 3.0 Beta in CentOS 6
How to Install Zabbix 3.0 Beta on CentOS 6

Posted onJanuary 26,201 6 byIngus

The long awaited Zabbix 3.0 beta 1 is here. Now we are eager to see what it brings us therefore there is no better way to find that out than installing it and trying on our systems.

In this tutorial we will be installing it on a blank CentOS 6.7 operating system. Check out our previous postHow to Install CentOS 6 for Zabbixif you 'd like to start with a short tutorial how to install CentOS itself.

But now let's get started with the actual installation of Zabbix 3.0 beta 1. first we will prepare database, then web server and once that is done we will install Zabbix server, agent and web interface.

Prepare database

Before we even start with Zabbix we need to install a database for it. And here we will use the latest version of MySQL.
CentOS by default is supplied with a very old version of MySQL-5.1. We can check that by running:

yumlistinstalled|grepmysql

Expected output:

mysql-libs.x86_645.1.73-5.el6_6@anaconda-CentOS-201508042137.x86_64/6.7

Although a basic installation of Zabbix can run on MySQL 5.1, it is highly recommended to use a more up-to-date version, which is 5.6 currently. therefore we have to remove the old version first.

Please be aware of what you are doing. Never do this on a production system where existing MySQL instances might be running!

yumremovemysql*

Then we need to install the MySQL repository configuration package. We pick the right version for our CentOS 6 system from here: http://dev.mysql.com/downloads/repo/yum/

Install the repository.

rpm-ivhhttp://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
Retrievinghttp://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpmPreparing...###########################################[100%]1:mysql-community-release###########################################[100%]

Install the MySQL server itself.

yuminstallmysql-server

If everything is correct then one of the outputs shocould install mysql-community-server along with 10 other dependencies. Double check that you are going to install MySQL version 5.6.x.

Installing:mysql-community-serverx86_645.6.26-2.el6mysql56-community53M

Read all questions you might be asked during the install but most likely you need to answer "yes" by pressing "y" key.

Before starting up the database we have to edit the MySQL configuration file but to open a file we need some text editor. here you can use whichever you want, but in the tutorial we will be using vim, so here is how to install it.

yuminstallvim-y

Open the MySQL configuration file with "vim" file editor. If you are new to vim thenhereis a quick tutorial on that.

vim/etc/my.cnf

This file consists of multiple sections. At this point we will not do much tuning and only add one setting under the [mysqld] section, which is important prior to creation of database any.

[mysqld]innodb_file_per_table

Save and close the file.

Start the MySQL service.

servicemysqldstart
Startingmysqld:[OK]

It is highly recommended to secure your database and specify a password for the "root" account, remove anonymous logins etc. It is done by following all instructions after the MySQL secure installation.

mysql_secure_installation
Entercurrentpasswordforroot(enterfornone):Setrootpassword?[Y/n]Removeanonymoususers?[Y/n]Disallowrootloginremotely?[Y/n]Removetestdatabaseandaccesstoit?[Y/n]Reloadprivilegetablesnow?[Y/n]

Normally you shoshould answer "Yes" to all these questions.

Log in to your MySQL instance with the password set in the previous step.

mysql-uroot-p

Create a new database for Zabbix. It is very important to also specify the character set and collation otherwise the database will be case insensitive.

CREATEDATABASEzabbixCHARACTERSETutf8COLLATEutf8_bin;

Create a database user, set password and grant privileges.

GRANTALLPRIVILEGESONzabbix.*TOzabbix@localhostIDENTIFIEDBY'your_password';

Just to be sure check that the database is created.

mysql>showdatabases;+--------------------+|Database|+--------------------+|information_schema||mysql||performance_schema||zabbix|+--------------------+4rowsinset(0.00sec)

If everything is fine then exit the database for now.

exit
Prepare web server

Beside a database we also need a web server therefore we will install Apache and PHP.

Zabbix 3.0 requires PHP to be at least version 5.4 or higher. Our CentOS 6.7 repositories come with PHP 5.3.3 therefore we need to install a newer one.

To do this we need a repository that contains all our required packages. Webtatic cocould be a good choice therefore we will install it.

rpm-ivhhttp://repo.webtatic.com/yum/el6/latest.rpm

Now let's install the required packages.

yuminstallhttpdphp56wphp56w-gdphp56w-mysqlphp56w-bcmathphp56w-mbstringphp56w-xmlphp56w-ldap

To run Zabbix some PHP options need to be modified as well.

vim/etc/php.ini
post_max_size=16Mmax_execution_time=300max_input_time=300date.timezone=Europe/Rigaalways_populate_raw_post_data=-1

Start the webserver.

servicehttpdstart

Currently we will not be able to connect to our webserver because of internal firewall rules therefore we need to enable port 80 on iptables.

iptables-IINPUT-ptcp--dport80-mstate--stateNEW,ESTABLISHED-jACCEPT

Save the firewall rule.

iptables-save>/etc/sysconfig/iptables

Now we can open our local web browser and enter the IP address of your Zabbix server. The Apache landing page shoshould appear.

If you have forgotten the IP address of your Zabbix server then have a look at the IP configuration.

ipa

Download and install Zabbix 3.0

Now we are getting closer to Zabbix itself.

Before installing Zabbix we need to ensure we have a user group and user account for it because Zabbix is not meant to be run under the "root" account.

groupaddzabbixuseradd-gzabbixzabbix

Create a directory where downloaded source files will be stored.

mkdir/home/zabbix/downloads

Move to the newly created directory.

cd/home/zabbix/downloads

Install "wget" to download files from the internet.

yuminstallwget-y

Go to the Zabbix websitehttp: // www.zabbix.com/download.phpand download the source archives for the latest Zabbix 3.0.0beta1.

It is recommended that you do it from your command line directly.

wget"http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Development/3.0.0beta1/zabbix-3.0.0beta1.tar.gz"

Extract the downloaded archive.

tar-zxvfzabbix-3.0.0beta1.tar.gz

Go to the directory where Zabbix database schema for MySQL is stored.

cd/home/zabbix/downloads/zabbix-3.0.0beta1/database/mysql

Import the database schema. Provide the password you set when creating the Zabbix user for database.

mysql-uzabbix-pzabbix<schema.sql

!! Don't import the next two files in case you are preparing a database for Zabbix proxy.

Do the same for images and data as well. Note that it is important in what order you import the schema files therefore always start with schema then images and then data.

mysql-uzabbix-pzabbix<images.sqlmysql-uzabbix-pzabbix<data.sql

When the database is prepared, we will have to compile Zabbix from sources. during this process some additional packages are required therefore we will install them first. it is not a big problem if we don't but then we will end up with errors during the install.

yuminstallgccmysql-community-devellibxml2-develunixODBC-develnet-snmp-devellibcurl-devellibssh2-develOpenIPMI-developenssl-developenldap-devel

When done, go up two folders.

cd../..

If required, read more on how to configure installation.

./configure--help

Configure all components required for Zabbix.

./configure--enable-server--enable-agent--with-mysql--enable-ipv6--with-net-snmp--with-libcurl--with-libxml2--with-unixodbc--with-ssh2--with-openipmi--with-openssl

After successful compilation we are ready to install everything.

************************************************************Nowrun'makeinstall'****ThankyouforusingZabbix!**

To do so just run the following command.

makeinstall

Before starting Zabbix server we need to modify its configuration file in order to connect to the database.

vim/usr/local/etc/zabbix_server.conf

Replace the values with the actual ones you used during the database setup.

DBName=zabbixDBUser=zabbixDBPassword=your_password

Create a new directory for web frontend files.

mkdir/var/www/html/zabbix

Move to the downloaded web interface sources.

cd/home/zabbix/downloads/zabbix-3.0.0beta1/frontends/php/

Copy all files to the server web directory.

cp-a./var/www/html/zabbix/

By default CenoOS comes with the SELinux option enabled. While it can be sometimes in your way and difficult to manage, it is recommended to leave it on.

Let's create a rule to allow our web server to access the frontend files.

chcon-Rv--type=httpd_sys_content_t/var/www/html

While we are still at SELinux, let's allow also Apache and Zabbix to connect to network.

setsebool-Phttpd_can_network_connect=1setsebool-Pzabbix_can_network=1

Set Apache user as owner of the web interface files.

chown-Rapache:apache/var/www/html/zabbix

Add permissions to execute files for Zabbix web interface.

chmod+x/var/www/html/zabbix/conf/

Add Zabbix server and Zabbix agent to startup scripts.

cp/home/zabbix/downloads/zabbix-3.0.0beta1/misc/init.d/fedora/core/zabbix_server/etc/init.d/zabbix_servercp/home/zabbix/downloads/zabbix-3.0.0beta1/misc/init.d/fedora/core/zabbix_agentd/etc/init.d/zabbix_agentd

Add Zabbix server and Zabbix agent as services.

chkconfig--add/etc/init.d/zabbix_serverchkconfig--add/etc/init.d/zabbix_agentd

Enable Zabbix server, Zabbix agent, Apache and MySQL services on boot.

chkconfighttpdonchkconfigmysqldonchkconfigzabbix_serveronchkconfigzabbix_agentdon

Start Zabbix server.

servicezabbix_serverstart

Start Zabbix agent.

servicezabbix_agentdstart

Finally it is time to proceed to the frontend installation in your web browser.

Use the same address you have for your server now and add/zabbix to the URL.

Check for pre-requisites and fix errors if you have any.

Enter settings to connect to database.

Enter details to connect to web interface.

The "Name" field can be left blank or you can enter a name that will appear on each page.

Review the last settings in the next page and if all is good your Zabbix shocould be able to automatically create configuration files.

Connect to the Zabbix web interface with default credentials.

Username:Admin
Password:zabbix

And this is the new web interface.

Congratulations! You have installed the new Zabbix 3.0. Have fun! Don't forget to check ourdocumentationfor 3.0. And stay tuned for next tutorials and articles where we will cover the main features of Zabbix 3.0 and do lots of useful configuration.

Related Article

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.