Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1423396
  • 博文数量: 264
  • 博客积分: 5810
  • 博客等级: 大校
  • 技术积分: 3528
  • 用 户 组: 普通用户
  • 注册时间: 2011-03-13 17:15
文章分类

全部博文(264)

文章存档

2011年(264)

分类: 系统运维

2011-04-06 22:58:21

安装install.sh脚本:
  1. #!/bin/sh
  2. # 2011/02/14

  3. rm -f $0

  4. #修改主机名
  5. AAA=`date '+%y%m%d%H%M%S'`
  6. BBB=`awk 'BEGIN{srand();fr=int(10000*rand());print fr;}'`
  7. CCC="abc.com"
  8. DDD=${AAA}${BBB}."$CCC"
  9. if [ $(egrep -c '^HOSTNAME=[0-9]+\.abc\.com$' /etc/sysconfig/network) = 0 ]; then
  10.     sed -i "/^HOSTNAME/s/.*/HOSTNAME=${DDD}/" /etc/sysconfig/network
  11.     hostname ${DDD}
  12. else
  13.     echo
  14.     #exit
  15. fi

  16. RELEASE=$(egrep release /etc/issue | sed '/release/s/.*release \([0-9]\).*/\1/')

  17. sed -i '/initdefault/s/5/3/g' /etc/inittab
  18. cd puppet_func-5.x_x86_64
  19. rpm -Uivh libselinux-*.rpm
  20. rpm -Uivh libselinux-ruby-*.rpm
  21. rpm -Uivh augeas-libs-*.rpm

  22. rpm -Uivh ruby-libs-*.rpm
  23. rpm -Uivh ruby-1.8.*.rpm
  24. rpm -Uivh ruby-augeas-*.rpm
  25. rpm -Uivh ruby-shadow-*.rpm
  26. rpm -Uivh facter-*.rpm
  27. rpm -Uivh puppet-*.rpm

  28. rpm -Uivh pyOpenSSL-*.rpm
  29. rpm -Uivh python-simplejson-*.rpm
  30. rpm -Uivh certmaster-*.rpm
  31. rpm -Uivh func-*.rpm
  32. cd ..


  33. echo '[main]
  34.     logdir = /var/log/puppet
  35.     rundir = /var/run/puppet
  36.     ssldir = $vardir/ssl

  37. [puppetd]
  38.     classfile = $vardir/classes.txt
  39.     localconfig = $vardir/localconfig
  40.     server = pu.abc.com
  41.     authconfig = /etc/puppet/namespaceauth.conf
  42.     puppetdlog = /var/log/puppet/puppetd.log
  43.     runinterval = 180
  44.     report = true
  45.     reportserver = pu.abc.com' > /etc/puppet/puppet.conf

  46. sed -i 's#^certmaster = certmaster#certmaster = pu.abc.com#g' /etc/certmaster/minion.conf


  47. chkconfig --level 345 certmaster on
  48. chkconfig --level 345 puppet on
  49. chkconfig --level 345 funcd on

  50. /etc/init.d/certmaster stop
  51. /etc/init.d/puppet stop
  52. /etc/init.d/funcd stop
  53. /etc/init.d/certmaster start
  54. /etc/init.d/puppet start
  55. /etc/init.d/funcd start

  56. rm -rf puppet_func-5.x_x86_64*
  57. rm -f $0
  58. netstat -ntpl | egrep '5123[45]' || echo Failed install

  59. # EOF

阅读(1896) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~