服务器监控--cacti中英文版安装全解

本文涉及的产品
云数据库 RDS MySQL Serverless,0.5-2RCU 50GB
简介:
近段时间一直在整服务器监控方面的东西,以下就是cacti中英文版安装的全过程,各安装包基本都是最新的,基于Centos 5.2平台下安装的!!
 
#!/bin/bash
# BY kerryhu
# QQ:263205768
# MAIL:king_819@163.com
# BLOG:[url]http://kerry.blog.51cto.com[/url]
# Please manual operation yum of before Operation.....
#Centos 5.2
# yum install ntp vim-enhanced gcc gcc-c++ flex bison autoconf \
# automake bzip2-devel ncurses-devel libjpeg-devel libpng-devel \
# libtiff-devel freetype-devel pam-devel kernel netconfig
#########################################
ntpdate time.nist.gov
groupadd mysql         
useradd mysql -d /dev/null -g mysql -s /sbin/nologin
cd /opt
#####################################
#2、安装ncurses-5.6
tar -zxvf  ncurses-5.6.tar.gz
cd ncurses-5.6 
./configure --prefix=/usr --with-shared --without-debug
make
make install 
make install clean
####################################
#3、安装mysql-5.0.51a
cd /opt
tar -zxvf mysql-5.0.51a.tar.gz
cd mysql-5.0.51a 
./configure --with-mysqld-user=mysql --prefix=/usr/local/mysql5 --with-charset=gbk --with-extra-charset=all --without-isam --exec-prefix=/usr/local/mysql5
make 
make install
/usr/local/mysql5/bin/mysql_install_db        
chown -R mysql.mysql /usr/local/mysql5/
cp /usr/local/mysql5/share/mysql/my-medium.cnf /etc/my.cnf  
cp support-files/mysql.server /etc/rc.d/init.d/mysqld      
chmod 700 /etc/rc.d/init.d/mysqld                         
/usr/local/mysql5/bin/mysqld_safe --user=mysql &          
/etc/rc.d/init.d/mysqld start
chkconfig --add mysqld 
chkconfig --level 2345 mysqld on
ln -s /usr/local/mysql5/bin/mysql /sbin/mysql 
ln -s /usr/local/mysql5/bin/mysqladmin /sbin/mysqladmin
#配置库文件搜索路径
echo "/usr/local/mysql5/lib/mysql" >> /etc/ld.so.conf
#添加/usr/local/mysql5/bin到环境变量PATH中
export PATH=$PATH:/usr/local/mysql5/bin
########################################################
#4、安装ZLIB2
#  如果不安装,等下编译安装openssl 就会报错,所以提前编译安装
cd /opt
tar zxvf zlib-1.2.3.tar.gz 
cd zlib-1.2.3 
./configure
make 
make install
######################################################
#5、安装openssl-0.9.8g 
cd /opt
tar zxvf openssl-0.9.8g.tar.tar 
cd openssl-0.9.8g 
./config shared zlib
make 
make test 
make install
mv /usr/bin/openssl /usr/bin/openssl.OFF
mv /usr/include/openssl /usr/include/openssl.OFF
rm /usr/lib/libssl.so
ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl
ln -s /usr/local/ssl/include/openssl /usr/include/openssl
ln -sv /usr/local/ssl/lib/libssl.so.0.9.8 /usr/lib/libssl.so
#配置库文件搜索路径
echo "/usr/local/ssl/lib" >> /etc/ld.so.conf
#################################################
#6、安装BerkeleyDB
cd /opt
tar zxvf db-4.5.20.tar.gz
cd db-4.5.20/build_unix
../dist/configure --prefix=/usr/local/BerkeleyDB
make;make install
ln -sv /usr/local/BerkeleyDB/include /usr/include/db4
ln -sv /usr/local/BerkeleyDB/include/db.h /usr/include/db.h
ln -sv /usr/local/BerkeleyDB/include/db_cxx.h /usr/include/db_cxx.h
echo "/usr/local/BerkeleyDB/lib" >> /etc/ld.so.conf
ldconfig
####################################################
#7、安装httpd-2.2.8
cd /opt
tar jxvf httpd-2.2.8.tar.bz2
cd httpd-2.2.8
./configure --prefix=/usr/local/apache2 --enable-so --enable-ssl --with-ssl=/usr/local/ssl --enable-track-vars --enable-rewrite --with-zlib --enable-mods-shared=most --enable-suexec --with-suexec-caller=daemon
make;make install
 
echo "/usr/local/apache/bin/apachectl start" >> /etc/rc.d/rc.local
/usr/local/apache/bin/apachectl start
#################(8)安装libPNG######################################
cd /opt
tar zxvf  libpng-1.2.26.tar.gz
cd libpng-1.2.26
cp scripts/makefile.linux ./makefile
./configure --prefix=/usr/local/libpng
make;make install
##################(9)安装freetype##################################
cd /opt
tar zxvf freetype-2.3.5.tar.gz
cd freetype-2.3.5
./configure
 make;make install
