zhouandtao 发表于 2019-1-10 11:01:55

配置CACTI监控MySQL数据库状态(2)安装cacti相关软件包

1、安装软件包
1.1 安装APACHE
  创建组/用户及安装apache:
  # groupadd apache
  # useradd -g apache apache
  # chown apache:apache /data/www -R
  # wget http://mirror.bjtu.edu.cn/apache/httpd/httpd-2.2.21.tar.gz
  # tar xvfz httpd-2.2.21.tar.gz
  # cd httpd-2.2.21
  # ./configure \
  --prefix=/usr/local/webserver/apache2.2.21 \
  --enable-so\
  --enable-deflate\
  --enable-cache\
  --enable-disk-cache\
  --enable-mem-cache\
  --enable-file-cache\
  --enable-modules=all\
  --enable-shared=max\
  --enable-rewrite\
  --enable-static-support\
  --enable-static-htpasswd\
  --enable-static-htdigest\
  --enable-static-rotatelogs\
  --enable-static-logresolve\
  --enable-static-htdbm\
  --enable-static-ab\
  --enable-static-checkgid\
  --enable-vhost-alias\
  --with-mpm=worker
  # make
# make install

[*]
1.2 安装MySQL
  自MySQL5.5版本之后,编译工具变成了CMake,这里首先安装CMake:
  # wget http://www.cmake.org/files/v2.8/cmake-2.8.4.tar.gz
  # tar xvfz cmake-2.8.4.tar.gz
  # cd cmake-2.8.4
# ./configure

[*]
  接下来安装MySQL,先创建用户,而后再执行编译。
  # groupadd mysql
  # useradd -g mysql mysql
  # tar xvfz mysql-5.5.20.tar.gz
  # cd mysql-5.5.20
  # cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
  >   -DDEFAULT_CHARSET=utf8 \
  >   -DDEFAULT_COLLATION=utf8_general_ci \
  >   -DENABLED_LOCAL_INFILE=ON \
  >   -DWITH_INNOBASE_STORAGE_ENGINE=1 \
  >   -DWITH_FEDERATED_STORAGE_ENGINE=1 \
  >   -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
  >   -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \
  >   -DWITH_PARTITION_STORAGE_ENGINE=1 \
  >   -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
  >   -DCOMPILATION_COMMENT=¨JSS for BKmysql¨ \
  >   -DMYSQL_UNIX_ADDR=/data/mysqldata/3306/mysql.sock \
  >   -DSYSCONFDIR=/data/mysqldata/3306
  # make
  # make install
# chown mysql:mysql /usr/local/mysql -R

[*]
  创建数据库并启动MySQL服务:
  # sudo su - mysql
  $ /usr/local/mysql/scripts/mysql_install_db --datadir=/data/mysqldata/3306/data
  $ cp /usr/local/mysql/support-files/my-large.cnf /data/mysqldata/3306/my.cnf
$ /usr/local/mysql/bin/mysqld_safe --defaults-file=/data/mysqldata/3306/my.cnf &

[*]
  这个mysql库是用于保存cacti收集到的数据及其自身配置的,也可以将这部分数据保存在当前已存在的数据库上,那就可以跳过本步了。
1.3 安装关联软件包
  查询关联软件包是否已安装:
  # rpm -q \libxml2 libjpeg-6b freetype zlib libpng fontconfig gd net-snmp
  libxml2-2.7.6-1.el6.x86_64
  libjpeg-6b-46.el6.x86_64
  freetype-2.3.11-5.el6.x86_64
  zlib-1.2.3-25.el6.x86_64
  libpng-1.2.44-1.el6.x86_64
  fontconfig-2.8.0-3.el6.x86_64
  package gd is not installed
net-snmp-5.5-37.el6_2.1.x86_64

[*]
  如果显示not installed,则说明该包未安装。如上所示,这里gb包缺失,对于监控需求的cacti来说gd并非必选组件,它只是用来生成水印,在我们这个环境中实际上是用不到的。不过多数php环境一般都有此需求,就算是为了全面些吧,这里也选择将其补全。
  下载gd源码包:https://bitbucket.org/pierrejoye/gd-libgd
  # wget https://bitbucket.org/pierrejoye/gd-libgd/get/GD_2_0_33.tar.gz
  # tar xvfz GD_2_0_33.tar.gz
  # cd pierrejoye-gd-libgd-5551f61978e3/src/
  # ./configure
  # make
# make install

[*]
  注意net-snmp非常重要,一定要确保其安装可用,可以通过下列命令检查:

[*]  # snmpwalk -v 2c -c public localhost
  正常情况下应返回一系列的系统信息。
1.4 安装PHP
  # wget http://cn.php.net/get/php-5.3.8.tar.gz/from/cn2.php.net/mirror
  # tar xvfz php-5.3.8.tar.gz
  # cd php-5.3.8
  # ./configure \
  --prefix=/usr/local/webserver/php \
  --with-apxs2=/usr/local/webserver/apache2.2.21/bin/apxs \
  --with-mysql=/usr/local/mysql55 \
  --with-freetype-dir \
  --with-gd \
  --with-zlib \
  --with-jpeg-dir \
  --with-png-dir \
  --with-iconv=/usr/local/webserver/libiconv \
  --enable-short-tags \
  --enable-sockets \
  --enable-zend-multibyte \
  --enable-soap \
  --with-openssl \
  --enable-mbstring \
  --enable-static \
  --enable-gd-native-ttf \
  --with-curl \
  --with-iconv \
  --with-xsl \
  --enable-ftp \
  --with-libxml-dir
  # make
  # make install
# cp php.ini-production /usr/local/webserver/php/lib/php.ini

[*]
1.5 安装RRDTool
  # wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.2.14.tar.gz
  # tar xvfz rrdtool-1.4.4.tar.gz
  # ./configure --prefix=/usr/local/rrdtool--disable-python--disable-tcl
  # make
# make install

[*]
1.6 安装Cacti
  # useradd cacti
  # tar xvfz cacti-0.8.7i.tar.gz
  # mv cacti-0.8.7i /data/www/cacti
# chown cacti:cacti /data/www/cacti -R

[*]

页: [1]
查看完整版本: 配置CACTI监控MySQL数据库状态(2)安装cacti相关软件包