Centos 6.8 x86_64安裝zabbix3.2.7

Centos 6.8 x86_64平臺  LNMP+zabbixphp

1安裝php7.0
rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
yum install -y php70w php70w-bcmath php70w-common php70w-cli php70w-mysql php70w-pdo php70w-gd php70w-fpm php70w-intl php70w-mbstring php70w-mcrypt php70w-xml php70w-xmlrpc php70w-opcache php70w-ldap php70w-pearhtml

sed -i 's/post_max_size = 8M/post_max_size = 16M/g' /etc/php.ini
sed -i 's/max_input_time = 60/max_input_time = 300/g' /etc/php.ini
sed -i 's/max_execution_time = 30/max_execution_time = 300/g' /etc/php.ini
sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /etc/php.ini
sed -i 's/;date.timezone =/date.timezone = PRC/g' /etc/php.ini前端

service php-fpm startmysql

2,nginx的安裝(當前版本1.12.1)
rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
yum install -y nginxnginx

3,安裝mysql5.6.37web

rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpmsql

yum install -y mysql-community-server mysql-community-develcentos

mysql的基礎配置(根據系統硬件配置)my.cnf
[client]
port        = 3306
default-character-set=utf8cookie

[mysqld]
port        = 3306
skip-name-resolve
character-set-server=utf8
skip-external-locking
max_connections=1000
max_connect_errors=10
default-storage-engine=INNODB
innodb_log_file_size = 128M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 2
innodb_lock_wait_timeout = 50
innodb_flush_method=O_DIRECTphp7

default-time-zone = '+8:00'
event_scheduler=ON
open_files_limit=51200

service mysqld start

mysql_secure_installation

4,nginx和php的融合
mkdir -p /var/www/html
chown -R nginx:nginx /var/www/html
vi /etc/nginx/conf.d/default.conf
    #location / {
        root   /var/www/html;
        index  index.php index.html index.htm;
    #}
 
location ~ \.php$ {
    #    root           html;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcig_read_timeout 120;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

service nginx start

echo '<?php phpinfo(); ?>' > /var/www/html/index.php
http://IP檢驗lnmp安裝成功

5,系統內核參數調整(針對nginx和php)
cat >> /etc/security/limits.conf<<-EOF
* soft nofile 65535
* hard nofile 65535
EOF


cat >> /etc/sysctl.conf<<-EOF
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_fin_timeout = 10
net.ipv4.tcp_keepalive_time = 30
                                 
net.ipv4.ip_local_port_range = 1024 65000
net.ipv4.tcp_max_syn_backlog = 8192
net.ipv4.tcp_max_tw_buckets = 8000                             
net.core.somaxconn = 262144
                                 
net.ipv4.tcp_keepalive_probes = 5
net.ipv4.tcp_keepalive_intvl = 20
                                 
net.core.wmem_default = 8388608
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
                                 
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216                              
net.core.netdev_max_backlog = 32768
                                 
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syn_retries = 2
net.ipv4.tcp_retries2 = 5
                                 
net.ipv4.tcp_mem = 41943040 73400320 94371840
net.ipv4.tcp_max_orphans = 3276800
fs.file-max = 1300000

kernel.printk_ratelimit = 30
kernel.printk_ratelimit_burst = 200
EOF
sysctl -p使生效


6,安裝zabbix server
zabbix只會以普通用戶運行,若是root環境下運行,zabbix會主動嘗試以zabbix身份運行,若系統沒有zabbix用戶需創建
groupadd zabbix
useradd -g zabbix zabbix

yum install -y net-snmp-devel curl curl-devel libxml2-devel

wget http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3.2.7/zabbix-3.2.7.tar.gz
tar zxvf zabbix-3.2.7.tar.gz
cd zabbix-3.2.7
./configure --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2
make && make install

mysql -u root -p
mysql>create database zabbix default charset utf8;
mysql>use zabbix;
mysql>source /root/zabbix-3.2.7/database/mysql/schema.sql
mysql>source /root/zabbix-3.2.7/database/mysql/images.sql
mysql>source /root/zabbix-3.2.7/database/mysql/data.sql
mysql>grant all privileges on zabbix.* to 'zabbix'@'%' identified by 'uiop789';
mysql>flush privileges;
mysql>exit


vi /usr/local/etc/zabbix_server.conf
DBName=zabbix
DBUser=zabbix
DBPassword=uiop789
DBPort=3306

啓動zabbix_server
/usr/local/sbin/zabbix_server -c /usr/local/etc/zabbix_server.conf
默認端口10051
netstat -anp | grep 10051
tcp        0      0 0.0.0.0:10051               0.0.0.0:*                   LISTEN      23830/zabbix_server

配置客戶端(監控sever自己)

vi /usr/local/etc/zabbix_agentd.conf
Server=127.0.0.1
ServerActive=127.0.0.1
Hostname=Zabbix server

啓動客戶端(客戶端和服務端時間同步,設置crontab:0 0 * * * /usr/sbin/ntpdate -U 210.72.145.44)

/usr/local/sbin/zabbix_agentd -c /usr/local/etc/zabbix_agentd.conf

netstat -anp | grep 10050

關閉killall zabbix_agentd

拷貝前端文件
cp -rp frontens/php/* /var/www/html/zabbix/
chown nginx.nginx -R /var/www/html/zabbix/

根據以上設置直接http://IP/zabbix,便可看到前端配置提示,固然你也能夠自定義vhost後重啓nginx

登陸zabbix 默認用戶名:Admin:zabbix

單機Admin圖像在language裏選擇Chinese_simple,update後界面就變成中文的了,隨後添加模板、添加主機、各類監控走起

cp /root/zabbix-3.2.7/misc/init.d/fedora/core5/* /etc/init.d/
service zabbix_server start/stop/restart
service zbbbix_agentd start/stop/restart

chkconfig --add zabbix_server
chkconfig --add zabbix_agentd

chkconfig --list zabbix_server
chkconfig --list zabbix_agentd

chkconfig --level 35 zabbix_server on
chkconfig --level 35 zabbix_agentd on

客戶端獨立安裝zabbix_agentd
wget http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3.2.7/zabbix-3.2.7.tar.gz
tar zxvf zabbix-3.2.7.tar.gz
cd zabbix-3.2.7
./configure --enable-agent
make && make install

vi /usr/local/etc/zabbix_agentd.conf

Server=zabbix_server IP
ServerActive=zabbix_server IP
Hostname=uniq_name_client

groupadd zabbix useradd -g zabbix zabbix 啓動:/usr/local/sbin/zabbix_agentd -c /usr/local/etc/zabbix_agentd.conf

相關文章
相關標籤/搜索