##################(10)安装JPEG6##################################
cd /opt
tar zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b
mkdir -pv /usr/local/jpeg/{,bin,lib,include,man/man1,man1} 
./configure --prefix=/usr/local/jpeg --enable-shared --enable- static
make;make install
##################(11)安装GD####################################
cd /opt
tar zxvf gd-2.0.35.tar.gz
cd gd-2.0.35
./configure --with-png --with-freetype --with-jpeg=/usr/local/jpeg/ 
make;make install
##################(12)安装LIBXML2################################
cd /opt
tar zxvf libxml2-2.6.31.tar.gz
cd libxml2-2.6.31
./configure --prefix=/usr/local/libxml2
make;make install
cp xml2-config /usr/bin
##################(13)安装libmcrypt###############################
cd /opt
tar zxvf libmcrypt-2.5.7.tar.gz
cd libmcrypt-2.5.7
./configure
 make;make install
##################(14)安装PHP5.2.5###################################
cd /opt
tar zxvf php-5.2.5.tar.gz
cd php-5.2.5
./configure --prefix=/usr/local/php5 --with-mysql=/usr/local/mysql5 --with-apxs2=/usr/local/apache2/bin/apxs --with-jpeg-dir=/usr/local/jpeg --with-freetype-dir=/usr/local/include/freetype2 --with-zlib --with-png-dir=usr/local/libpng12 --with-libxml-dir=/usr/local/libxml2 --with-gd --enable-ftp --enable-sockets -enable-mbstring=all- --with-mcrypt --with-mysqli=/usr/local/mysql5/bin/mysql_config
make;make install
cp php.ini-dist /usr/local/php5/lib/php.ini
mv /usr/local/apache/conf/http.conf /usr/local/apache/conf/http.conf.bak
cp /opt/httpd.conf /usr/local/apache2/conf/httpd.conf
cp /opt/index.php /usr/local/apache2/htdocs/
##############################################
# INSTALL ZendOptimizer
cd /opt
tar -zxvf ZendOptimizer-3.3.3-linux-glibc23-i386.tar.gz
cd ZendOptimizer-3.3.3-linux-glibc23-i386
./install
echo "LINUX+MYSQL+APACHE2+PHP5+ZEND INSTALL OK"
#安装Time::HiRes
cd /opt
tar zxvf Time-HiRes-1.9715.tar.gz 
cd Time-HiRes-1.9715
perl Makefile.PL 
make
make test
make install
#安装File::Tail
cd /opt
tar zxvf File-Tail-0.99.3.tar.gz 
cd File-Tail-0.99.3
perl Makefile
make
make test
make install
cd /opt
rpm -ivh libart_lgpl-devel-2.3.17-4.i386.rpm
tar zxvf cgilib-0.5.tar.gz
cd cgilib-0.5
make
cp libcgi.a /usr/local/lib
cp cgi.h /usr/include
ln -s /usr/local/include/freetype2/ /usr/include/freetype2
#安装rrdtool-1.2.23
cd /opt
tar zxvf rrdtool-1.2.23.tar.gz 
cd rrdtool-1.2.23
./configure --prefix=/usr/local/rrdtool
make
make install
#========================安装net-snmp========================
cd /opt
tar -zxvf net-snmp-5.3.2.tar.gz
cd net-snmp-5.3.2
./configure –prefix=/usr/snmp –enable-mfd-rewrites --enable-developer
make;make install
cp EXAMPLE.conf /usr/local/net-snmp/share/snmp/snmpd.conf
#vi /usr/local/net-snmp/share/snmp/snmpd.conf
#com2sec local localhost public
#com2sec mynetwork 192.168.8.0/24 public

/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
PATH=/usr/local/net-snmp/bin/:/usr/local/net-snmp/sbin/:$PATH
cd ../
#=======================安装 英文版cacti============================
#下载 [url]http://www.cacti.net[/url]
cd /opt
useradd cactiuser -g users
passwd cactiuser (pwd:cactipw)
tar -zxvf cacti-0.8.7b.tar.gz
mkdir -p /var/www/
mv cacti-0.8.7b /var/www/cacti
#创建cactidb数据库
/usr/local/mysql5/bin/mysqladmin -u root password nginx
/usr/local/mysql5/bin/mysql -u root -pnginx
create database cactidb;
grant all on cactidb.* to  'cactiuser'@'localhost' identified by 'cactipw';
exit;
cd /var/www/cacti
/usr/local/mysql5/bin/mysql -u root -pnginx cactidb <cacti.sql
chown -R cactiuser rra/ log/
cd scripts
chown cactiuser:users *
#vi /var/htdoc/cacti/include
#$database_type = “mysql”; 
#$database_default = “cactidb”; 
#$database_hostname = “localhost”; 
#$database_username = “cactiuser”; 
#$database_password = “cactipw”;
crontab -u cactiuser -e 
加入
*/5 * * * * /usr/local/php5/bin/php /var/www/cacti/poller.php > /dev/null 2>&1
 #[url]http://192.168.8.152   [/url] admin   admin     cactipw
