How to Install Zabbix 3.0 Beta on CentOS 6

How to Install Zabbix 3.0 Beta on CentOS 6

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 post How to Install CentOS 6 for Zabbix if 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:
yum list installed | grep mysql
Expected output:
mysql-libs.x86_64    5.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!
yum remove mysql*
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 -ivh http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
Retrieving http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
Preparing...                ########################################### [100%]
   1:mysql-community-release########################################### [100%]
Install the MySQL server itself.
yum install mysql-server
If everything is correct then one of the outputs should 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-server  x86_64   5.6.26-2.el6  mysql56-community      53 M
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.
yum install vim -y
Open the MySQL configuration file with “vim” file editor. If you are new to vim then here is 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 any database.
[mysqld]
innodb_file_per_table
Save and close the file.
Start the MySQL service.
service mysqld start
Starting mysqld:                 [  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
Enter current password for root (enter for none):

Set root password? [Y/n] 

Remove anonymous users? [Y/n]

Disallow root login remotely? [Y/n]

Remove test database and access to it? [Y/n]

Reload privilege tables now? [Y/n]
Normally you should answer “Yes” to all these questions.
Log in to your MySQL instance with the password set in the previous step.
mysql -u root -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.
CREATE DATABASE zabbix CHARACTER SET utf8 COLLATE utf8_bin;
Create a database user, set password and grant privileges.
GRANT ALL PRIVILEGES ON zabbix.* TO zabbix@localhost IDENTIFIED BY 'your_password';
Just to be sure check that the database is created.
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| zabbix             |
+--------------------+
4 rows in set (0.00 sec)
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 could be a good choice therefore we will install it.
rpm -ivh http://repo.webtatic.com/yum/el6/latest.rpm
Now let’s install the required packages.
yum install httpd php56w php56w-gd php56w-mysql php56w-bcmath php56w-mbstring php56w-xml php56w-ldap
To run Zabbix some PHP options need to be modified as well.
vim /etc/php.ini
post_max_size=16M
max_execution_time=300
max_input_time=300
date.timezone=Europe/Riga
always_populate_raw_post_data=-1
Start the webserver.
service httpd start
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 -I INPUT -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
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 should appear.
If you have forgotten the IP address of your Zabbix server then have a look at the IP configuration.


Comments

Popular posts from this blog

ZCS Certificates Tools

Cara Shutdown Server CentOS

Error Zimbra karena hardisk Zimbra Penuh