Sie sind auf Seite 1von 8

Zabbix

Installation steps for Zabbix which is an enterprise open source monitoring


system.
Find the URL : http://www.server-orld.info/en/note?os=CentOS_6&p=zabbix

Find Below the Installations steps:

1.Install Apache httpd


Install httpd to configure Web server. HTTP uses 80/TCP.

[1].Install httpd.
[root@www ~]# yum -y install httpd
# remove welcome page

[root@www ~]# rm -f /etc/httpd/conf.d/welcome.conf

# remove default error page

[root@www ~]# rm -f /var/www/error/noindex.html

[2].Configure httpd.

[root@www ~]# vi /etc/httpd/conf/httpd.conf


# line 44: change
ServerTokens Prod
# line 76: change to ON
KeepAlive On
# line 262: Admin's address
ServerAdmin root@shrriamzabbix
# line 338: change
AllowOverride All
# line 276: change to your server's name
ServerName www.shriramzabbix:80
# line 402: add file name that it can access only with directory's name
DirectoryIndex index.html index.php
# line 536: change
ServerSignature Off
# line 759: comment out
AddDefaultCharset UTF-8
[root@www ~]#
iii. Create a HTML test page and access to it with a web browser on Client to make
sure it works normally.
[root@www ~]# vi /var/www/html/index.html
<html>
<body>
<div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">
Test Page
</div>
</body>
</html>

2. Install PHP
[root@www ~]# yum -y install php php-mbstring php-pear
[root@www ~]# vi /etc/httpd/conf/httpd.conf
# line 402: add file name that it can access only with directory's name
DirectoryIndex index.html index.php
[root@www ~]# vi /etc/php.ini
# line 946: set you timezone
date.timezone = "Asia Kolkata"
[root@www ~]# /etc/rc.d/init.d/httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]

Create a PHP test page and access to it with a web browser on Client to make sure it
works normally.

[root@www ~]# vi /var/www/html/index.php


<html>
<body>
<div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">
<?php
print Date("Y/m/d");
?>
</div>
</body>
</html>
[root@www ~]#
3.Install MySQL
[1].install mysql:
[root@www ~]# yum -y install mysql-server
[root@www ~]# vi /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# add
character-set-server=utf8
[root@www ~]# /etc/rc.d/init.d/mysqld start
Initializing MySQL database: WARNING: The host 'www.server.world' could not be
looked up with resolveip.
This probably means that your libc libraries are not 100 % compatible
with this binary MySQL version. The MySQL daemon, mysqld, should work
normally with the exception that host name resolving will not work.
This means that you should use IP addresses instead of hostnames
when specifying MySQL privileges !
Installing MySQL system tables...
OK
Filling help tables...
OK
...
...
...
You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!

[ OK ]
Starting mysqld: [ OK ]

[root@www ~]# chkconfig mysqld on

[2]Initial settings for MySQL:


[root@www ~]# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

# Enter
Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

# set root password


Set root password? [Y/n] y
New password: # input any password
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!

By default, a MySQL installation has an anonymous user, allowing anyone


to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.

# remove anonymous users


Remove anonymous users? [Y/n] y
... Success!

Normally, root should only be allowed to connect from 'localhost'. This


ensures that someone cannot guess at the root password from the network.

# disallow root login remotely


Disallow root login remotely? [Y/n] y
... Success!

By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.

# remove test database


Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

# reload privilege tables


Reload privilege tables now? [Y/n] y
... Success!

Cleaning up...

All done! If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!

# try to connect with root


[root@www ~]# mysql -u root -p
Enter password:# MySQL root password
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 5.1.73 Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its


affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

# display user list


mysql> select user,host,password from mysql.user;
+------+-----------+-------------------------------------------+
| user | host | password |
+------+-----------+-------------------------------------------+
| root | localhost | ***************************************** |
| root | 127.0.0.1 | ***************************************** |
+------+-----------+-------------------------------------------+
2 rows in set (0.00 sec)
# display database list
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
+--------------------+
2 rows in set (0.00 sec)

mysql> exit
Bye

4.Install some other required packages and Zabbix


repository.
[root@dlp ~]# yum -y install php-mysql php-gd php-xml php-bcmath
[root@dlp ~]# yum -y install http://repo.zabbix.com/zabbix/2.4/rhel/6/x86_64/zabbix-
release-2.4-1.el6.noarch.rpm

[5]Install Zabbix server.


Install Zabbix Agent to monitor Zabbix server itself, too.
[root@dlp ~]# yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent
zabbix_get

[6]Create a database for Zabbix.


[root@dlp ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 5.1.73 Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its


affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database zabbix;


Query OK, 1 row affected (0.00 sec)
mysql> grant all privileges on zabbix.* to zabbix@'localhost' identified by 'password';
Query OK, 0 rows affected (0.00 sec)
mysql> grant all privileges on zabbix.* to zabbix@'%' identified by 'password';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> exit
Bye
[root@dlp ~]# cd /usr/share/doc/zabbix-server-mysql-*/create
[root@dlp create]# mysql -u root -p zabbix < schema.sql
Enter password:
[root@dlp create]# mysql -u root -p zabbix < images.sql
Enter password:
[root@dlp create]# mysql -u root -p zabbix < data.sql
Enter password:

[7]Configure and start Zabbix server.


[root@dlp ~]# vi /etc/zabbix/zabbix_server.conf
# line 73: add
DBHost=localhost
# line 107: add DB password for Zabbix
DBPassword=password
[root@dlp ~]# /etc/rc.d/init.d/zabbix-server start
Starting ZABBIX server:[ OK ]
[root@dlp ~]# chkconfig zabbix-server on

[8]Configure and start Zabbix Agent to monitor


Zabbix server itself.
[root@dlp ~]# vi /etc/zabbix/zabbix_agentd.conf
# line 85: specify Zabbix server
Server=127.0.0.1
# line 126: specify Zabbix server
ServerActive=127.0.0.1
# line 137: change to the own hostname
Hostname=shriramzabbix
[root@dlp ~]# /etc/rc.d/init.d/zabbix-agent start
Starting ZABBIX agent:[ OK ]
[root@dlp ~]# chkconfig zabbix-agent on
[9]Change httpd settings like follows.
[root@dlp ~]# vi /etc/httpd/conf.d/zabbix.conf
# line 11: change access permittion for Zabbix frontend
Allow from localhost 10.0.0.0/24
# line 18: uncomment and change to your timezone
php_value date.timezone Asia/Tokyo
[root@dlp ~]# /etc/rc.d/init.d/httpd restart
Stopping httpd:[ OK ]
Starting httpd: [ OK ]

Das könnte Ihnen auch gefallen