rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
yum install nginx php-gd php-zlib php-curl php-snmp php-mysql mysql-server mysql-client php-fpm -y
rpm -ivh http://repo.zabbix.com/zabbix/2.2/rhel/6/x86_64/zabbix-release-2.2-1.el6.noarch.rpm
yum install zabbix-server-mysql zabbix-web-mysql
yum install zabbix-agent
vim /etc/nginx/conf.d/default.conf
server {
listen 80 default_server;
server_name localhost;
charset utf8;
access_log /var/log/nginx/zabbix.access.log;
error_log /var/log/nginx/zabbix.error.log;
location / {
root /usr/share/zabbix;
index index.php index.html index.htm;
}
error_page 404 /404.html;
location = /404.html {
root /usr/share/nginx/html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
root /usr/share/zabbix;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/zabbix$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
mkdir -p /var/www/html -p
chown -R nginx: /usr/share/zabbix /etc/zabbix/web
sed -i '/pm/s/dynamic/static/g' /etc/php-fpm.d/www.conf
sed -i '/user/s/apache/nginx/g' /etc/php-fpm.d/www.conf
sed -i '/group/s/apache/nginx/g' /etc/php-fpm.d/www.conf
sed -i '/pm.max_children/s/50/20/g' /etc/php-fpm.d/www.conf
sed -i '/pm.max_spare_servers/s/35/15/g' /etc/php-fpm.d/www.conf
sed -i '/max_execution_time/s/30/300/g' /etc/php.ini
sed -i '/post_max_size/s/8M/16M/g' /etc/php.ini
sed -i '/max_input_time/s/60/300/g' /etc/php.ini
sed -i 's/;date.timezone \=/date.timezone \= Asia\/Shanghai/g' /etc/php.ini
service mysqld start
/usr/bin/mysql_secure_installation #设置帐号密码和匿名账户等
mysql -u root -p
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
mysql> exit
Import initial schema and data.# cd /usr/share/doc/zabbix-server-mysql-2.2.0/create
# mysql -uroot zabbix < schema.sql
# mysql -uroot zabbix < images.sql
# mysql -uroot zabbix < data.sql
vi /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
service mysqld start
service php-fpm start
service nginx start
service zabbix-server start
service zabbix-agent start
chkconfig mysqld on
chkconfig php-fpm on
chkconfig nginx on
chkconfig zabbix-server on
chkconfig zabbix-agent on
rpm -ivh http://repo.zabbix.com/zabbix/2.2/rhel/6/x86_64/zabbix-release-2.2-1.el6.noarch.rpm
yum install zabbix-agent -y
vim /etc/zabbix/zabbix_agentd.conf
Server=192.168.1.5 #服务器IP
Hostname=www #当前主机
或者sed -i '/Server/s/127.0.0.1/192.168.1.3/g' /etc/zabbix/zabbix_agentd.conf
sed -i '/ServerActive/s/127.0.0.1/192.168.1.3/g' /etc/zabbix/zabbix_agentd.conf
sed -i '/Hostname/s/Zabbix server/www2/g' /etc/zabbix/zabbix_agentd.conf
cp -R /etc/zabbix-agent.d/* /etc/zabbix/zabbix_agentd.d/
rm -f /etc/zabbix/zabbix_agentd.d/userparameter_mysql.conf
sed -i '/system.cpu.temp/d' /etc/zabbix/zabbix_agentd.d/linux.conf
sed -i '/zabbix_agentd/d' /etc/rc.local
killall zabbix_agentd&&service zabbix-agent start
chkconfig zabbix-agent on
service zabbix-agent start