CentOS-6.7-x86_64-minimal.isoUpdate system
yum update -y
Install Apache:yum install httpd httpd-devel -y
Install MySQL serveryum install mysql mysql-server -y
Install PHPyum install php php-cli php-common php-devel php-pear php-gd php-mbstring php-mysql php-xml -y
Start Apacheservice httpd start
Set Apache to run at startupchkconfig httpd on
Start MySQL serverservice mysqld start
Set MySQL server to run at system startupchkconfig mysqld on
Set MySQL root password to LCq9LCFCNMZEqatm/usr/bin/mysqladmin -u root password 'LCq9LCFCNMZEqatm'
Install Zabbix repositoryrpm -Uvh http://repo.zabbix.com/zabbix/2.4/rhel/6/x86_64/zabbix-release-2.4-1.el6.noarch.rpm
Turn off GPG check in yum. This will let to install packages more automaticallysed -i "s/gpgcheck=1/gpgcheck=0/g" /etc/yum.conf
Install all necessary zabbix packages. Do not skip any of themyum install zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-java-gateway -y
Uncoment your time location at Apache configurationsed -i "s/# php_value date.timezone/php_value date.timezone/" /etc/httpd/conf.d/zabbix.conf
Restart Apacheservice httpd restart
Use root account togerher with password LCq9LCFCNMZEqatm to create database zabbixmysql -h localhost -uroot -pLCq9LCFCNMZEqatm -P 3306 -s <<< 'CREATE DATABASE zabbix CHARACTER SET UTF8'
Create new user zabbix with password drFJ7xx5MNTbqJ39 and allow it to access database zabbix from localhost locationmysql -h localhost -uroot -pLCq9LCFCNMZEqatm -P 3306 -s <<< 'GRANT ALL PRIVILEGES on zabbix.* to "zabbix"@"localhost" IDENTIFIED BY "drFJ7xx5MNTbqJ39"'
Apply permissionsmysql -h localhost -uroot -pLCq9LCFCNMZEqatm -P 3306 -s <<< 'FLUSH PRIVILEGES'
Move to directory where basic zabbix mysql structure locatedcd /usr/share/doc/zabbix-server-mysql-*/create
Create necessary tables and objects into database using MySQL user zabbix with password drFJ7xx5MNTbqJ39mysql -uzabbix -pdrFJ7xx5MNTbqJ39 zabbix < schema.sql
mysql -uzabbix -pdrFJ7xx5MNTbqJ39 zabbix < images.sql
mysql -uzabbix -pdrFJ7xx5MNTbqJ39 zabbix < data.sql
Set password drFJ7xx5MNTbqJ39 into zabbix server configuration filesed -i "s/^.*DBPassword=.*$/DBPassword=drFJ7xx5MNTbqJ39/" /etc/zabbix/zabbix_server.conf
List zabbix server configuration without commentsgrep -v "^#\|^$" /etc/zabbix/zabbix_server.conf
Start zabbix serverservice zabbix-server start
Allow to access web interface (port 80) from everywhere and zabbix ports (10050, 10051)iptables -I INPUT 5 -i eth0 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -I INPUT 5 -p tcp -m tcp --dport 10050 -j ACCEPT
iptables -I INPUT 5 -p tcp -m tcp --dport 10051 -j ACCEPT
Save IP tables configurationservice iptables save
Restart firewall serviceservice iptables restart
Fix:
Zabbix server is not running: the information displayed may not be current.
setsebool -P httpd_can_network_connect=true
Set zabbix server to start at system bootupchkconfig zabbix-server on
Check service sitiation about all services related to zabbix serverchkconfig --list | grep "zabbix\|mysqld\|httpd"
Set zabbix agent to boot at system startupchkconfig zabbix-agent on
Look at zabbix agent configuration filegrep -v "^#\|^$" /etc/zabbix/zabbix_agentd.conf
Now you can go at you server IP adress and continue to set up zabbix server:http://ip.address.goes.here/zabbix
If you want to do all steps in one click then create new file:vi install-zabbix-server.sh
Paste this content:yum update -y
yum install httpd httpd-devel -y
yum install mysql mysql-server -y
yum install php php-cli php-common php-devel php-pear php-gd php-mbstring php-mysql php-xml -y
service httpd start
chkconfig httpd on
service mysqld start
chkconfig mysqld on
/usr/bin/mysqladmin -u root password 'LCq9LCFCNMZEqatm'
rpm -Uvh http://repo.zabbix.com/zabbix/2.4/rhel/6/x86_64/zabbix-release-2.4-1.el6.noarch.rpm
sed -i "s/gpgcheck=1/gpgcheck=0/g" /etc/yum.conf
yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-java-gateway -y
sed -i "s/# php_value date.timezone/php_value date.timezone/" /etc/httpd/conf.d/zabbix.conf
service httpd restart
mysql -h localhost -uroot -pLCq9LCFCNMZEqatm -P 3306 -s <<< 'CREATE DATABASE zabbix CHARACTER SET UTF8'
mysql -h localhost -uroot -pLCq9LCFCNMZEqatm -P 3306 -s <<< 'GRANT ALL PRIVILEGES on zabbix.* to "zabbix"@"localhost" IDENTIFIED BY "drFJ7xx5MNTbqJ39"'
mysql -h localhost -uroot -pLCq9LCFCNMZEqatm -P 3306 -s <<< 'FLUSH PRIVILEGES'
cd /usr/share/doc/zabbix-server-mysql-*/create
mysql -uzabbix -pdrFJ7xx5MNTbqJ39 zabbix < schema.sql
mysql -uzabbix -pdrFJ7xx5MNTbqJ39 zabbix < images.sql
mysql -uzabbix -pdrFJ7xx5MNTbqJ39 zabbix < data.sql
sed -i "s/^.*DBPassword=.*$/DBPassword=drFJ7xx5MNTbqJ39/" /etc/zabbix/zabbix_server.conf
grep -v "^#\|^$" /etc/zabbix/zabbix_server.conf
service zabbix-server start
iptables -I INPUT 5 -i eth0 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -I INPUT 5 -p tcp -m tcp --dport 10050 -j ACCEPT
iptables -I INPUT 5 -p tcp -m tcp --dport 10051 -j ACCEPT
service iptables save
service iptables restart
setsebool -P httpd_can_network_connect=true
chkconfig zabbix-server on
chkconfig --list | grep "zabbix\|mysqld\|httpd"
chkconfig zabbix-agent on
grep -v "^#\|^$" /etc/zabbix/zabbix_agentd.conf
No need to change any of lines for success story, BUT please replace MySQL root password LCq9LCFCNMZEqatm and please replace MySQL zabbix password drFJ7xx5MNTbqJ39 with something else!Set file executable:
chmod +x install-zabbix-server.sh
Launch installation process:./install-zabbix-server.sh
No comments:
Post a Comment