su cactiuser
/usr/local/php5/bin/php /var/www/cacti/poller.php
# 把cacti目录里的cmd.php和poller.php文件加下运行的权限
#测试SNMP是不是工作正常 snmpwalk -c community -v 2c hostIP if正常的话会出现一些数据。不正常会出现一些错误,也会有对应的错误提示。
#7、我原来使用的是rrdtool-1.0.x 升级到 1.2.x 后部分图像无法显示(Zoom)
#修改Configuration -> Settings -> RRDTool Utility Version -> 1.2.x

#==========================安装  中文版cacti===================================
cd /opt
tar -zxvf cacti-0.8.7b-cn-utf8.tar.gz
useradd cactiuser -g users
passwd cactiuser (pwd:cactipw)
mkdir -p /var/www/
mv cacti-0.8.7b /var/www/cacti
#创建cactidb数据库
/usr/local/mysql5/bin/mysqladmin -u root password nginx
/usr/local/mysql5/bin/mysql -u root -pnginx
create database cactidb;
grant all on cactidb.* to  'cactiuser'@'localhost' identified by 'cactipw';
exit;
cd /var/www/cacti
/usr/local/mysql5/bin/mysql -u root -pnginx cactidb <cacti.sql
chown -R cactiuser rra/ log/
cd scripts
chown cactiuser:users *
#vi /var/htdoc/cacti/include/config.php    global.php
#$database_type = “mysql”; 
#$database_default = “cactidb”; 
#$database_hostname = “localhost”; 
#$database_username = “cactiuser”; 
#$database_password = “cactipw”;
crontab -u cactiuser -e 
加入
*/5 * * * * /usr/local/php5/bin/php /var/www/cacti/poller.php > /dev/null 2>&1
 #[url]http://192.168.8.152   [/url] admin   admin     cactipw
su cactiuser
/usr/local/php5/bin/php /var/www/cacti/poller.php
#字体在图形中显示不正常的解决方法,下载并安装cjkuni-fonts中文字体,字体名ukai.ttf
cd /opt
wget  [url]http://ftp.tw.debian.org/debian/pool/main/t/ttf-arphic-ukai/ttf-arphic-ukai_0.1.20060928.orig.tar.gz[/url]
tar zxvf ttf-arphic-ukai_0.1.20060928.orig.tar.gz
cd ttf-arphic-ukai-0.1.20060928/
cp ukai.ttf /usr/share/fonts/ukai.ttf
#安装完成后注意在"设置"中更改下面两个必改项.
#常规->RRDTool应用程序版本 改为1.2.x,默认为1.0.x.不改可能图像不能正常显示出来.
#路径->RRDTool默认字体路径 改为上面安装的ukai.ttf的文件路径,如/usr/share/fonts/ukai.ttf

 
本文转自king_819 51CTO博客,原文链接:http://blog.51cto.com/kerry/106340,如需转载请自行联系原作者
相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助 &nbsp; &nbsp; 相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
17天前
|
网络安全 Apache
Apache服务器安装SSL证书
Apache服务器安装SSL证书
19 0
|
2月前
|
存储 Ubuntu 网络协议
|
2月前
|
监控 关系型数据库 Linux
|
2月前
|
缓存 关系型数据库 MySQL
百度搜索:蓝易云【CentOS8服务器安装MySQL报错:no match mysql-community-server】
现在,你已经成功安装了MySQL服务器并解决了"no match mysql-community-server"的报错问题。祝你使用愉快!
43 1
|
1月前
|
缓存 网络协议 数据可视化
WinSCP下载安装并实现远程SSH本地服务器上传文件
WinSCP下载安装并实现远程SSH本地服务器上传文件
|
2月前
|
NoSQL Redis Docker
在docker中安装redis,并且阿里云服务器配置
在docker中安装redis,并且阿里云服务器配置
187 1
|
3天前
|
监控 安全 Linux
Linux系统之安装ServerBee服务器监控工具
【4月更文挑战第22天】Linux系统之安装ServerBee服务器监控工具
41 2
|
3天前
|
存储 分布式计算 NoSQL
MongoDB的简介和安装(在服务器上)
MongoDB的简介和安装(在服务器上)
19 0
|
25天前
|
Ubuntu Linux 虚拟化
【Linux】ubuntu安装samba服务器
【Linux】ubuntu安装samba服务器
|
25天前
|
Linux
Linux安装bind9搭建自己的域名服务器
Linux安装bind9搭建自己的域名服务器
13 0