setsebool httpd_can_network_connect_db 1
setsebool -P httpd_can_network_connect_db 1
setsebool -P httpd_can_network_connect_db 1
knowledge yang didapat dan terdokmentasi di sbuah catatan blog kecil yang Tujuanya bisa menjadi amal jariyah/ilmu yang bermanfaat
mysql my_database < database_backup.sql
# pv database_backup.sql | mysql my_database 96.8MB 0:00:17 [5.51MB/s] [==> ] 11% ETA 0:02:10
mysql> SET GLOBAL general_log_file = '/mysql/log/all_queries.log';
mysql> SET GLOBAL general_log = 'ON';
mysql> SET GLOBAL general_log = 'OFF';
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
bind-address = 10.14.23.185
server-id = 1
log_bin = /var/log/mysql/mysql_bin.log
binlog_do_db = zabbix
slow_query_log_file = /var/lib/mysql/mysql-slow.log
long_query_time = 5
slow_query_log = 1
[client]
user=root
host=localhost
password=
In this tutorial, we will not change anything on the source code
.[root@vagrant-centos67 ~]# mkdir -p /opt/sources/zabbix
[root@vagrant-centos67 ~]# cd /opt/sources
[root@vagrant-centos67 ~]# yum install -y wget
[root@vagrant-centos67 ~]# wget https://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
[root@vagrant-centos67 ~]# rpm -ivh mysql-community-release-el6-5.noarch.rpm
# Create Nginx REPO
vi /etc/yum.repos.d/nginx.repo
# Add the following below:
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/6/$basearch/
gpgcheck=0
enabled=1
# Update and install required packages
yum update -y
yum install -y mysql-server php-mysql php-bcmath php-gd php-fpm php-xml php-ldap php-mbstring wget libcurl-devel openldap-devel java-1.7.0-openjdk-devel net-snmp-devel iksemel-devel libxml2-devel mysql-devel nginx vim
./configure --help
[root@vagrant-centos67 opt]# cd /opt/sources/zabbix
[root@vagrant-centos67 zabbix]# wget http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/2.4.6/zabbix-2.4.6.tar.gz
[root@vagrant-centos67 zabbix]# tar zxvf zabbix-2.4.6.tar.gz
[root@vagrant-centos67 zabbix]# cd zabbix-2.4.6
[root@vagrant-centos67 zabbix-2.4.6]# ./configure --enable-server --enable-agent --prefix=/usr/local --sysconfdir=/etc --enable-java --with-mysql --with-jabber --with-libcurl --with-net-snmp --with-ldap --with-iconv --with-libxml2
Configuration:
Detected OS: linux-gnu
Install path: /usr/local
Compilation arch: linux
Compiler: gcc
Compiler flags: -g -O2 -I/usr/include/mysql -g -fstack-protector -m64 -fPIC -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing -I/usr/include/libxml2 -I/usr/include/rpm -I/usr/local/include -I/usr/lib64/perl5/CORE -I. -I/usr/include -I/usr/include -I/yes/include
Enable server: yes
Server details:
With database: MySQL
WEB Monitoring: cURL
Native Jabber: yes
SNMP: yes
IPMI: no
SSH: no
ODBC: no
Linker flags: -rdynamic -L/yes/lib -L/usr/lib64/mysql -L/usr/lib64 -L/usr/lib
Libraries: -lm -ldl -lrt -lresolv -lmysqlclient -liksemel -lxml2 -lnetsnmp -lldap -llber -lcurl
Enable proxy: no
Enable agent: yes
Agent details:
Linker flags: -rdynamic -L/yes/lib -L/usr/lib
Libraries: -lm -ldl -lrt -lresolv -lldap -llber -lcurl
Enable Java gateway: yes
Java gateway details:
Java compiler: javac
Java archiver: jar
LDAP support: yes
IPv6 support: no
***********************************************************
* Now run 'make install' *
* *
* Thank you for using Zabbix! *
* <http://www.zabbix.com> *
***********************************************************
make
make install
# Create group/user for Zabbix
groupadd zabbix
useradd -g zabbix zabbix
[root@vagrant-centos67 zabbix]# /etc/init.d/mysqld start
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h vagrant-centos67.vagrantup.com password 'new-password'
...
[ OK ]
Starting mysqld: [ OK ]
# Add a password for root user
[root@vagrant-centos67 zabbix-2.4.6]# mysqladmin -uroot password 'topsecret'
Warning: Using a password on the command line interface can be insecure.
# Create database for Zabbix and populate it with the .sql files
[root@vagrant-centos67 zabbix-2.4.6]# cd /opt/sources/zabbix/zabbix-2.4.6/database/mysql/
[root@vagrant-centos67 zabbix-2.4.6]# mysql -uroot -ptopsecret
create database zabbix;
use zabbix;
source schema.sql;
source data.sql;
source images.sql;
cp /opt/sources/zabbix/zabbix-2.4.6/misc/init.d/fedora/core5/zabbix_server /etc/init.d/
cp /opt/sources/zabbix/zabbix-2.4.6/misc/init.d/fedora/core5/zabbix_agentd /etc/init.d/
# Configure /etc/zabbix_server.conf
For this tutorial we will only change the line 102 to DBPassword=topsecret
/etc/init.d/zabbix_server start
/etc/init.d/zabbix_agentd start
# Check is Zabbix server is ok and running
[root@vagrant-centos67 zabbix-2.4.6]# cat /tmp/zabbix_server.log
6880:20151007:134754.283 Starting Zabbix Server. Zabbix 2.4.6 (revision 54796).
6880:20151007:134754.283 ****** Enabled features ******
6880:20151007:134754.283 SNMP monitoring: YES
6880:20151007:134754.283 IPMI monitoring: NO
6880:20151007:134754.283 WEB monitoring: YES
6880:20151007:134754.283 VMware monitoring: YES
6880:20151007:134754.283 Jabber notifications: YES
6880:20151007:134754.283 Ez Texting notifications: YES
6880:20151007:134754.283 ODBC: NO
6880:20151007:134754.283 SSH2 support: NO
6880:20151007:134754.283 IPv6 support: NO
6880:20151007:134754.283 ******************************
6880:20151007:134754.283 using configuration file: /etc/zabbix_server.conf
6880:20151007:134754.593 current database version (mandatory/optional): 02040000/02040000
6880:20151007:134754.594 required mandatory version: 02040000
6880:20151007:134754.657 server #0 started [main process]
6882:20151007:134754.664 server #1 started [configuration syncer #1]
6885:20151007:134754.673 server #4 started [poller #2]
6886:20151007:134754.674 server #5 started [poller #3]
6888:20151007:134754.675 server #7 started [poller #5]
6889:20151007:134754.675 server #8 started [unreachable poller #1]
6890:20151007:134754.675 server #9 started [trapper #1]
6892:20151007:134754.677 server #11 started [trapper #3]
6893:20151007:134754.677 server #12 started [trapper #4]
6894:20151007:134754.689 server #13 started [trapper #5]
6895:20151007:134754.689 server #14 started [icmp pinger #1]
6896:20151007:134754.690 server #15 started [alerter #1]
6897:20151007:134754.690 server #16 started [housekeeper #1]
6898:20151007:134754.690 server #17 started [timer #1]
6899:20151007:134754.690 server #18 started [http poller #1]
6901:20151007:134754.691 server #20 started [history syncer #1]
6903:20151007:134754.691 server #22 started [history syncer #3]
6906:20151007:134754.691 server #25 started [proxy poller #1]
6904:20151007:134754.691 server #23 started [history syncer #4]
6905:20151007:134754.691 server #24 started [escalator #1]
6907:20151007:134754.692 server #26 started [self-monitoring #1]
6884:20151007:134754.692 server #3 started [poller #1]
6883:20151007:134754.692 server #2 started [db watchdog #1]
6891:20151007:134754.692 server #10 started [trapper #2]
6887:20151007:134754.693 server #6 started [poller #4]
6902:20151007:134754.693 server #21 started [history syncer #2]
6900:20151007:134755.315 server #19 started [discoverer #1]
[root@vagrant-centos67 zabbix-2.4.6]#
mkdir -p /var/www/zabbix
[root@vagrant-centos65 mysql]# cp -r -p /opt/sources/zabbix/zabbix-2.4.6/frontends/php/* /var/www/zabbix/
[root@vagrant-centos65 mysql]# chown nginx. /var/www/zabbix/*
# Edit the file /etc/nginx/nginx.conf and paste the content below
{gfm-js-extract-pre-3}
# Edit the file /etc/nginx/conf.d/default.conf with the content
{gfm-js-extract-pre-4}
# Edit the file /etc/php.ini and correct the values as following
post_max_size 16M
max_execution_time 300
max_input_time 300
date.timezone = America/Sao_Paulo (In my case)
# Configure PHP-FPM edit the file /etc/php-fpm.d/www.conf
[www]
listen = /var/run/php-fpm/php-fpm.socket
listen.backlog = -1
listen.owner = nginx
listen.group = nginx
listen.mode=0660
user = nginx
group = nginx
#request_slowlog_timeout = 10s
#slowlog = /var/log/php-fpm/slowlog-site.log
listen.allowed_clients = 127.0.0.1
pm = dynamic
pm.max_children = 20
pm.start_servers = 6
pm.min_spare_servers = 4
pm.max_spare_servers = 7
pm.max_requests = 150
pm.status_path = /status
request_terminate_timeout = 600s
rlimit_files = 131072
rlimit_core = unlimited
catch_workers_output = yes
env[HOSTNAME] = $HOSTNAME
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp
mkdir -p /var/lib/php/session
chown nginx. /var/lib/php/session
/etc/init.d/nginx start
/etc/init.d/php-fpm start
Try access http://localhost on your browser