#各版本下载源

wget -c http://ncu.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Development/3.0.0alpha2/zabbix-3.0.0alpha2.tar.gz


#安装


rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/6/x86_64/zabbix-release-3.0-1.el6.noarch.rpm

yum install -y mysql-server zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-java-gateway

vi /etc/httpd/conf.d/zabbix

php_value date.timezone Asia/Shanghai

wq

service httpd restartvi

service mysqld start

mysql_secure_installation

mysql -u root  -p

create database zabbix character set utf8;

grant all privileges on zabbix.* to 'zabbix'@'localhost' identified by 'password';

flush privileges;

exit

mysql -u zabbix -p zabbix < /usr/share/doc/zabbix-server-mysql-2.4.7/create/schema.sql

mysql -u zabbix -p zabbix < /usr/share/doc/zabbix-server-mysql-2.4.7/create/p_w_picpaths.sql

mysql -u zabbix -p zabbix < /usr/share/doc/zabbix-server-mysql-2.4.7/create/data.sql






#============zabbix-client install 方法一========================




#===============zabbix源码安装=============================

yum -y groupinstall "Development Tools"   #安装开发软件包


yum -y install nginx mysql mysql-server mysql-devel php php-mysql php-common php-mbstring php-gd php-odbc php-pear curl curl-devel net-snmp net-snmp-devel perl-DBl php-xml ntpdate php-bcmath #安装依赖


yum -y install sqlite-devel wget gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel pcre pcre-devel nss_ldap openldap-clients openldap-servers zlib zlib-devel expat-devel perl perl-devel cpio gettext-devel expect rsync lsof mlocate inotify-tools xinetd telnet unzip tree numactl


ntpdate time.windows.com  #同步时间




#创建zabbix用户和组

groupadd -g 201 zabbix

useradd -g zabbix -u 201 -m zabbix

passwd zabbix

#启动MySQL


service mysqld start

chkconfig mysqld on

vi /etc/sysconfig/seliunx


setenforce 0



#创建zabbix所需要的数据库及用户权限

mysqladmin -uroot -h127.0.0.1 password "111111"

mysql -uroot -h127.0.0.1 -p111111

create database zabbix character set utf8;

grant all privileges on zabbix.* to zabbix@'%' identified by 'zabbix';

flush privileges;

exit


#下载zabbix

wget http://ufpr.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.0.1/zabbix-3.0.1.tar.gz

wget http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/2.2.2/zabbix-2.2.2.tar.gz/download

tar -xf download 

mv zabbix-2.2.2.tar.gz zabbix

cd zabbix



#将zabbix导入数据库   mPpOyyBuH4glfG2pQBfc

mysql -uroot  -p zabbix

mysql -uroot  -p zabbix

mysql -uroot  -p zabbix

#编译zabbix

./configure -sysconfdir=/etc/zabbix/ -enable-server -enable-agent -with-net-snmp -with-libcurl -with-mysql

make && make install



#Copy zabbixServer端和agent端的启动项到etc/init.d

cp -r misc/init.d/tru64/zabbix_server  /etc/init.d/

cp -r misc/init.d/tru64/zabbix_agentd  /etc/init.d/

chmod +x /etc/init.d/zabbix_*


#copy zabbix页面到指定目录(与Apache配置目录相同)

mkdir /var/www/html/zabbix

cp -r frontends/php/* /var/www/html/zabbix

chown -R apache.apache /var/www/html/zabbix/


#配置PHP文件

vi /etc/php.ini


date.timezone=Asia/Shanghai

max_execution_time=300

max_input_time=300

post_max_size=32M

memory_limit=128M

mbstring.func_overload=2

#添加配置文件


rm -rf /etc/zabbix/*

cd /root/zabbix

cp -r conf/* /etc/zabbix/

vi /etc/zabbix/zabbix_server.conf

DBName=zabbix

DBUser=zabbix

DBPsswd=zabbix

grep zabbix /etc/services 

#启动服务

/etc/init.d/zabbix_server start

/etc/init.d/httpd start


#测试连接

http://ip/zabbix

#=================zabbix install 方法二===========================

yum -y groupinstall "Development Tools"   #安装开发软件包

ntpdate pool.ntp.rog  #同步时间

#创建zabbix用户和组

groupadd -g 201 zabbix

useradd -g zabbix -u 201 -m zabbix


yum -y install sqlite-devel wget gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel pcre pcre-devel nss_ldap openldap-clients openldap-servers zlib zlib-devel expat-devel perl perl-devel cpio gettext-devel expect rsync lsof mlocate inotify-tools xinetd telnet unzip tree numactl


#下载zabbix

wget http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/2.2.2/zabbix-2.2.2.tar.gz/download

mkdir zabbix

cp -r  zabbix-2.2.2.tar.gz /root/zabbix

cd zabbix

tar -xf zabbix-2.2.2.tar.gz



#编译zabbix

./configure -sysconfdir=/etc/zabbix/ -enable-server -enable-agent -with-net-snmp -with-libcurl -with-mysql

make && make install


vi /etc/zabbix/zabbix_agentd.conf  #注:修改内容

server=SERVER IP

HostName=本机IP

ServerActive=SERVER IP

service zabbix-agent start