#!/bin/bash
#修改网卡使用静态IP地址·
perl -p -i -e "s/dhcp/static/g" /etc/sysconfig/network-scripts/ifcfg-eth* #修改网卡开机启动
perl -p -i -e "s/ONBOOT=no/ONBOOT=yes/g" /etc/sysconfig/network-scripts/ifcfg-eth*
#修改主机名 perl -p -i -e "s/HOSTNAME=localhost.localdomain/HOSTNAME=AR/g" /etc/sysconfig/network hostname AR
#添加网卡IP地址 echo "IPADDR=192.168.101.1" >> /etc/sysconfig/network-scripts/ifcfg-eth1 echo "NETMASK=255.255.255.0" >> /etc/sysconfig/network-scripts/ifcfg-eth1 echo "IPADDR=192.168.102.1" >> /etc/sysconfig/network-scripts/ifcfg-eth2 echo "NETMASK=255.255.255.0" >> /etc/sysconfig/network-scripts/ifcfg-eth2 echo "IPADDR=192.168.103.1" >> /etc/sysconfig/network-scripts/ifcfg-eth3 echo "NETMASK=255.255.255.0" >> /etc/sysconfig/network-scripts/ifcfg-eth3 echo "IPADDR=192.168.104.1" >> /etc/sysconfig/network-scripts/ifcfg-eth4 echo "NETMASK=255.255.255.0" >> /etc/sysconfig/network-scripts/ifcfg-eth4 echo "IPADDR=192.168.105.1" >> /etc/sysconfig/network-scripts/ifcfg-eth5 echo "NETMASK=255.255.255.0" >> /etc/sysconfig/network-scripts/ifcfg-eth5 echo "IPADDR=192.168.106.1" >> /etc/sysconfig/network-scripts/ifcfg-eth6 echo "NETMASK=255.255.255.0" >> /etc/sysconfig/network-scripts/ifcfg-eth6 #重启网络
#service network restart
#让mysql开机启动
chkconfig --level 35 mysqld on chkconfig --level 35 sendmail off chkconfig --level 35 cups off chkconfig --level 35 portmap off chkconfig --level 35 iptables off
#修改mysql配置文件 cp /etc/my.cnf /etc/my.cnf.bak echo "[mysqld] " > /etc/my.cnf echo "datadir=/var/lib/mysql " >> /etc/my.cnf echo "default-character-set=utf8" >> /etc/my.cnf echo "lower_case_table_names=1" >> /etc/my.cnf echo "socket=/var/lib/mysql/mysql.sock " >> /etc/my.cnf echo "user=mysql" >> /etc/my.cnf echo "old_passwords=1" >> /etc/my.cnf echo "[mysqld_safe]" >> /etc/my.cnf echo "log-error=/var/log/mysqld.log" >> /etc/my.cnf echo "pid-file=/var/run/mysqld/mysqld.pid" >> /etc/my.cnf echo "default-character-set=utf8" >> /etc/my.cnf
#启动mysql service mysqld start >arinstall.log
#设置mysql密码 mysqladmin -u root password 132456 >>arinstall.log
#创建ar数据库,导入表 mysqladmin -u root -p123456 create AR ; mysql -u root -p123456 AR < ar.sql >>arinstall.log mysqladmin create AR ; mysql AR < ar.sql 2&1 >>arinstall.log
#开机启动项 echo "touch /var/lock/subsys/local" > /etc/rc.d/rc.local echo "/ar/bin/replay -L 10 & " >> /etc/rc.d/rc.local echo "/ar/bin/remapd -L 10 & " >> /etc/rc.d/rc.local echo "/ar/bin/audit_server -L 10 & " >> /etc/rc.d/rc.local echo "export JAVA_HOME=/usr/local/java" >> /etc/rc.d/rc.local echo "export PATH=$JAVA_HOME/bin:$PATH" >> /etc/rc.d/rc.local echo "/usr/local/tomcat/bin/startup.sh" >> /etc/rc.d/rc.local
#设置环境变量
echo "export JAVA_HOME=/usr/local/java" >> /etc/profile echo "export PATH=$JAVA_HOME/bin:$PATH " >> /etc/profile source /etc/profile
#安装JDK tar zxvf jdk1.6.0_20.tar.gz >>arinstall.log mv jdk1.6.0_20 /usr/local/java >>arinstall.log #安装tomcat unzip apache-tomcat-6.0.18.zip >>arinstall.log mv apache-tomcat-6.0.18/ /usr/local/tomcat >>arinstall.log
#将ROOT.tar.gz移动到相应目录 mv ROOT.tar.gz /usr/local/tomcat/webapps/ >>arinstall.log cd /usr/local/tomcat/webapps/ >>arinstall.log tar xzf ROOT.tar.gz >>arinstall.log rm -rf ROOT.tar.gz >>arinstall.log
#修改tomcat配置文件 cd /usr/local/tomcat/webapps/ROOT/WEB-INF/classes/ >>arinstall.log cp dbconfig.properties dbconfig.properties.bak >>arinstall.log echo "root_code=210000000000" > dbconfig.properties echo "port=9000" >> dbconfig.properties echo "jdbc.db_password=123456" >> dbconfig.properties echo "jdbc.db_url=jdbc\:mysql\://127.0.0.1\:3306/AR?useUnicode\=true&characterEncoding\=UTF-8" >> dbconfig.properties echo "jdbc.maximum-active-time=120000" >> dbconfig.properties echo "ip=127.0.0.1" >> dbconfig.properties echo "show_sql=true" >> dbconfig.properties echo "jdbc.maximum-connection-count=100" >> dbconfig.properties echo "jdbc.minimum-connection-count=2" >> dbconfig.properties echo "jdbc.driver=com.mysql.jdbc.Driver" >> dbconfig.properties echo "jdbc.db_user=root" >> dbconfig.properties
perl -p -i -e "s/8081/80/g" /usr/local/tomcat/conf/server.xml >>arinstall.log
#启动tomcat chmod a+x /usr/local/tomcat/bin/*.sh >>arinstall.log
#安装ar的rpm包 cd rpm -ivh ar-1.0-10.i386.rpm >>arinstall.log
#启动ar的命令 cd /ar/bin chmod a+x *
./serial_util -i 7106cf96ca05-e153c3ed2876-8fc0bb46cd21-0690e2dae80a-20111212 >>arinstall.log ./remapd -L 10 & ./audit_server -L 10 & ./replay -L 10 &
#启动tomcat /usr/local/tomcat/bin/startup.sh >>arinstall.log
clear echo \ ; echo \ ; echo \ ; echo \ ; echo \ ; echo \ ; echo \ ; echo \ ; echo \ ; echo \ ; echo \ ; echo \ ; echo \ ; echo \ ; echo \ ; echo \ ; echo \ ; echo \ ; echo \ ;
echo "####################################################" echo "####################################################" echo "####################################################" echo "### ###" echo "### ###" echo "### ###" echo "### ###" echo "### ###" echo "### ###" echo "### ###" echo "### ###" echo "### ###" echo "### Installation is complete... OK ! ###" echo "### ###" echo "### ###" echo "### ###" echo "### ###" echo "### ###" echo "### ###" echo "### ###" echo "### ###" echo "### ###" echo "####################################################" echo "####################################################" echo "####################################################"