서버

[CentOS6] zabbix 4.0 설치

검은체리 2019. 9. 16. 17:14

설치 환경

CentOS 6.1

Apache 2.2.15

PHP 5.4.45


1. PHP & PHP Extensions

yum clean all

yum install epel-release

 

rpm -ivh https://mirror.serverion.com/remi/enterprise/remi-release-6.rpm

 

yum install --enablerepo=remi-php54 php php-cli php-common php-devel php-pear php-gd php-mbstring php-mysql php-xml php-bcmath php-ldap

 

 

2. Configure Zabbix Repository

### Zabbix 4.0 (LTS) ###

rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/6/x86_64/zabbix-release-4.0-2.el6.noarch.rpm

 

3. Install Zabbix Server

yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent

 

4. Timezone

cp /usr/share/doc/zabbix-web-*/httpd22-example.conf /etc/httpd/conf.d/zabbix.conf

 

vi /etc/httpd/conf.d/zabbix.conf

 

        php_value date.timezone Asia/Seoul

 

 

 

5. Install & Start Database

### MySQL ###

yum install -y mysql-server mysql

service mysqld start 

 

6. MySQL (DBName: zabbix, DBUser: zabbix, DBPassword: zabbix)

[root@localhost]# mysql -u root -p

mysql> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)

mysql> grant all privileges on zabbix.* to 'zabbix'@'localhost' identified by 'zabbix';
Query OK, 0 rows affected (0.00 sec)

mysql> quit;

[root@localhost conf.d]# cd /usr/share/doc/zabbix-server-mysql*/

[root@localhost zabbix-server-mysql-4.0.12]# ll

total 2268

-rw-r--r--. 1 root root      98 Aug 26 20:19 AUTHORS

-rw-r--r--. 1 root root  975077 Aug 26 20:19 ChangeLog

-rw-r--r--. 1 root root   17990 Aug 26 20:19 COPYING

-rw-r--r--. 1 root root 1310619 Aug 26 23:38 create.sql.gz

-rw-r--r--. 1 root root      52 Aug 26 20:19 NEWS

-rw-r--r--. 1 root root    1317 Aug 26 20:19 README

[root@localhost zabbix-server-mysql-4.0.12]# 

[root@localhost zabbix-server-mysql-4.0.12]# 

[root@localhost zabbix-server-mysql-4.0.12]# 

[root@localhost zabbix-server-mysql-4.0.12]# zcat create.sql.gz | mysql -u zabbix -p zabbix

Enter password: zabbix

 

vi /etc/zabbix/zabbix_server.conf

 

7. Firewall 

 

iptables -I INPUT -p tcp -m tcp --dport 10051 -j ACCEPT

iptables -I INPUT -p tcp -m tcp --dport 10050 -j ACCEPT

iptables -I INPUT -p tcp -m tcp --dport 80 -j ACCEPT

/etc/init.d/iptables save

/etc/init.d/iptables restart

 

8. HTTPD 

cd /etc/httpd/conf[root@localhost ~]# cd /etc/httpd/conf
[root@localhost conf]# 
[root@localhost conf]# ll
total 52
-rw-r--r--. 1 root root 34419 Sep 16 12:39 httpd.conf
-rw-r--r--. 1 root root 13139 Jun 20  2018 magic
[root@localhost conf]# 
[root@localhost conf]# 
[root@localhost conf]# vi httpd.conf 

 

9. Selinux 수정

vi /etc/selinux/config 

SELINUX=disabled

 

- 서비스 실행 

 

service zabbix-server start 
service zabbix-agent start 
service httpd start

 

chkconfig zabbix-server on

chkconfig zabbix-agent on

chkconfig httpd on

chkconfig mysqld on

 

10. WEB 확인 (http://192.168.80.120/zabbix)

 

11. 로그인 계정 (Admin / zabbix)

✔ TIP

1. Server value가 No일 경우 리부팅 필요

2. Zabbix web 포트 변경 가능 (80 -> 8080)

 

- 방화벽 포트 작업

iptables -I INPUT -p tcp -m tcp --dport 8080 -j ACCEPT

/etc/init.d/iptables save

/etc/init.d/iptables restart

 

- Apache 포트 변경 

#vi /etc/httpd/conf/httpd.conf

- Service Restart

service httpd restart