Cacti安装脚本Server端+客户端
#!/bin/bash
#auto make install LAMP+Cacti
#by authors zhang #RRDtool define path variable
R_FILES=rrdtool-1.4..tar.gz
R_FILES_DIR=rrdtool-1.4.
R_PREFIX=/usr/src/rrdtool-1.4./ #Cacti define path variable
C_FILES=cacti-0.8.8b.tar.gz
C_FILES_DIR=cacti-0.8.8b
C_PREFIX=/usr/src/cacti-0.8.8b/ #httpd define path variable
H_FILES=httpd-2.2..tar.gz
H_FILES_DIR=httpd-2.2.
H_PREFIX=/usr/local/httpd #mysql define path variable
M_FILES=mysql-5.5..tar.gz
M_FILES_DIR=mysql-5.5.
M_PREFIX=/usr/local/mysql/ #php define path variable P_FILES1=libmcrypt-2.5..tar.gz
P_FILES_DIR1=libmcrypt-2.5.
P_PREFIX1=/usr/local/lib/ P_FILES2=mhash-0.9.9.9.tar.gz
P_FILES_DIR2=mhash-0.9.9.9
P_PREFIX2=/usr/local/lib/ P_FILES3=mcrypt-2.6..tar.gz
P_FILES_DIR3=mcrypt-2.6.
P_PREFIX3=/usr/local/lib/ P_FILES4=php-5.3..tar.gz
P_FILES_DIR4=php-5.3.
P_PREFIX4=/usr/local/php if [ -z "$1" ];then
echo -e "\033[36m请选择下面选项:\033[0m"
echo -e "\033[32m1)编译安装Apache服务器\033[1m"
echo "2)编译安装MySQL服务器"
echo "3)编译安装PHP服务器"
echo "4)配置index.php并启动LAMP服务"
echo "5)部署phpMyAdmin系统"
echo "6)安装RRDtool工具"
echo "7)安装Cacti监控服务"
echo "8)配置Cacti客户端"
echo -e "\033[31m使用: { /bin/sh $0 1|2|3|4|help}\033[0m"
exit
fi #auto install Apache
if [ $ -eq ];then
rpm -e httpd --nodeps
tar -zxvf $H_FILES &&cd $H_FILES_DIR ;./configure --prefix=$H_PREFIX --enable-so --enable-rewrite --enable-charset-lite --enable-cgi if [ $? -eq ];then
make &&make install
echo -e "\033[32mThe $H_FILES_DIR Server Install successfully!(Apache服务安装已完成!)\033[0m"
else
echo -e "\033[32mThe $H_FILES_DIR Server Install failed,please check...\033[0m"
exit
fi
fi #auto install Mysql
if [ $ -eq ];then
rpm -e mysql-server mysql --nodeps
tar -zxvf cmake-2.8..tar.gz -C /usr/src/ && cd /usr/src/cmake-2.8./;./configure
if [ $? -eq ];then
gmake &&gmake install
echo -e "\033[32mThe cmake Server Install successfully!(cmake编译安装完成!)\033[0m"
else
echo -e "\033[32mThe cmake Server Install failed,please check...\033[0m"
exit
fi
useradd -M -u -s /sbin/nologin mysql
cd /root
tar -zxvf $M_FILES -C /usr/src/;cd /usr/src/$M_FILES_DIR && cmake -DCMAKE_INSTALL_PREFIX=$M_PREFIX -DSYSCONFDIR=/etc -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all
if [ $? -eq ];then
make &&make install
echo -e "\033[32mThe mysql $M_FILES_DIR Install successfully!(MySQL服务安装已完成!)\033[0m"
else
echo -e "\033[32mThe mysql $M_FILES_DIR Install failed,please check...\033[0m"
exit
fi
chown -R mysql:mysql /usr/local/mysql/
cd /usr/src/$M_FILES_DIR
cp support-files/my-medium.cnf /etc/my.cnf
$M_PREFIX/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/
cd /usr/src/$M_FILES_DIR
ln -s /usr/local/mysql/bin/* /usr/local/bin/
cp support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
chkconfig mysqld on
service mysqld stop
service mysqld start
netstat -anpt | grep 3306
fi #PHP define path variable if [ $1 -eq 3 ];then
tar -zxvf $P_FILES1 -C /usr/src/;cd /usr/src/$P_FILES_DIR1/ && ./configure && make && make install && ln -s /$P_PREFIX1/libmcrypt.* /usr/lib/
cd /root/
tar -zxvf $P_FILES2 -C /usr/src/;cd /usr/src/$P_FILES_DIR2/ && ./configure && make && make install && ln -s /$P_PREFIX2/libmhash* /usr/lib/
cd /root/
tar -zxvf $P_FILES3 -C /usr/src/;cd /usr/src/$P_FILES_DIR3/ && export LD_LIBRARY_PATH=/$P_PREFIX3:$LD_LIBRARY_PATH && ./configure && make && make install
cd /root/
tar -zxvf $P_FILES4 -C /usr/src/;cd /usr/src/$P_FILES_DIR4/ && ./configure --prefix=$P_PREFIX4 --with-mcrypt --with-apxs2=$H_PREFIX/bin/apxs --with-mysql=$M_PREFIX --with-config-file-path=$P_PREFIX4 --enable-mbstring --enable-sockets
if [ $? -eq 0 ];then
make &&make install
echo -e "\033[32mThe $P_FILES_DIR4 Server Install successfully!(PHP安装已完成!)\033[0m"
else
echo -e "\033[32mThe $P_FILES_DIR4 Server Install failed,please check...\033[0m"
exit
fi
fi #配置并启动PHP
if [ $1 -eq 4 ];then
sed -i '/DirectoryIndex/s/index.html/index.php index.html/g' $H_PREFIX/conf/httpd.conf
echo "AddType application/x-httpd-php .php" >>$H_PREFIX/conf/httpd.conf
IP=`ifconfig eth0|grep "Bcast"|awk '{print $2}'|cut -d: -f2`
echo "You can access http://$IP/" cat >$H_PREFIX/htdocs/index.php <<EOF
<?php
phpinfo();
?>
EOF
fi ##PHP MyAdmin define path variable
if [ $1 -eq 5 ];then
tar -zxvf phpMyAdmin-4.2.5-all-languages.tar.gz
mv phpMyAdmin-4.2.5-all-languages/ /usr/local/httpd/htdocs/phpMyAdmin
cd /usr/local/httpd/htdocs/phpMyAdmin
cp config.sample.inc.php config.inc.php
if [ $? -eq 0 ];then
echo -e "\033[32mphpMyAdmin系统安装完成!\033[0m"
else
echo -e "\033[31mphpMyAdmin系统安装失败!\033[0m"
fi fi #RRDtool define path variable
if [ $1 -eq 6 ];then
yum -y install net-snmp net-snmp-utils
yum -y install cairo-devel zlib libxml2 libxml2-devel glib2 glib2-devel libpng libpng-devel freetype freetype-devel libart_lgpl pango pango-devel pear pear-devel perl-CPAN
tar -zxvf $R_FILES -C /usr/src/ && cd $R_PREFIX && ./configure --prefix=$R_PREFIX
if [ $? -eq 0 ];then
make &&make install
echo -e "\033[32mRRDtool工具安装完成!)\033[0m"
else
echo -e "\033[31mRRDtool工具安装失败!\033[0m"
exit
fi
fi #Cacti define path variable
if [ $1 -eq 7 ];then
tar -zxvf $C_FILES -C /usr/src/ && cp -r $C_PREFIX $H_PREFIX/htdocs/cacti
useradd cacti
chown -R cacti:cacti $H_PREFIX/htdocs/cacti/
echo "create database cacti default character set utf8;" | mysql -u root -p123.com
echo "grant all on cacti.* to 'cacti'@'localhost' identified by '123.com';" | mysql -u root -p123.com
mysql -u root -p cacti < $H_PREFIX/htdocs/cacti/cacti.sql
touch $P_PREFIX4/php.ini
sed -i 's/$database_username = "cactiuser";/$database_username = "cacti";/' $H_PREFIX/htdocs/cacti/include/config.php
sed -i 's/$database_password = "cactiuser";/$database_password = "123.com";/' $H_PREFIX/htdocs/cacti/include/config.php
sed -i 's/;date.timezone =/date.timezone =utc/' $P_PREFIX4/php.ini
if [ $? -eq 0 ];then
echo -e "\033[32mCacti部署完毕,数据库连接设置完成\033[0m"
else
echo -e "\033[31mCacti部署失败!\033[0m"
exit
fi
$H_PREFIX/bin/apachectl -t
$H_PREFIX/bin/apachectl restart
fi #Cacti客户端配置 if [ $1 -eq 8 ];then
yum -y install net-snmp lm_sensors
sed -i "s/com2sec notConfigUser default/com2sec notConfigUser 192.168.1.100/" /etc/snmp/snmpd.conf
sed -i 's/exact systemview none none/exact all none none/' /etc/snmp/snmpd.conf
sed -i 's/#view all included .1/view all included .1/' /etc/snmp/snmpd.conf
service snmpd restart
echo -e "\033[32msnmp服务重启完成\033[0m"
netstat -anpt | grep snmpd
fi #########################
###LAMP环境下实现
######访问地址:firefox http://192.168.1.1/cacti & # netstat -tnl
# /usr/local/httpd/bin/apachectl -t
#/usr/local/httpd/bin/apachectl start
#ps -ef | grep http
# echo -e "\033[32m配置完成,打开浏览器测试结果\033[0m" #phpMyAdmin测试:fireorx http://192.168.1.1/phpMyAdmin &
Cacti安装脚本Server端+客户端的更多相关文章
- zabbix server端与agent端源码安装 自定义监控项
ZabbixServer的安装(只有源码装zabbix才能装支持java) 搭建自定义yum仓库并安装支持包 yum -y install createrepo #下载依赖关系命令 createrep ...
- Linux下安装SQL Server 2016(连接篇SQL Server on linux)
连接数据库 (1)设置防火墙 要连接数据库,首先要打开防火墙上1433端口,也就是,增加tcp端口1433到公共区域,并且永久生效. [root@localhost Desktop]# firewal ...
- 手动为 Team Foundation Server 安装 SQL Server
本主题中的步骤适用于安装 SQL Server 2012 企业版,你也可以使用安装标准版的相同步骤. 适用于 SQL 2014 的步骤与以上步骤也非常相似. 我们将在 TFS 所在的同一服务器上安装 ...
- SVN--下载、安装VisualSVN server 服务端和 TortoiseSVN客户端
前言: 在http://www.cnblogs.com/xiaobaihome/archive/2012/03/20/2407610.html的博客中已经很详细地介绍了SVN的服务器--VisualS ...
- 详解zabbix安装部署(Server端篇)
原文:http://blog.chinaunix.net/uid-25266990-id-3380929.html Linux下常用的系统监控软件有Nagios.Cacti.Zabbix.Monit等 ...
- zabbix 3.2.2 server端(源码包)安装部署 (一)【转】
环境准备: 操作系统 CentOS 6.8 2.6.32-642.11.1.el6.x86_64 zabbix server 172.16.10.150 zabbix agent 172.16.10. ...
- 详解zabbix安装部署(Server端篇) (转)
Linux下常用的系统监控软件有Nagios.Cacti.Zabbix.Monit等,这些开源的软件,可以帮助我们更好的管理机器,在第一时间内发现,并警告系统维护人员. 今天开始研究下Zabbix,使 ...
- zabbix 3.2.2 server端(源码包)安装部署 (一)
环境准备: 操作系统 CentOS 6.8 2.6.32-642.11.1.el6.x86_64 zabbix server 172.16.10.150 zabbix agent 172.16.10. ...
- Centos6.5 Zabbix3 server端安装(一)
一.准备阶段: 1.>关闭防火墙 /etc/init.d/iptables stop 2.>关闭selinux vim /etc/selinux/config SELINUX=disabl ...
随机推荐
- [代码修订版] Python 踩坑之旅 [进程篇其四] 踩透 uid euid suid gid egid sgid的坑坑洼洼
目录 1.1 踩坑案例 1.2 填坑解法 1.3 坑位分析 1.4 技术关键字 1.5 坑后思考 下期坑位预告 代码示例支持 平台: Centos 6.3 Python: 2.7.14 代码示例: 公 ...
- Oracle ERP Interface堵住--Request Running too long time,查找Request执行的Sql
Request Running too long time 堵住了INV Manager 导致INV Interface Pending 很多笔资料 Review 发现Request 实际执行SQL ...
- Uncaught Error: Bootstrap's JavaScript requires jQuery
在写bootstarp的时候,一直报 Uncaught Error: Bootstrap's JavaScript requires jQuery 查看了自己引入的文件路径是对的,也可以使用jquer ...
- SQL Server事务的四种隔离级别
在SQL标准中定义了四种隔离级别,每一种级别都规定了一个事务中所做的修改,哪些是在事务内和事务间可见的,哪些是不可见的.较低级别的隔离通常可以执行更高的并发,系统的开销也更低. 1.未提交读(Read ...
- JAVA基础之基本类型包装类、System类、Math类、Arrays类及大数据运算
个人理解: 为了方便运算及调用一些方法,我们需要将基本类型的数值转换为对象:不过转换的时候需要特别注意好它们的类型到底是什么,需要调用方法的类名是哪个!特别注意是Byte常量池的相关问题(==):gc ...
- JavaScript_9_循环
1. JavaScript for/in 语句循环遍历对象的属性: 可以遍历数组,也可以遍历一个对象的所有属性 <body> <p>点击按钮,循环遍历对象“person”的属性 ...
- [转]maven项目部署到tomcat
其实maven项目部署到tomcat的方式很多,我从一开始的打war包到tomcat/webapps目录,到使用tomcat-maven插件,到直接使用servers部署,一路来走过很多弯路. 下面就 ...
- Unity四元素运用之风向标跟随箭头
using System.Collections; using System.Collections.Generic; using UnityEngine; public class WindVane ...
- PHP生成类似类似优酷、腾讯视频等其他视频链的ID
不知道你注意了没有,类似优酷.腾讯视频等其他视频链接似乎类似这样的 http://v.youku.com/v_show/id_XNjA5MjE5OTM2.html 注意id_xxx那段,是不是看不懂了 ...
- mybatis(一):思维导图