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 ...
随机推荐
- 数据库操作语法错误(SQL syntax error)之两步走
今天在做web应用操作数据库时出现了语法错误,提示的是在“xxxxxxx”附近出现了语法错误:CODE:Error: You have an error in your SQL syntax. Che ...
- Vue2之页面 、js 、css分离
在编写vue的时候,页面数据少的时候,可以将所有的js和css都可以直接写在页面上,但是页面数据多,js.css的方法和样式多的时候,都放在一个页面的时候,就显得页面vue十分的臃肿. 所以写项目的时 ...
- idea远程debug:tomcat
在tomcat的bin/startup.sh中添加: 27780debug的端口 declare -x CATALINA_OPTS="-server -Xdebug -Xnoagent -D ...
- ios 利用runtime任性跳转
在开发项目中,会有这样变态的需求: 推送:根据服务端推送过来的数据规则,跳转到对应的控制器 feeds列表:不同类似的cell,可能跳转不同的控制器(嘘!产品经理是这样要求:我也不确定会跳转哪个界面哦 ...
- Centos安装iptables防火墙
一.安装说明: 1.因为centos7.0及以上版本就默认安装了firewall防火墙,但有时候根据项目实际所需,服务器上还是需要安装iptables,以下就是具体的安装步骤: 2.因阿里云在服务器外 ...
- Docker搭建
环境基于CentOS64位,内核最好3.10. 1.下载安装 docker dockersudo yum install docker-io (假如内核版本太低的话,会在下载安装Docker ...
- vmware 虚机NAT模式,局域网可访问
本地VMware虚拟机,网络模式为NAT,现在需要局域网其他电脑通过ssh连接这台VMware虚拟机 宿主机地址:192.168.3.26 VMware虚拟机地址:192.168.239.137 局域 ...
- java面试题(杨晓峰)---第五讲String、StringBuffer、StringBuilder有什么区别?
线程 字符 操作频繁度 1 String (1)String的创建机制 由于String在java世界中使用过于频繁,java为了避免在一个系统中产生大量重复的String对象,引入了字符串常量池,其 ...
- 11g 新特性 Member Kill Escalation 简介
首先我们介绍一下历史.在oracle 9i/10g 中,如果一个数据库实例需要驱逐(evict, alert 文件中会出现ora-29740错误)另一个实例时,需要通过LMON进程在控制文件(以下简称 ...
- js引入的数组 会被页面缓存,如需要被强制性不缓存,请用function return 就ok了
js引入的数组 会被页面缓存,如需要被强制性不缓存,请用function return 就ok了