天天看點

CentOS 6.4x64安裝部署zabbix-2.4.5

一.部署環境  

    系統:CentOS 6.4x64 最小化安裝  

    Server:192.168.3.28

    Client:192.168.3.29

二.基礎軟體包安裝

    在server安裝基礎軟體包,這裡的環境使用yum安裝,如果使用源碼安裝也是可以的。

1 [[email protected] ~]# yum -y install wget vim tree gcc gcc-c++ autoconf httpd php mysql mysql-server php-mysql httpd-manual mod_ssl mod_perl mod_auth_mysql php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc php-bcmath mysql-connector-odbc mysql-devel libdbi-dbd-mysql net-snmp net-snmp-devel curl-devel
    啟動httpd、mysql并設定成開機自動啟動

1

2

3

4

[[email protected] ~]# service httpd start

[[email protected] ~]# service mysqld start

[[email protected] ~]# chkconfig httpd on

[[email protected] ~]# chkconfig mysqld on

    在iptables中放行80,10050,10051端口。

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

[[email protected] ~]# iptables -I INPUT -p tcp -m multiport --destination-port 80,10050:10051 -j ACCEPT

#檢視防火牆結果

[[email protected] ~]# iptables -L -n

Chain INPUT (policy ACCEPT)

target     prot opt source               destination         

ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           multiport dports 80,10050:10051 

ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED 

ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0           

ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           

ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:22 

REJECT     all  --  0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited 

Chain FORWARD (policy ACCEPT)

target     prot opt source               destination         

REJECT     all  --  0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited 

Chain OUTPUT (policy ACCEPT)

target     prot opt source               destination 

#儲存iptables規則

[[email protected] ~]# service iptables save

iptables: Saving firewall rules to /etc/sysconfig/iptables:[  OK  ]

三.配置PHP參數

    zabbix的運作需要特定的php參數支援,修改如下

1

2

3

4

5

6

[[email protected] ~]# sed -i "s@;date.timezone [email protected] = Asia/[email protected]" /etc/php.ini

[[email protected] ~]# sed -i "[email protected]_execution_time = [email protected]_execution_time = [email protected]" /etc/php.ini

[[email protected] ~]# sed -i "[email protected]_max_size = [email protected]_max_size = [email protected]" /etc/php.ini

[[email protected] ~]# sed -i "[email protected]_input_time = [email protected]_input_time = [email protected]" /etc/php.ini

[[email protected] ~]# sed -i "[email protected]_limit = [email protected]_limit = [email protected]" /etc/php.ini

[[email protected] ~]# sed -i "s@;mbstring.func_overload = [email protected]_overload = [email protected]" /etc/php.ini

    修改httpd的FQDN錯誤,重新開機httpd服務

1

2

3

4

[[email protected] ~]# echo "ServerName localhost:80" >>/etc/httpd/conf/httpd.conf

[[email protected] ~]# /etc/init.d/httpd restart

Stopping httpd:                                            [  OK  ]

Starting httpd:                                            [  OK  ]

四.下載下傳zabbix-2.4.5.tar.gz
1 [[email protected] ~]# wget http://jaist.dl.sourceforge.net/ ... zabbix-2.4.5.tar.gz
五.添加zabbix使用者群組

1

2

[[email protected] ~]# groupadd -g 201 zabbix

[[email protected] ~]# useradd -g zabbix -u 201 -s /sbin/nologin zabbix

六.安裝zabbix-server端

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

[[email protected] ~]# tar xf zabbix-2.4.5.tar.gz

[[email protected] ~]# cd zabbix-2.4.5

[[email protected] zabbix-2.4.5]# ./configure --prefix=/usr/local/zabbix --enable-server --enable-proxy --enable-agent --with-mysql=/usr/bin/mysql_config --with-net-snmp --with-libcurl

[[email protected] zabbix-2.4.5]# make && make install

#建立zabbix資料庫以及相關表

[[email protected] zabbix-2.4.5]# mysql -e "create database zabbix default charset utf8;"

[[email protected] zabbix-2.4.5]# mysql -e "grant all on zabbix.* to [email protected] identified by 'zabbix';"

[[email protected] zabbix-2.4.5]# mysql -uzabbix -pzabbix zabbix<./database/mysql/schema.sql

[[email protected] zabbix-2.4.5]# mysql -uzabbix -pzabbix zabbix<./database/mysql/images.sql

[[email protected] zabbix-2.4.5]# mysql -uzabbix -pzabbix zabbix<./database/mysql/data.sql

#配置軟連接配接和啟動檔案資訊

