centos5.5下的zabbix安装

Zabbix 服务器端安装
    关于安装时添加chkconfig时那几行不保证正确。QQ:40594324如有问题,纯属正常
 
部署环境:centos 5.5
涉及软件:
httpd-2.2.19.tar.gz
mysql-5.1.57-linux-i686-glibc23.tar.gz
libpng-1.2.8.tar.gz
php-5.2.9.tar.gz
net-snmp-5.4.3.tar.gz
zabbix-1.8.tar.gz
 
安装 httpd
cd /home
tar -zxvf httpd-2.2.19.tar.gz
cd httpd-2.2.19
./configure --prefix=/usr/local/apache2 --enable-so --enable-mods-shared=most
make && make install
/bin/cp  /usr/local/apache2/bin/apachectl /etc/init.d/httpd 
 
vi /etc/init.d/httpd 
# chkconfig: 2345 80 90
# description:apache
 
chkconfig --add httpd
chkconfig --level 345 httpd on
 
 
 
安装mysql( 64位系统需要替换为64位的mysql,否则php安装报错)
groupadd mysql
useradd -r -g mysql mysql                          
cd /home
tar zxvf mysql-5.1.57-linux-i686-glibc23.tar.gz
mv mysql-5.1.57-linux-i686-glibc23 /usr/local/mysql
cd /usr/local/mysql
chown -R mysql:mysql /usr/local/mysql
/bin/cp support-files/my-medium.cnf /etc/my.cnf
./scripts/mysql_install_db --user=mysql 
/usr/local/mysql/bin/mysqld_safe  --user=mysql &
./bin/mysqladmin -u root password yournewpassword
echo "/usr/local/mysql/bin/mysqld_safe  --user=mysql &" >>/etc/rc.local
echo  "export PATH=$PATH:/usr/local/mysql/bin"   >>/etc/profile
source /etc/profile
netstat -npl     
cp support-files/mysql.server /etc/init.d/mysqld   
service mysqld restart
chkconfig --level 345 mysqld on
 
 
安装libpng(64位系统安装64位的libpng)
cd /home
tar zxvf libpng-1.2.8.tar.gz
cd libpng-1.2.8
cp scripts/makefile.std makefile
make && make install
 
安装 php
cd /home
tar zxvf php-5.2.9.tar.gz
cd php-5.2.9
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config  --enable-sockets --enable-pdo --with-pdo-mysql=/usr/local/mysql --with-gd --enable-bcmath --enable-xml --enable-mbstring
make && make install
/bin/cp php.ini-dist /usr/local/php/etc/php.ini
echo "AddType application/x-httpd-php  .php">>/usr/local/apache2/conf/httpd.conf
echo "<?php">>/usr/local/apache2/htdocs/index.php
echo "Phpinfo();">>/usr/local/apache2/htdocs/index.php
echo "?>">>/usr/local/apache2/htdocs/index.php
sed -i s#"post_max_size = 8M"#"post_max_size = 16M"#g /usr/local/php/etc/php.ini
sed -i s#"max_execution_time = 30"#"max_execution_time = 300"#g /usr/local/php/etc/php.ini
sed -i s#";date.timezone ="#"date.timezone=Asia/Shanghai"#g /usr/local/php/etc/php.ini
sed -i s#";mbstring.func_overload = 0"#"mbstring.func_overload = 2"#g /usr/local/php/etc/php.ini
/etc/init.d/httpd restart
 
