1. Add Zabbix and MySQL Repository
yum clean metadata
yum clean dbcache
yum makecache
2. Install MySQL
rpm -e --nodeps mysql-community-release-el6-5.noarch
rpm -e --nodeps mysql-libs-5.1.66-2.el6_3.x86_64
yum install -y mysql-community-client mysql-community-common mysql-community-devel mysql-community-libs mysql-community-libs-compat mysql-community-server mysql-utilities mysql-connector-odbc unixODBC unixODBC-devel
chkconfig mysqld on
3. Install Apache
yum install -y httpd
chkconfig httpd on
4. Install PHP
yum install -y php php-gd php-bcmath php-xml php-mbstring php-mysql php-common php-cli
5. Install Zabbix
yum install -y zabbix-server-mysql zabbix-web-mysql zabbix-agent
chkconfig zabbix-server on
chkconfig zabbix-agent on
6. Create Zabbix Database
run following commands in shell:
service mysqld start
mysql -uroot
|
then, run following commands in MySQL command line:
create database zabbix character set utf8 collate utf8_bin; grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix'; GRANT ALL PRIVILEGES ON zabbix.* TO 'zabbix'@'%' IDENTIFIED BY 'zabbix'; FLUSH PRIVILEGES; exit
|
7. Initialize Zabbix Database
cd /usr/share/doc/zabbix-server-mysql-2.2.6/create
mysql -uroot zabbix < schema.sql
mysql -uroot zabbix < images.sql
mysql -uroot zabbix < data.sql
8. Configure Zabbix Server
gedit /etc/zabbix/zabbix_server.conf
Set following parameters in zabbix_server.conf:
DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=zabbix DebugLevel=4
|
9. Configure Zabbix Frontend
gedit /etc/httpd/conf.d/zabbix.conf
Set following parameters in zabbix.conf:
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value date.timezone Asia/Shanghai
|
10. Configure Apache
gedit /etc/php.ini
Set following parameters in php.ini:
date.timezone = Asia/Shanghai
|
11. Setup unixODBC
ln -s /usr/lib64/libmyodbc5w.so /usr/lib64/libmyodbc5.so
gedit /etc/odbcinst.ini
[PostgreSQL]
Description = ODBC for PostgreSQL
Driver = /usr/lib/psqlodbc.so
Setup = /usr/lib/libodbcpsqlS.so
Driver64 = /usr/lib64/psqlodbc.so
Setup64 = /usr/lib64/libodbcpsqlS.so
FileUsage = 1
[MySQL]
Description = ODBC for MySQL
Driver = /usr/lib/libmyodbc5.so
Setup = /usr/lib/libodbcmyS.so
Driver64 = /usr/lib64/libmyodbc5.so
Setup64 = /usr/lib64/libodbcmyS.so
FileUsage = 1
[MySQL ODBC 5.3 Unicode Driver]
Driver = /usr/lib64/libmyodbc5w.so
UsageCount = 1
[MySQL ODBC 5.3 ANSI Driver]
Driver = /usr/lib64/libmyodbc5a.so
UsageCount = 1
|
gedit /etc/odbc.ini
[test]
Description = MySQL test database
Driver = MySQL
Server = 127.0.0.1
User = zabbix
Password = zabbix
Port = 3306
Database = zabbix
|
12. Test ODBC Configuration
isql -v test
The output message are shown below:
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL>
|
13. Configure SELinux
gedit /etc/selinux/config
Set SELinux mode to permissive:
SELINUX=permissive
then run following command in shell:
setenforce 0
14. Open Ports
iptables -I INPUT -p tcp --dport 80 -j ACCEPT
iptables -I INPUT -p tcp --dport 8080 -j ACCEPT
iptables -I INPUT -p tcp --dport 10050 -j ACCEPT
iptables -I INPUT -p tcp --dport 10051 -j ACCEPT
iptables -I INPUT -p tcp --dport 10052 -j ACCEPT
iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
service iptables save
service iptables restart
15. Start Zabbix
service httpd start
service zabbix-server start
service zabbix-agent start