#!/bin/bash
yum -y install httpd php mysql mysql-server php-mysql php-devel httpd-manual mod_ssl mod_perl mod_auth_mysql php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc mysql-connector-odbc mysql-devel libdbi-dbd-mysql mysql-devel mysql-server httpd net-snmp-devel curl-devel perl-DBI php-gd php-mysql php-bcmath gd jpeg zlib libpng freetype dev-libs dev-libxml libxml gcc* make
/etc/init.d/mysqld start >/dev/null 2>&1
/etc/init.d/httpd start >/dev/null 2>&1
chkconfig mysqld on
chkconfig httpd on
groupadd zabbix
useradd zabbix -g zabbix
cd /usr/local/src/
tar zxvf zabbix-2.0.5.tar.gz -C /usr/local/src/
#有密码mysql -uroot -ppasswd
mysql <<EOF
create database zabbix character set utf8;
grant all on zabbix.* to zabbix@localhost identified by 'zabbix';
flush privileges;
EOF
mysql -uzabbix -pzabbix zabbix </usr/local/src/zabbix-2.0.5/database/mysql/schema.sql
mysql -uzabbix -pzabbix zabbix </usr/local/src/zabbix-2.0.5/database/mysql/images.sql
mysql -uzabbix -pzabbix zabbix </usr/local/src/zabbix-2.0.5/database/mysql/data.sql
cd /usr/local/src/zabbix-2.0.5
./configure --prefix=/usr/local/zabbix --enable-server --enable-proxy --enable-agent --with-mysql=/usr/bin/mysql_config --with-net-snmp --with-libcurl && make && make install
mkdir /etc/zabbix
cp conf/* /etc/zabbix/ -r
cat >/usr/local/zabbix/etc/zabbix_server.conf <<eof
CacheSize=512M
StartPollers=30
DBPassword=zabbix
DBUser=zabbix
DBName=zabbix
LogFile=/var/log/zabbix/zabbix_server.log
eof
cat >/usr/local/zabbix/etc/zabbix_agent.conf <<eof
PidFile=/tmp/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
Server=127.0.0.1
ServerActive=0.0.0.0:10051
Hostname=localhost.localdomain
eof
ln -s /usr/local/zabbix/etc/zabbix_server.conf /etc/zabbix/zabbix_server.conf
ln -s /usr/local/zabbix/etc/zabbix_agent.conf /etc/zabbix/zabbix_agent.conf
mkdir /var/log/zabbix
chown zabbix.apache /var/log/zabbix/
ln -s /usr/local/zabbix/bin/zabbix_* /usr/bin/
ln -s /usr/local/zabbix/sbin/zabbix_ /usr/sbin/
ln -s /usr/local/zabbix/sbin/zabbix_* /usr/local/sbin/
cp -r /usr/local/src/zabbix-2.0.5/frontends/php/ /var/www/html/zabbix
chown -R apache.apache /var/www/html/zabbix
cp /usr/local/src/zabbix-2.0.5/misc/init.d/fedora/core5/zabbix_* /etc/init.d/ -p
/etc/init.d/zabbix_agentd start
/etc/init.d/zabbix_server start
chkconfig zabbix_server on
chkconfig zabbix_agentd on
echo "date.timezone = Asia/Shanghai" >> /etc/php.ini
sed -i "s/post_max_size=*.*/post_max_size=32M/g" /etc/php.ini
sed -i "s/max_execution_time=*.*/max_execution_time=300/g" /etc/php.ini
sed -i "s/max_input_time =*.*/max_input_time =300/g" /etc/php.ini
sed -i "s/memory_limit=*.*/memory_limit =128M/g" /etc/php.ini
sed -i "s/mbstring.func_overload =*.*/mbstring.func_overload=2/g" /etc/php.ini
cp /var/www/html/zabbix/conf/zabbix.conf.php.example /var/www/html/zabbix/conf/zabbix.conf.php
sed -i 's/zabbix_password/zabbix/g' /var/www/html/zabbix/conf/zabbix.conf.php
service httpd restart
service iptables off
setenforce 0
echo "please install your zabbix "http:/url/zabbix" "
运维网声明
1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网 享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com