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 ...
随机推荐
- vue之store中属性更新用法
//1.首先定义store对象下的属性 state: { data:'测试数据' } // 2.定义更改data数据的方法 mutations: { updatedata(state, p) { st ...
- E. Karen and Supermarket
E. Karen and Supermarket time limit per test 2 seconds memory limit per test 512 megabytes input sta ...
- SyntaxError: Use of const in strict mode.
具体报错console c:\Users\Administrator\WebstormProjects\blogtest\node_modules\connect-mongo\src\index.js ...
- winform代码生成器(三)
代码下载 地址 http://pan.baidu.com/s/1nuZjyat 接上面的两篇. 用户有时对 从表的 排版不喜欢,可以因某些字太长,需要拉长一些,有些则需要隐藏. 有什么办法呢? 我的思 ...
- 一般处理程序aspx
public bool IsReusable { get { return false; } }属性,将该属性的值改为true,为什么不起作用?按照MSDN的解释,该属性的意思是: “获取一个值,该值 ...
- java学习笔记(2)——数组
1.创建数组: int[] a = new int[n];//数组长度n不要求为常数,一旦创建了数组,其大小不可改变 int[] a = {0,1,2,3};//也可这样定义 获得数组元素的个数:ar ...
- Java学习知识体系大纲梳理
感悟 很奇怪,我怎么会想着写这么一篇博客——Java语言的学习体系,这不是大学就已经学过的课程嘛.博主系计算机科班毕业,大学的时候没少捧着Java教程来学习,不管是为了学习编程还是为了期末考个高分,都 ...
- 【迷你微信】基于MINA、Hibernate、Spring、Protobuf的即时聊天系统:2.技术简介之MinaFilter(1)
欢迎阅读我的开源项目<迷你微信>服务器与<迷你微信>客户端 Filter filter:过滤器?(不知道是不是这么翻译,算了知道意思就好了╮(╯▽╰)╭),这种东西在很多语言中 ...
- FZU 2204 7
题意: n个有标号的球围成一个圈.每个球有两种颜色可以选择黑或白染色.问有多少种方案使得没有出现连续白球7个或连续黑球7个? 思路: 如果出现连续的8,9...个球同色,那么也必定含有7个同色.需要统 ...
- LibreOJ #515. 「LibreOJ β Round #2」贪心只能过样例
题目描述 一共有 nnn个数,第 iii 个数 xix_ixi 可以取 [ai,bi][a_i , b_i][ai,bi] 中任意值.设 S=∑xi2S = \sum{{x_i}^2 ...