zabbix v3.0.3
Required:
mysql version: 5.0.3 or later
oracle version: 10g or later
php version: 5.4.0 or later
gd version: 2.0 or later
libXML version: 2.6.15 or later
官方说明:https://www.zabbix.com/documentation/3.0/manual/installation/requirements
installation:
[root@localhost ~]# useradd -s /sbin/nologin nginx nginx安装略 [root@localhost ~]# yum -y install gcc gcc-c++ make [root@localhost ~]# yum -y install libxml2 libxml2-devel libjpeg-devel libpng-devel bzip2-devel libcurl-devel gd-devel [root@localhost ~]# tar -zxf php-5.5.0.tar.gz [root@localhost ~]# cd php-5.5.0 [root@localhost php-5.5.0]# ./configure --prefix=/usr/local/php --with-bz2 --with-curl --enable-ftp --enable-sockets --enable-bcmath --disable-ipv6 --with-gd --with-jpeg-dir=/usr/local/photo --with-png-dir=/usr/local/photo --with-freetype-dir=/usr/local --enable-gd-native-ttf --with-iconv-dir=/usr/local --enable-mbstring --enable-calendar --with-gettext --with-libxml-dir=/usr/local --with-zlib --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-mysql=mysqlnd --enable-dom --enable-xml --enable-fpm --with-libdir=lib64 [root@localhost php-5.5.0]# make [root@localhost php-5.5.0]# make test [root@localhost php-5.5.0]# make install [root@localhost php-5.5.0]# cp php.ini-production /usr/local/php/lib/php.ini [root@localhost ~]# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf [root@localhost ~]# sed -i '/max_execution_time/s/30/300/' /usr/local/php/lib/php.ini [root@localhost ~]# sed -i '/post_max_size/s/8/16/' /usr/local/php/lib/php.ini [root@localhost ~]# sed -i '/max_input_time/s/60/300/' /usr/local/php/lib/php.ini [root@localhost ~]# sed -i '/^;date.timezone/adate.timezone \= \"Asia\/Shanghai\"' /usr/local/php/lib/php.ini [root@localhost ~]# sed -i '/run\/php-fpm.pid/s/^;//g' /usr/local/php/etc/php-fpm.conf [root@localhost ~]# sed -i '/^;pm.min_spare_servers/s/^;//g' /usr/local/php/etc/php-fpm.conf [root@localhost ~]# sed -i '/^;pm.max_spare_servers/s/^;//g' /usr/local/php/etc/php-fpm.conf [root@localhost ~]# sed -i '/^;pm.start_servers/s/^;//g' /usr/local/php/etc/php-fpm.conf [root@localhost ~]# /usr/local/php/sbin/php-fpm [root@localhost ~]# echo "/usr/local/php/sbin/php-fpm" >>/etc/rc.local
php yum安装:
[root@localhost ~]# yum -y install php55w php55w-mysql php55w-gd libjpeg* php55w-imap php55w-ldap php55w-odbc php55w-pear php55w-xml php55w-xmlrpc php55w-mbstring php55w-mcrypt php55w-bcmath php55w-mhash libmcrypt libmcrypt-devel php55w-fpm php55w-cli php55w-pdo php55w-tidy php55w-pecl-memcache php55w-eaccelerator
mysql安装:
[root@localhost ~]# yum -y install mysql mysql-server mysql-devel [root@localhost ~]# cp /usr/share/mysql/my-medium.cnf /etc/my.cnf [root@localhost ~]# chkconfig mysqld on [root@localhost ~]# /etc/init.d/mysqld start [root@localhost ~]# mysqladmin -uroot password "redhat" [root@localhost ~]# mysql_secure_installation
[root@localhost ~]# yum -y install net-snmp net-snmp-devel libxml2-devel libcurl-devel [root@localhost ~]# tar -zxf zabbix-3.0.3.tar.gz [root@localhost ~]# cd zabbix-3.0.3 [root@localhost zabbix-3.0.3]# ./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2 --enable-java [root@localhost zabbix-3.0.3]# make && make install [root@localhost zabbix-3.0.3]# useradd -s /sbin/nologin zabbix
[root@localhost ~]# mysql -uroot -predhat mysql> create database zabbix default charset utf8; mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix'; mysql> grant all privileges on zabbix.* to zabbix@192.168.70.193 identified by 'zabbix'; mysql> flush privileges;
[root@localhost zabbix-3.0.3]# mysql -uzabbix -pzabbix zabbix < database/mysql/schema.sql [root@localhost zabbix-3.0.3]# mysql -uzabbix -pzabbix zabbix < database/mysql/p_w_picpaths.sql [root@localhost zabbix-3.0.3]# mysql -uzabbix -pzabbix zabbix < database/mysql/data.sql [root@localhost zabbix-3.0.3]# cp misc/init.d/fedora/core/zabbix_* /etc/init.d/ [root@localhost zabbix-3.0.3]# chmod 775 /etc/init.d/zabbix_* [root@localhost zabbix-3.0.3]# sed -i '/LogFile/s/tmp/var\/log\/zabbix/' /usr/local/zabbix/etc/zabbix_server.conf [root@localhost zabbix-3.0.3]# sed -i '/^DBUser\=/s/root/zabbix/' /usr/local/zabbix/etc/zabbix_server.conf [root@localhost zabbix-3.0.3]# sed -i '/DBPassword\=$/s/^#//g' /usr/local/zabbix/etc/zabbix_server.conf [root@localhost zabbix-3.0.3]# sed -i '/DBPassword\=$/s/^[ \t]//g' /usr/local/zabbix/etc/zabbix_server.conf [root@localhost zabbix-3.0.3]# sed -i '/DBPassword\=$/s/\=/&zabbix/g' /usr/local/zabbix/etc/zabbix_server.conf [root@localhost zabbix-3.0.3]# sed -i -e '/DBPort\=/s/^#//g' /usr/local/zabbix/etc/zabbix_server.conf -e '/DBPort\=/s/^[ \t]//g' /usr/local/zabbix/etc/zabbix_server.conf [root@localhost zabbix-3.0.3]# sed -i '/^Server/s/127.0.0.1/192.168.70.193/g' /usr/local/zabbix/etc/zabbix_agentd.conf [root@localhost zabbix-3.0.3]# sed -i "/^ServerActive/s/127.0.0.1/192.168.70.193:10051/g" /usr/local/zabbix/etc/zabbix_agentd.conf [root@localhost zabbix-3.0.3]# sed -i "/^Hostname/s/Zabbix server/192.168.70.193/g" /usr/local/zabbix/etc/zabbix_agentd.conf
[root@localhost ~]# yum -y install net-snmp net-snmp-devel libxml2-devel libcurl-devel [root@localhost ~]# tar -zxf zabbix-3.0.3.tar.gz [root@localhost ~]# cd zabbix-3.0.3 [root@localhost zabbix-3.0.3]# ./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2 --enable-java [root@localhost zabbix-3.0.3]# make &&make install [root@localhost zabbix-3.0.3]# mkdir /usr/local/nginx-1.6.3/html/zabbix -p [root@localhost zabbix-3.0.3]# cp frontends/php/* /usr/local/nginx-1.6.3/html/zabbix/ -r [root@localhost zabbix-3.0.3]# chown zabbix:zabbix /usr/local/nginx-1.6.3/html/zabbix/ -R [root@localhost zabbix-3.0.3]# chmod o+w /usr/local/nginx-1.6.3/html/zabbix/conf [root@localhost zabbix-3.0.3]# ln -s /usr/local/zabbix/sbin/* /usr/local/sbin/ [root@localhost zabbix-3.0.3]# mkdir -p /var/log/zabbix [root@localhost zabbix-3.0.3]# touch /var/log/zabbix/zabbix_server.log [root@localhost zabbix-3.0.3]# chown zabbix:zabbix /var/log/zabbix/ -R [root@localhost ~]# /etc/init.d/zabbix_server start Starting zabbix_server: [ OK ] [root@localhost ~]# /etc/init.d/zabbix_agentd start Starting zabbix_agentd: [ OK ] [root@localhost ~]# [root@localhost ~]# chkconfig --add zabbix_server && chkconfig zabbix_server on [root@localhost ~]# chkconfig --add zabbix_agentd && chkconfig zabbix_agentd on
zabbix nginx配置:
[root@localhost ~]# touch /usr/local/nginx-1.6.3/logs/zabbix_access.log location /zabbix { root /usr/local/nginx-1.6.3/html; index index.php; access_log /usr/local/nginx-1.6.3/logs/zabbix_access.log; try_files $uri $uri/ /index.php?$args; } location ~ ^(.+.php)(.*)$ { root /usr/local/nginx-1.6.3/html; fastcgi_buffer_size 128k; fastcgi_buffers 32 32k; fastcgi_split_path_info ^(.+.php)(.*)$; include fastcgi.conf; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param PATH_INFO $fastcgi_path_info; }
配置完成后,启动php、mysql、zabbix、nginx
如果点下一步浏览器没反映,nginx和zabbix都未报错,可以通过修改配置文件绕过安装向导
[root@localhost ~]# cd /opt/server/nginx-1.2.5/html/zabbix/conf
[root@localhost conf]# cp zabbix.conf.php.example zabbix.conf.ph
解决方法:
安装zabbix3.0 点击下一步“Next Step”没反应的解决办法:
检查/var/lib/php下session文件夹属性,一定要让php-fpm进程的属主或属组对其有rwx权限。
更改权限后,一切正常。如:
[root@localhost ~]# ll /var/lib/php/ total 8 drwxrwx---. 2 nginx nginx 4096 Mar 19 19:13 session drwxrwx---. 2 nginx nginx 4096 Feb 18 18:51 wsdlcache [root@localhost ~]#
如果安装时出现这个问题,是因为没有安装php-mysql。如:安装的是php55w,则是php55w-mysql
然后修改里面的配置,再次打开时就可以直接登录了,默认密码是admin/zabbix
安装完成.