安装 net-snmp 涉及 zabbix
cd /home
tar zxvf net-snmp-5.4.3.tar.gz
cd net-snmp-5.4.3
./configure --prefix=/usr/local/net-snmp
 
 
make && make install
/bin/cp EXAMPLE.conf /usr/local/net-snmp/share/snmp/snmpd.conf
ln -s /usr/local/net-snmp/bin/* /usr/local/bin/
/usr/local/net-snmp/sbin/snmpd -c /usr/local/net-snmp/share/snmp/snmpd.conf
echo "/usr/local/net-snmp/sbin/snmpd -c /usr/local/net-snmp/share/snmp/snmpd.conf" >>/etc/rc.local
 
#zabbix
cd /home
tar zxvf zabbix-1.8.tar.gz
cd zabbix-1.8
groupadd zabbix
useradd zabbix -g zabbix
mysql -uroot -pyournewpassword                             
create database zabbix character set utf8;
grant all on zabbix.* to zabbix@localhost identified by 'zabbix';
quit
mysql -uroot -pyournewpassword zabbix < create/schema/mysql.sql
mysql -uroot -pyournewpassword zabbix < create/data/data.sql
mysql -uroot -pyournewpassword zabbix < create/data/images_mysql.sql
./configure --enable-server --enable-proxy --enable-agent --with-mysql=/usr/local/mysql/bin/mysql_config --with-net-snmp --with-libcurl --prefix=/usr/local/zabbix
 
make && make install
echo "zabbix_agent 10050/tcp # zabbix agent">>/etc/services 
echo "zabbix_agent 10050/udp # zabbix agent">>/etc/services 
echo "zabbix_trapper 10051/tcp # zabbix trapper">>/etc/services   
echo "zabbix_trapper 10051/udp # zabbix trapper">>/etc/services   
 
mkdir /etc/zabbix
cp misc/conf/zabbix_server.conf /etc/zabbix/
cp misc/conf/zabbix_proxy.conf /etc/zabbix/
cp misc/conf/zabbix_agent.conf /etc/zabbix/
cp misc/conf/zabbix_agentd.conf /etc/zabbix/
 
sed -i s#"DBUser=root"#"DBUser=zabbix"#g /etc/zabbix/zabbix_server.conf
sed -i s#"\# DBPassword="#"DBPassword=zabbix"#g /etc/zabbix/zabbix_server.conf
 
cp misc/init.d/redhat/zabbix_agentd_ctl   /etc/init.d/zabbix_agentd
cp misc/init.d/redhat/zabbix_server_ctl   /etc/init.d/zabbix_server
 
vi /etc/init.d/zabbix_server                  
 
#chkconfig:345 82 90
#description:zabbix_server
BASEDIR=/usr/local/zabbix
ZABBIX_SUCKERD=$BASEDIR/sbin/zabbix_server
 
vi /etc/init.d/zabbix_agentd           
#!/bin/sh
#chkconfig:345 83 90
#description:zabbix_agentd
BASEDIR=/usr/local/zabbix
ZABBIX_AGENTD=$BASEDIR/sbin/zabbix_agentd
 
chkconfig --level 345 zabbix_server on         
chkconfig --level 345 zabbix_agentd on
cp -Rpf frontends/php/ /usr/local/apache2/htdocs/zabbix
 
/etc/init.d/zabbix_server start
echo /usr/local/mysql/lib/ >> /etc/ld.so.conf
echo /usr/local/net-snmp/lib/ >> /etc/ld.so.conf
ldconfig
 
/etc/init.d/zabbix_server start
/etc/init.d/zabbix_agentd start
 
 
 
 
 
 
zabbix 客户端配置 全文复制粘贴即可
groupadd zabbix
useradd  zabbix -g zabbix
cd /home
tar zxvf zabbix-1.8.tar.gz
cd zabbix-1.8
./configure --enable-agent --prefix=/usr/local/zabbix
make install
mkdir /etc/zabbix
/bin/cp misc/conf/zabbix_agentd.conf /etc/zabbix/
/bin/cp misc/init.d/redhat/zabbix_agentd_ctl /etc/init.d/zabbix_agentd
sed -i s#Server=127.0.0.1#Server= 你的服务器地址 自己修改 #g /etc/zabbix/zabbix_agentd.conf
sed -i '1a#chkconfig:345 83 90\n#description:zabbix_agent' /etc/init.d/zabbix_agentd
sed -i s#"BASEDIR=/opt/zabbix"#"BASEDIR=/usr/local/zabbix"#g /etc/init.d/zabbix_agentd
sed -i s#'ZABBIX_AGENTD=$BASEDIR/bin/zabbix_agentd'#'ZABBIX_AGENTD=$BASEDIR/sbin/zabbix_agentd'#g /etc/init.d/zabbix_agentd
chkconfig --level 345 zabbix_agentd on
/etc/init.d/zabbix_agentd start
: 服务器 zabbix_agtentd /etc/zabbix/zabbix_agentd
Server=127.0.0.1
Hostname=127.0.0.1 

你可能感兴趣的:(centos,职场,监控,zabbix,休闲)