Monday, February 8, 2016

Install Zabbix on CEntOS 6.4

# Install CEntOS 6.4 Minimal
# Turn off firewall and SELINUX
chkconfig iptables off && chkconfig ip6tables off && service iptables stop && service ip6tables stop && setenforce 0
vi /etc/selinux/config #replace SELINUX=enforcing with SELINUX=disabled
# set IP Address and hostname
# Update
yum -u update
# Install
yum install telnet nmap traceroute man ntpd wget mlocate unzip dos2unix perl make gcc mysql mysql-server -y
# Time sync, ntpd auto start and start ntpd services
ntpdate id.pool.ntp.org #2 or 3 times
chkconfig ntpd on
/etc/init.d/ntpd start
# MySQL auto start and start MySQL services
chkconfig mysqld on
/etc/init.d/mysqld start
# Install Zabbix Repositories and install Zabbix server and agent
rpm -ivh http://repo.zabbix.com/zabbix/2.0/rhel/6/x86_64/zabbix-release-2.0-1.el6.noarch.rpm
yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent -y
#Set MySQL root password and secure MySQL server
mysql -u root mysql
SET PASSWORD FOR root@localhost = PASSWORD(‘MyN3wpassw0rd’); ## mysqlroot account password
DROP DATABASE test;
DELETE FROM user WHERE NOT (host = “localhost” AND user = “mydbadmin”);
exit
# httpd auto start and start httpd services
chkconfig httpd on
/etc/init.d/httpd start
# Create Zabbix database and import table
mysql -uroot -p # input mysql root password ‘MyN3wpassw0rd’
mysql> create database zabbix character set utf8;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by ‘zabbix’; # set zabbix database password
mysql> exit
cd /usr/share/doc/zabbix-server-mysql-2.0.6/create/
mysql -uroot -p zabbix < schema.sql # input mysql root password ‘MyN3wpassw0rd’
mysql -uroot -p zabbix < images.sql # input mysql root password ‘MyN3wpassw0rd’
mysql -uroot -p zabbix < data.sql # input mysql root password ‘MyN3wpassw0rd’
# Edit database configuration in zabbix_server.conf
vi /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
# Auto start and start zabbix server services
chkconfig zabbix-server on
/etc/init.d/zabbix-server start
# Editing PHP configuration for Zabbix frontend and restart httpd services
vi /etc/httpd/conf.d/zabbix.conf
php_value max_execution_time 300
php_value memory_limit 256M
php_value post_max_size 32M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value date.timezone Asia/Jakarta
/etc/init.d/httpd restart
# Edit zabbix agent configuration files
vi /etc/zabbix/zabbix_agentd.conf
Server=127.0.0.1
Hostname=Zabbix server
# Auto start and start zabbix agent services
chkconfig zabbix-agent on
/etc/init.d/zabbix-agent start
# Allow Nmap (for detect operating system)
visudo
# Comment out
Defaults    requiretty
# Add the follwing line (bottom)
zabbix ALL = (root) NOPASSWD: /usr/bin/nmap
# Access web URL http://zabbixip/zabbix
# default username : admin, password : zabbix
Continue with web installation

No comments: