huhahapz 发表于 2017-4-20 10:39:55

服务器监视工具 zabbix安装笔记

   zabbix安装笔记
  操作系统
  linux RedHat as 5
  软件环境
  Apache2.2
  Php5
  Mysql5
  Zabbix1.6
  软件安装
  Apache2.2
  下载:http://archive.apache.org/dist/httpd
  chmod +x xxxxxxx.tar.gz     (可执行权限)
  tar -zxvf httpd-2.2.9.tar.gz
  cd httpd-2.2.9

./configure --prefix=/usr/local/apache2 --enable-so --enable-mods-shared=most

make && make install


启动 /usr/local/apache2/bin/apachectl start


关闭 /usr/local/apache2/bin/apachectl stop
  Mysql5
  下载:http://dev.mysql.com/downloads
  mysql-5.0.67-linux-i686.tar.gz

安装mysql 写道

创建mysql用户及用户组
groupadd mysql
useradd -g mysql mysql
tar -zxvf mysql-5.0.67-linux-i686.tar.gz
复制目录
cp -r mysql-5.0.67-linux-i686 /usr/local/
mv /usr/local/mysql-5.0.67-linux-i686 /usr/local/mysql
配置文件
cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf
mysql目录权限
chown -R root /usr/local/mysql
chgrp -R mysql /usr/local/mysql
chown -R mysql /usr/local/mysql/data
mysql数据库生成
/usr/local/mysql/scripts/mysql_install_db --user=mysql&
启动mysql
/usr/local/mysql/bin/mysqld_safe --user=mysql&
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/
/etc/init.d/mysql.server start
/etc/init.d/mysql.server stop
mysql 的 root 密码
# /usr/local/mysql/bin/mysqladmin -u root -p password "密码"
  遇到的错误

Starting MySQL..Manager of pid-file quit without updating f[失败]
删除 /usr/local/mysql/data/mysql-bin.*
重启
生成mysql系统数据库
FATAL ERROR: Could not find ./bin/my_print_defaults
/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data

   Php5
  下载:http://www.php.net/downloads.php
  安装前必要的软件包
  net-snmp-devel-5.3.1-24.el5.i386.rpm
  libxml2-2.6.19.tar.gz
  libpng-1.2.8.tar.gz
  libjpeg-6b.tar.gz
  freetype-2.2.1.tar.gz
  curl-7.15.0.tar.gz
  zlib-1.2.3.tar.gz
  libiconv-1.9.2.tar.gz
  gd-2.0
  openssl
  先查询是不是有了这些包
  rpm -qa | grep xxxx

编译安装 写道

./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/u
sr/local/mysql --with-gd --with-jpeg-dir=/usr/local/bin/ --with-png-dir=/usr/local/bin/ --with-zlib --with-freetype-dir
=/usr/local/freetype/--with-libxml-dir=/usr/local/libxml2/ --with-curl=/usr/local/curl --with-snmp --with-openssl --w
ith-iconv --enable-bcmath --enable-sockets
make
make test
make install
cp php.ini-dist /usr/local/php5/lib/php/php.ini
修改php.ini
max_execution_time = 300
date.timezone = Asia/Shanghai

   遇到的错误

libphp5.so: cannot restore segment prot after reloc: Permission denied
#chcon -t texrel_shlib_t libphp5.so
libmysqlclient.so.15: cannot restore segment
#chcon –t texrel_shlib_t /usr/local/mysql/lib/libmysqlclient.so.15
Notice: Following unknown configure options were used:
--with-jpeg
--with-png
--with-freetype
--with-libxml
--with-crul
路径问题查看帮助 ./configure --help

   编辑phpinfo.php
<?php
phpinfo();
?>
  修改httpd.conf  添加
AddType application/x-httpd-php .php .phtml .php4 .inc
DirectoryIndex index.php
  启动Apache
  看到php信息表示完成
  怪问题 php.ini 修改了max_execution_time 没有反映
  php.ini路径不对.......
  cp /usr/local/php5/lib/php/php.ini /usr/local/php5/lib
  就好了
  安装zabbix1.6

zabbix 写道

创建zabbix用户
groupadd zabbix
useradd -g 《gid》 -s /sbin/nologin zabbix
tar zxvf zabbix-1.6.tar.gz
cd zabbix-1.6
编译
./configure --prefix=/etc/zabbix --with-mysql=/usr/local/mysql/bin/mysql_config --with-net-snmp --with-curl=/usr/local/curl --enable-
server --enable-agent
make && make install
  导入数据
  /usr/local/mysql/bin/mysql -uroot -p<password>
mysql> create database zabbix;
mysql> quit;
shell> cd create/schema
shell> cat mysql.sql | /usr/local/mysql/bin/mysql-u<username> -p<password> zabbix
shell> cd ../data
shell> cat data.sql | /usr/local/mysql/bin/mysql -u<username> -p<password> zabbix
shell> cat images_mysql.sql | /usr/local/mysql/bin/mysql-u<username> -p<password> zabbix
  zabbix 设置

vi /etc/services
zabbix-agent 10050/tcp Zabbix Agent
zabbix-agent 10050/udp Zabbix Agent
zabbix-trapper 10051/tcp Zabbix Trapper
zabbix-trapper 10051/udp Zabbix Trapper

vi /etc/zabbix/zabbix_server.conf
ListenPort=10051
DBHost=localhost
DBName=zabbix
DBUser=root
DBPassword=
DBSocket=/tmp/mysql.sock

vi /etc/init.d/zabbix_server_ctl
# base zabbix dir
BASEDIR=/etc/zabbix
# PID file
PIDFILE=/var/tmp/zabbix_server.pid
# binary file
ZABBIX_SUCKERD=$BASEDIR/sbin/zabbix_server
   配置文件
  mkdir /etc/zabbix
chown -R zabbix.zabbix /etc/zabbix/
cp misc/conf/zabbix_* /etc/zabbix/
  复制启动程序
cp misc/init.d/redhat/zabbix_server_ctl  /etc/init.d/
cp misc/init.d/redhat/zabbix_agentd_ctl /etc/init.d/
  复制zabbix
  mkdir /usr/local/apachew/htdocs/zabbix
cp -Rpf frontends/php/* /usr/local/apachew/htdocs/zabbix
  自启动
  chkconfig --add zabbix-server
  chkconfig --add zabbix-agent
  chkconfig zabbix-server on
  chkconfig zabbix-agent on
  例 :
  Apache 在系统运行级别3,4,5自动启动

chkconfig 写道

编辑apachectl
vi /usr/local/apache2/bin/apachectl
第2行处添加
#chkconfig:345 61 61 //3,4,5 运行级 61,61 启动与关闭序号
#description:Apache2 //描述必写
保存退出
复制
cp /usr/local/apache2/bin/apachectl /etc/init.d/apache
加入apache服务
chkconfig --add apache
查看
chkconfig --list apache
apache          0:关闭1:关闭2:关闭3:启用4:启用5:启用6:关闭
查看帮助
chkconfig --help
可以看到在 /etc/rc.d/rc3.d /etc/rc.d/rc4.d /etc/rc.d/rc5.d 目录内
自动做了apache脚本的软链接
启动
service apache start

   错误集

错误 写道

启动 错误
/etc/init.d/zabbix_server_ctl start
/etc/zabbix/sbin/zabbix_server: error while loading shared libraries: libmysqlclient.so.15: cannot open shared object file: No such file or directory
cp /usr/lib/mysql/libmysqlclient.so /lib
/etc/init.d/zabbix_server_ctl start
/etc/init.d/zabbix_server_ctl start: zabbix_server started
编译 ./configure --enable-server --enable-agent --with-mysql --with-net-snmp --prefix=/usr/local/
zabbix
错误configure: error: Invalid NET-SNMP directory - unable to find net-snmp-config
安装 net-snmp 包
  登陆
http://IP/zabbix
Admin/zabbix
  是个很不错的工具,用了一天的时间安装。出了很多错误,好多忘记记下来了.... 悔.....
  想起来再修改
  接下来就是用好它
页: [1]
查看完整版本: 服务器监视工具 zabbix安装笔记