[[email protected] zabbix-2.4.5]# mkdir /var/log/zabbix

[[email protected] zabbix-2.4.5]# chown zabbix.zabbix /var/log/zabbix

[[email protected] zabbix-2.4.5]# ln -s /usr/local/zabbix/etc/ /etc/zabbix

[[email protected] zabbix-2.4.5]# ln -s /usr/local/zabbix/bin |

+----------+-----------------------------------------------------------------+

1 row in set (0.00 sec)

mysql> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| test               |

| zabbix             |

+--------------------+

4 rows in set (0.00 sec)

mysql> use zabbix;

Database changed

mysql> source zabbix.sql;

    5.檢視修改後的結果
CentOS 6.4x64安裝部署zabbix-2.4.5

十二.在client端192.168.3.29安裝zabbix

    安裝基礎軟體包

1 [[email protected] ~]# yum install wget vim tree gcc gcc-c++ -y
    安裝zabbix_agentd

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

[[email protected] ~]# groupadd  -g  201  zabbix

[[email protected] ~]# useradd  -g  zabbix -u  201 -s /sbin/nologin zabbix 

[[email protected] ~]# tar xf zabbix-2.4.5.tar.gz 

[[email protected] ~]# cd zabbix-2.4.5

#開始編譯安裝zabbix用戶端

[[email protected] zabbix-2.4.5]# ./configure --prefix=/usr/local/zabbix --enable-agent

[[email protected] zabbix-2.4.5]# make && make install

#建立zabbix的日志目錄

[[email protected] zabbix-2.4.5]# mkdir /var/log/zabbix

[iy[email protected] zabbix-2.4.5]# chown zabbix.zabbix /var/log/zabbix

#複制zabbix_agentd啟動檔案到/etc/init.d目錄下

[[email protected] zabbix-2.4.5]# cp misc/init.d/fedora/core/zabbix_agentd  /etc/init.d/

[iy[email protected] zabbix-2.4.5]# chmod 755 /etc/init.d/zabbix_agentd

#在iptables中放行10050和10051端口

[[email protected] zabbix-2.4.5]# iptables -I INPUT -p tcp -m multiport --dports 10050:10051 -j ACCEPT

[iyun[email protected] zabbix-2.4.5]# service iptables save   #儲存iptables規則

iptables: Saving firewall rules to /etc/sysconfig/iptables:[  OK  ]

#檢視iptables結果

[[email protected] zabbix-2.4.5]# iptables -L -n

Chain INPUT (policy ACCEPT)

target     prot opt source               destination         

ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           multiport dports 10050:10051 

ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED 

ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0           

ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           

ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:22 

REJECT     all  --  0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited 

Chain FORWARD (policy ACCEPT)

target     prot opt source               destination         

REJECT     all  --  0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited 

Chain OUTPUT (policy ACCEPT)

target     prot opt source               destination 

#修改啟動檔案和配置軟連接配接

[[email protected] zabbix-2.4.5]# sed -i "[email protected]=/usr/[email protected]=/usr/local/[email protected]" /etc/init.d/zabbix_agentd

[[email protected] zabbix-2.4.5]# ln -s /usr/local/zabbix/etc/ /etc/zabbix

[[email protected] zabbix-2.4.5]# ln -s /usr/local/zabbix/bin/*  /usr/bin

[[email protected] zabbix-2.4.5]# ln -s /usr/local/zabbix/sbin/*  /usr/sbin/

#/etc/zabbix/zabbix_agentd.conf,這裡的IP位址寫的是zabbix_server端的IP位址

[[email protected] zabbix-2.4.5]# sed -i "[email protected][email protected][email protected]" /etc/zabbix/zabbix_agentd.conf

[[email protected] zabbix-2.4.5]# sed -i "[email protected][email protected]=192.168.3.28:[email protected]" /etc/zabbix/zabbix_agentd.conf

[[email protected] zabbix-2.4.5]# sed -i "[email protected]/[email protected]/log/zabbix/[email protected]"  /etc/zabbix/zabbix_agentd.conf

[[email protected] zabbix-2.4.5]# sed -i "s@^# UnsafeUserParamet[email protected]=1\[email protected]" /etc/zabbix/zabbix_agentd.conf

#設定zabbix_agentd開機自動啟動,并啟動zabbix_agentd服務

[[email protected] zabbix-2.4.5]# chkconfig zabbix_agentd on

[[email protected] zabbix-2.4.5]# service zabbix_agentd start

Starting zabbix_agentd:                                    [  OK  ]

轉載于:https://www.cnblogs.com/xxxxxk/p/5223285.html