CentOS 6.5 source installation ZABBIX 3.0.8

1. Installing PHP and Extension Package

rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
yum -y install php56w php56w-gd php56w-mysql php56w-bcmath php56w-mbstring php56w-xml php56w-ldap


2. Install mysql and configure it

rpm -ivh http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
yum install -y mysql-server mysql-devel
/etc/init.d/mysqld start
mysql_secure_installation
Enter current password for root (enter for none): < - Direct return for initial operation
 Set root password? [Y/n] <- Whether to set the root user password, enter y and return or return directly
 Remove anonymous users? [Y/n] < - Whether to delete anonymous users, production environment suggested deletion, so return directly
 Disallow root login remotely? [Y/n] < --- Do you prohibit root remote login? Choose Y/n according to your own needs and return to the train. It is recommended to prohibit it.
Remove test database and access to it? [Y/n] < - Delete test database and return directly
 Reload Privilege tables now? [Y/n] <- Whether to reload the privilege table and return directly
mysql -uroot -pzabbix
mysql> CREATE DATABASE zabbix CHARACTER SET utf8 COLLATE utf8_bin;
mysql> GRANT ALL PRIVILEGES ON zabbix.* TO zabbix@localhost IDENTIFIED BY 'zabbix';
mysql> flush privileges;   
mysql> show databases;


Modify configuration files

#vim /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
innodb_file_per_table = 1
character-set-server = utf8
#Independent table space pattern
innodb_file_per_table = 1 
symbolic-links=0
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

Restart mysql service

 /etc/init.d/mysqld restart
Stopping mysqld:                                           [  OK  ]
Starting mysqld:                                           [  OK  ]
chkconfig mysqld on



3. Installing dependency packages

 yum -y install libcurl-devel libxml2-devel net-snmp net-snmp-devel 
 yum -y install httpd  OpenIPMI-libs  fping   iksemel


4. Update libcurl. If not, email alert will fail. Detailed information is provided in the link below.

http://www.iyunv.com/thread-261219-1-1.html


rpm -ivh city-fan.org-release-1-13.rhel6.noarch.rpm
curl -V
curl 7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.21 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2
Protocols: tftp ftp telnet dict ldap ldaps http file https ftps scp sftp 
Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz 

curl -V
curl 7.53.1 (x86_64-redhat-linux-gnu) libcurl/7.53.1 OpenSSL/1.0.1e zlib/1.2.3 c-ares/1.12.0 libssh2/1.8.0 nghttp2/1.6.0
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz HTTP2 UnixSockets HTTPS-proxy Metalink


5. Download source packages

Download address: http://www.zabbix.com/download


6. Installation

tar -zxf zabbix-3.0.8.tar.gz

cd zabbix-3.0.8

./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2

make && make install


7. Copy service startup script to / etc/init.d / directory

 cp misc/init.d/fedora/core/zabbix_server  /etc/init.d/
 cp misc/init.d/fedora/core/zabbix_agentd  /etc/init.d/


8. Importing database files

 mysql -uzabbix -pzabbix -hlocalhost zabbix < database/mysql/schema.sql
 mysql -uzabbix -pzabbix -hlocalhost zabbix < database/mysql/images.sql
 mysql -uzabbix -pzabbix -hlocalhost zabbix < database/mysql/data.sql


9. Creating Soft Connections

ln -s /usr/local/zabbix/etc /etc/zabbix



10. Modify the php configuration. Here I save the modified configuration in a separate file.

cd /etc/httpd/conf.d
vim zabbix.conf
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 32M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value always_populate_raw_post_data -1
php_value date.timezone Asia/Shanghai


11. Create a zabbix directory

mkdir /var/www/html/zabbix
cp -R /usr/local/src/zabbix-3.0.8/frontends/php/*   /var/www/html/zabbix/
chown -R apache:apache  /var/www/html/zabbix


12. Create a log directory

mkdir /var/log/zabbix

Configuration Log Cutting

cat /etc/logrotate.d/zabbix-agent
/var/log/zabbix/zabbix_agentd.log {
        weekly
        rotate 12
        compress
        delaycompress
        missingok
        notifempty
        create 0664 zabbix zabbix
}
cat /etc/logrotate.d/zabbix-server
/var/log/zabbix/zabbix_server.log {
        weekly
        rotate 12
        compress
        delaycompress
        missingok
        notifempty
        create 0664 zabbix zabbix
}


13. Modify the zabbix_server.conf configuration file. The modified configuration is as follows. This is the configuration for production and the memory is increased. Start zabbix server with root user

LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=0
PidFile=/var/run/zabbix/zabbix_server.pid
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
StartPollers=40
StartPollersUnreachable=20
StartTrappers=8
StartPingers=8
StartDiscoverers=8
StartHTTPPollers=8
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
HousekeepingFrequency=1
CacheSize=128M
StartDBSyncers=8
HistoryCacheSize=32M
HistoryIndexCacheSize=32M
TrendCacheSize=8M
ValueCacheSize=128M
Timeout=30
TrapperTimeout=120
AlertScriptsPath=/usr/lib/zabbix/alertscripts
ExternalScripts=/usr/lib/zabbix/externalscripts
LogSlowQueries=3000
AllowRoot=1


14. Modify the zabbix_agent.conf configuration file. The modified configuration is as follows (start ZABBIX agent with root user)

LogFile=/var/log/zabbix/zabbix.agent.log
Server=127.0.0.1
ServerActive=127.0.0.1
Hostname=Zabbix server
AllowRoot=1
Include=/usr/local/zabbix/etc/zabbix_agentd.conf.d/


15. Setting up zabbix agent and zabbix server service to boot

chkconfig --add zabbix_server
chkconfig --add zabbix_agentd
chkconfig zabbix_server on
chkconfig zabbix_agentd on
/etc/init.d/zabbix_server start
/etc/init.d/zabbix_agentd start


16. Start apache service

/etc/init.d/httpd start
chkconfig httpd on


17. Log on to zabbix web for configuration


Configure the password of the zabbix database


No configuration, go straight to the next step


No configuration, next step

Configuration completed


Log in to zabbix, the account defaults to Admin, and the password is zabbix. It's better to change it after login.


Keywords: Zabbix MySQL Database yum

Added by bob_dole on Sat, 13 Jul 2019 02:33:31 +0300