免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: king_819
打印 上一主题 下一主题

有奖专家座谈——自动化运维案例分享讨论之一(特邀某大型网游运维总监“king_819”) [复制链接]

论坛徽章:
0
61 [报告]
发表于 2011-11-16 16:13 |只看该作者
回复  kns1024wh


    确实够复杂,百湖有文档之类的吗,分享下
chenyx 发表于 2011-11-16 15:22



    微软的ris 也是一pxe为基础的 linux 和windows的 就是 pxe的基础文件有区别的 而windows 采用ris是 安装方式非ghost方式 而linux采用pxe也是安装方式

论坛徽章:
0
62 [报告]
发表于 2011-11-16 16:16 |只看该作者
从事网游运维的兄弟们应该深有感触,往往在开新服的时候需要大批量的布署新的服务器,Red Hat 最新发布了网络安装服务器套件 Cobbler(补鞋匠)集成了PXE、DHCP、DNS、Kickstart服务管理和yum仓库管理工具,相对之前的 Kickstart 更加快捷、方便的批量布署red hat、centos类系统
1、安装rpmforce源
CentOS 5.5默认的Repository里找不到Cobbler,先安装rpmforce这个Repository
  1. cd /opt
  2. wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm
  3. rpm -ivh rpmforge-release-0.5.2-2.el6.rf.i686.rpm
复制代码
2、安装相关软件
  1. yum -y install cobbler dhcp httpd xinetd tftp-server
复制代码
3、检查cobbler配置
  1. cobbler check
复制代码
根椐提示修改配置文件
/var/lib/cobbler/settings 中的 server 和 next_server 对应的127.0.0.1修改为本服务器的 IP 地址,
manage_dhcp 设为 1,以便管理 DHCP

将 /etc/xinetd.d/tftp 中 disable = no

4、导入精简后的ISO
  1. mkdir -p /mnt/iso
  2. mount -o loop /data/KerryOS-1.0-i386.iso /mnt/iso
  3. cobbler import --mirror=/mnt/iso --name=kerryOS-1.0-i386
复制代码
查看导入结果
  1. cobbler distro list
复制代码
5、修改 DHCP 和 Kickstart 配置模板
#修改DHCP配置模板
  1. vi /etc/dhcpd.conf
  2. vi /etc/cobbler/dhcp.template

  3. ddns-update-style interim;

  4. allow booting;
  5. allow bootp;

  6. ignore client-updates;
  7. set vendorclass = option vendor-class-identifier;

  8. subnet 192.168.9.0 netmask 255.255.255.0 {
  9.      option routers          192.168.9.1;   #路由器地址
  10.      option subnet-mask      255.255.255.0;  #子网掩码选项
  11.      option domain-name-servers  192.168.9.1;  #DNS地址
  12.      range dynamic-bootp     192.168.9.200 192.168.9.254;  #动态IP范围
  13.      filename                "/pxelinux.0";
  14.      default-lease-time      21600;     #缺省租约时间
  15.      max-lease-time          43200;        #最大租约时间
  16.      next-server             192.168.9.230;  #指定引导服务器
  17. }
复制代码
#修改 Kickstart 配置模板
  1. mv /var/www/cobbler/kickstarts/kerryOS-1.0-i386/ks.cfg /var/www/cobbler/kickstarts/kerryOS-1.0-i386/ks.cfg.bak
  2. mv /var/www/cobbler/kickstarts/kerryOS-1.0-xen-i386/ks.cfg /var/www/cobbler/kickstarts/kerryOS-1.0-xen-i386/ks.cfg.bak
  3. vi /etc/cobbler/default.ks
  4. vi /var/www/cobbler/kickstarts/kerryOS-1.0-i386/ks.cfg
  5. vi /var/www/cobbler/kickstarts/kerryOS-1.0-xen-i386/ks.cfg


  6. # Kickstart file automatically generated by anaconda.
  7. #Install OS instead of upgrade
  8. install
  9. #Use text mode install
  10. text
  11. #Use CDROM installation media
  12. cdrom
  13. lang en_US.UTF-8
  14. keyboard us

  15. #Skip the X Configuration
  16. skipx
  17. #Use network installation
  18. url --url=http://192.168.9.230/cobbler/ks_mirror/kerryOS-1.0-i386
  19. #Network information
  20. #network --device eth0 --bootproto static --ip 192.168.9.226 --netmask 255.255.255.0 --gateway 192.168.9.1 --nameserver 192.168.9.1 --noipv6 --onboot=yes --hostname kerry-web-001
  21. network --device eth0 --bootproto dhcp --noipv6 --hostname kerry-web-001
  22. #root -- 1q2w3e
  23. rootpw --iscrypted $1$n07CbCot$GP.VBeICPHj.QkJb5Y2C2.
  24. firewall --disabled
  25. #System authorization information
  26. authconfig --enableshadow --enablemd5
  27. selinux --disabled
  28. timezone --utc Asia/Shanghai
  29. #System bootloader configuration
  30. bootloader --location=mbr
  31. #Clear the Master Boot Record
  32. zerombr yes

  33. # Set the Mouse
  34. mouse generic3ps/2

  35. # The following is the partition information you requested
  36. # Note that any partitions you deleted are not expressed
  37. # here so unless you clear all partitions first, this is
  38. # not guaranteed to work

  39. #Partition clearing information
  40. clearpart --all --initlabel
  41. part /boot --fstype ext3 --size=200 --asprimary
  42. part / --fstype ext3 --size=10000
  43. part swap --size=2048
  44. part /data --fstype ext3 --size=1 --grow

  45. #--- Reboot the host after installation is done
  46. reboot

  47. %packages
  48. %packages
  49. @base
  50. @core
  51. @development-libs
  52. @development-tools
  53. @editors
  54. @text-internet
  55. keyutils
  56. trousers
  57. fipscheck
  58. device-mapper-multipath
  59. imake

  60. %post --nochroot
  61. # Mount CDROM
  62. mkdir -p /mnt/cdrom
  63. mount -r -t iso9660 /tmp/cdrom /mnt/cdrom
  64. cp /mnt/cdrom/ipmod /mnt/sysimage/root/ipmod > /dev/null

  65. umount /mnt/cdrom

  66. %post
  67. #vim syntax on
  68. sed -i "8 s/^/alias vi='vim'/" /root/.bashrc 2>/dev/null
  69. echo 'syntax on' > /root/.vimrc 2>/dev/null

  70. #init_ssh
  71. ssh_cf="/etc/ssh/sshd_config"
  72. sed -i -e '74 s/^/#/' -i -e '76 s/^/#/' $ssh_cf
  73. sed -i "s/#UseDNS yes/UseDNS no/" $ssh_cf

  74. #client
  75. sed -i -e '44 s/^/#/' -i -e '48 s/^/#/' $ssh_cf

  76. # Remove the ISO File translation files
  77. find / -name TRANS.TBL -exec rm {} \; /dev/null 2>/dev/null

  78. # Remove some unneeded services
  79. #--------------------------------------------------------------------------------
  80. cat << EOF
  81. +--------------------------------------------------------------+
  82. | === Welcome to Tunoff services === |
  83. +--------------------------------------------------------------+
  84. EOF
  85. #---------------------------------------------------------------------------------
  86. for i in `ls /etc/rc3.d/S*`
  87. do
  88.         CURSRV=`echo $i|cut -c 15-`
  89. echo $CURSRV
  90. case $CURSRV in
  91.                 crond | irqbalance | microcode_ctl | network | random | sshd | syslog | local )
  92.         echo "Base services, Skip!"
  93.         ;;
  94.         *)
  95.                 echo "change $CURSRV to off"
  96.                 chkconfig --level 235 $CURSRV off
  97.                 service $CURSRV stop
  98.         ;;
  99. esac
  100. done

  101. # file descriptors
  102. ulimit -HSn 65535

  103. echo -ne "
  104. * soft nofile 65536
  105. * hard nofile 65536
  106. " >>/etc/security/limits.conf

  107. #set sysctl
  108. true > /etc/sysctl.conf
  109. cat >> /etc/sysctl.conf << EOF
  110. net.ipv4.ip_forward = 0
  111. net.ipv4.conf.default.rp_filter = 1
  112. net.ipv4.conf.default.accept_source_route = 0
  113. kernel.sysrq = 0
  114. kernel.core_uses_pid = 1
  115. net.ipv4.tcp_syncookies = 1
  116. kernel.msgmnb = 65536
  117. kernel.msgmax = 65536
  118. kernel.shmmax = 68719476736
  119. kernel.shmall = 4294967296
  120. net.ipv4.tcp_max_tw_buckets = 6000
  121. net.ipv4.tcp_sack = 1
  122. net.ipv4.tcp_window_scaling = 1
  123. net.ipv4.tcp_rmem = 4096 87380 4194304
  124. net.ipv4.tcp_wmem = 4096 16384 4194304
  125. net.core.wmem_default = 8388608
  126. net.core.rmem_default = 8388608
  127. net.core.rmem_max = 16777216
  128. net.core.wmem_max = 16777216
  129. net.core.netdev_max_backlog = 262144
  130. net.core.somaxconn = 262144
  131. net.ipv4.tcp_max_orphans = 3276800
  132. net.ipv4.tcp_max_syn_backlog = 262144
  133. net.ipv4.tcp_timestamps = 0
  134. net.ipv4.tcp_synack_retries = 1
  135. net.ipv4.tcp_syn_retries = 1
  136. net.ipv4.tcp_tw_recycle = 1
  137. net.ipv4.tcp_tw_reuse = 1
  138. net.ipv4.tcp_mem = 94500000 915000000 927000000
  139. net.ipv4.tcp_fin_timeout = 1
  140. net.ipv4.tcp_keepalive_time = 1200
  141. net.ipv4.ip_local_port_range = 1024 65535
  142. EOF

  143. /sbin/sysctl -p

  144. #close ctrl+alt+del
  145. sed -i "s/ca::ctrlaltdel:\/sbin\/shutdown -t3 -r now/#ca::ctrlaltdel:\/sbin\/shutdown -t3 -r now/" /etc/inittab

  146. #set purview
  147. chmod 600 /etc/passwd
  148. chmod 600 /etc/shadow
  149. chmod 600 /etc/group
  150. chmod 600 /etc/gshadow
复制代码
6、生成并同步所有配置
  1. cobbler sync
复制代码
7、启动相关的服务
  1. /etc/init.d/httpd start
  2. /etc/init.d/xinetd start
  3. /etc/init.d/dhcpd start
  4. /etc/init.d/cobblerd start
复制代码
  1. chkconfig --level 35 httpd on
  2. chkconfig --level 35 xinetd on
  3. chkconfig --level 35 dhcpd on
  4. chkconfig --level 35 cobblerd on
复制代码
#记得关闭防火墙
  1. /etc/init.d/iptables stop
  2. chkconfig --level 35 iptables off
复制代码
8、相关配置文件及目录
  1. cobbler相关配置文件: /etc/cobbler
  2. cobbler数据存储目录: /var/www/cobbler
  3. dhcp配置文件: /etc/dhcpd.conf
  4. dhcp租期缓存文件: /var/lib/dhcpd/dhcpd.leases
  5. pxe配置文件: /tftpboot/pxelinux.cfg/default
  6. ks模板文件: /var/lib/cobbler/kickstarts_*.ks
复制代码
9、客户端通过PXE安装系统
启动另一台新服务器,通过 PXE 启动进入,提示"boot:"时输入"menu"即可进入蓝色的 Cobbler 安装界面,选择安装项,自动完成系统安装。

10、重装系统
CentOS 5.5默认的Repository里找不到koan,先安装rpmforce这个Repository
  1. cd /opt
  2. wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm
  3. rpm -ivh rpmforge-release-0.5.2-2.el6.rf.i686.rpm
复制代码
#在要重装的机器安装koan
  1. yum -y install koan  
复制代码
#查看cobbler服务器有哪些安装盘
  1. koan --list-profiles --server=192.168.9.230
复制代码
#选择要重装的系统并重启
  1. koan --replace-self --server=192.168.9.230 --profile=kerryOS-1.0-i386
  2. reboot  
复制代码
11、服务控制脚本
  1. vi /etc/init.d/cobbler_all

  2. #!/bin/sh

  3. case $1 in
  4.         start)
  5.                /etc/init.d/httpd start
  6.                /etc/init.d/xinetd start
  7.                /etc/init.d/dhcpd start
  8.                /etc/init.d/cobblerd start
  9.                 ;;
  10.         stop)
  11.                /etc/init.d/httpd stop
  12.                /etc/init.d/xinetd stop
  13.                /etc/init.d/dhcpd stop
  14.                /etc/init.d/cobblerd stop
  15.                 ;;
  16.         status)
  17.                 /etc/init.d/httpd status
  18.                 /etc/init.d/xinetd status
  19.                 /etc/init.d/dhcpd status
  20.                 /etc/init.d/cobblerd status
  21.                 ;;     
  22.          sync)
  23.                 cobbler sync
  24.                 ;;                          
  25.         *)
  26.                 echo "Input error,please in put 'start|stop|status|sync'!";
  27.                 exit 2>&1 >/dev/null &
  28.                 ;;
  29.         esac
复制代码
  1. chmod +x /etc/init.d/cobbler_all
复制代码

论坛徽章:
0
63 [报告]
发表于 2011-11-16 16:19 |只看该作者
关于“搭建linux RIS服务器批量布署windows 2003系统”的文章请见
http://bbs.chinaunix.net/thread-3619039-1-1.html

论坛徽章:
0
64 [报告]
发表于 2011-11-16 16:24 |只看该作者
微软的ris 也是一pxe为基础的 linux 和windows的 就是 pxe的基础文件有区别的 而windows 采用ris ...
kns1024wh 发表于 2011-11-16 16:13


贴一段关于PXE的说明

PXE(preboot execute environment)是由Intel公司开发的最新技术,工作于Client/Server的网络模式,支持工作站通过网络从远端服务器下载映像,并由此支持来自网络的操作系统的启动过程,其启动过程中,终端要求服务器分配IP地址,再用TFTP(trivial file transfer protocol)或MTETP(multicast trivial file transfer protocol)协议下载一个启动软件包到本机内存中并执行,由这个启动软件包完成终端基本软件设置,从而引导预先安装在服务器中的终端操作系统

论坛徽章:
0
65 [报告]
发表于 2011-11-16 16:35 |只看该作者
本帖最后由 kns1024wh 于 2011-11-16 16:37 编辑
贴一段关于PXE的说明

PXE(preboot execute environment)是由Intel公司开发的最新技术,工作于Client/ ...
king_819 发表于 2011-11-16 16:24


转一个老外的文章
  1. RIS for Linux - Boot winpe from the net / Ris Windows Installation

  2. A new pdf guide written from scratch it's available on the main page

  3. This document describes how to setup an opensource (Linux based) alternative to windows ris
  4. You can also use this stuff to install windows from the net

  5. Required software:

  6.     A Linux box - I prefer debian but other distro are also ok
  7.     Python - I'm using version 2.3 but versions >= 2.1 should be ok
  8.     dchp server - Version 3 needed
  9.     atftpd or hpa tftp - a tftp server
  10.     samba - You need version 3, since version 2.x misses some stuff
  11.     PXELinux - Not strictly needed but useful to make a menu, it's a good tool to use most of pxe features.

  12. Required Stuff:

  13.     ris-linux-0.4.tar.gz - All of my stuff
  14.     startrom.n12, SETUPLDR.BIN, BOOTFONT.BIN (optional) and ntdetect.com from windows xp installation directory (you must uncompress _ files)
  15.     [optional] pxelinux 3.07, modified version to avoid vmware pxe bug

  16. ris-linux contains following files:

  17.     binlsrv.py - Binl server for linux, it also works on windows since it's written in python
  18.     decode.py - Decodes Binl packets
  19.     infparser.py - A python script to build drivers database for binlsrv.py, it analyzes the inf directory
  20.     fixloader.py - SETUPLDR.BIN to ntldr converter
  21.     modldr.py - A tool used for client files modifications
  22.     patches/atftpd-filecase.diff - A patch for aftpd to permit case insensitive file lookups
  23.     patches/tftp-hpa-filecase.diff - A patch for hpa-tftp to permit case insensitive file lookups
  24.     fixup-repository.sh - Shell script to fix case of some files needed by the client via tftp
  25.     winnt.sif - A base winnt.sif file to start windows pe from network
  26.     winnt-ris.sif - A base winnt.sif file if you want to install windows from network

  27. TFTP Server

  28. Download atftpd apply the patch, compile and install it, you can configure it using inetd, by adding the following line:

  29. tftp dgram udp wait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd /tftpboot

  30. If you are using hpa tftp server apply the respective patch and recompile it. The author suggested me to run hpa tftp server standalone without using inetd, because inetd support is broken and hpa tftp can directly handle tcpwrappers.

  31. Please note that filecase lookup doesn't work (at least for me) when having links in the path, I suppose this is a security measure, or maybe the linked path should be in the chroot. Anyway this is not related to my lookup patch, if you are using hpa ftpd you should known how it works :)
  32. DHCP: bootp

  33. Assuming the tftpd and dhcp/bootp directory is /tftpboot, we need to have following files:

  34.     pxelinux.0 (part of syslinux/pxelinux)
  35.     pxelinux.cfg/default pxelinux default configuration
  36.     startrom.0 - rename startrom.n12 in startrom.0
  37.     winnt.sif - use the one in my archive
  38.     SETUPLDR.BIN - rename it to ntldr and use fixloader.py ntldr
  39.     ntdetect.com from windows xp installation directory
  40.     BOOTFONT.BIN - OPTIONAL - some versions don't have it (I think it's related to locale fonts)

  41. All files should be in the root of tftpd directory.
  42. Take care of case since files must have exactly the case used in this document
  43. pxelinux.cfg/default is a standard syslinux file you can use this simple one:

  44. TIMEOUT 0
  45. PROMPT 1

  46. label xpe
  47.     kernel startrom.0

  48. DHCP Server configuration

  49. Edit dhcp server configuration, in my distro is /etc/dhcp3/dhcpd.conf
  50. Configure the server this way:

  51. subnet 192.168.129.0 netmask 255.255.255.0
  52. {
  53.   range dynamic-bootp 192.168.129.100 192.168.129.110;
  54.   default-lease-time 600;
  55.   max-lease-time 7200;
  56.   filename "pxelinux.0";
  57.   server-name "attila.of.war";
  58.   next-server attila.of.war;
  59. }

  60. Replace attila.of.war with your dhcp server name, also use startrom.0 instead of pxelinux.0 if you don't want to use pxelinux.
  61. Samba configuration

  62. Make your build without iso and copy the contents of pebldr directory in a suitable place, a good choice is to name the directory ris and rename pebldr folder to winpe.
  63. The directory structure should be ris/winpe/i386..., also you need to put a symbolic link in /tftpboot pointing to winpe directory. If your tftp server doesn't allow symbolic links you should put the directory on the top of your tftp server root.

  64. An example configuration for samba:

  65. [REMINST]
  66.      path = /mnt/disk/ris
  67.      browsable = true
  68.      read only = No
  69.      guest ok = Yes

  70. You must set null passwords = true in smb.conf.

  71. You also need to modify server name and path in SetupSourceDevice option of winnt.sif file.

  72. Edit the path in fixup-repository.sh and launch it to fix case of needed files.
  73. Note: you don't need to fix names if you are using my new atftpd patch.
  74. Binl Server

  75. First you need to build device driver cache using infparser.py, e.g. infparser.py /mnt/disk/ris/winpe/i386/inf, this will create devlist.cache file that must be in same directory of binlsrv.py.
  76. Now you can launch binlsrv.py, it will load the driver cache and will reply to client requests.

  77. ./binlsrv.py
  78. Succesfully loaded 662 devices
  79. Binlserver started...

  80. Then start the client and boot from network, at pxelinux prompt enter xpe, the client will start and if all is ok binlsrv.py should receive a driver request:

  81. Recv NCQ len = 48
  82. NCQ Driver request
  83. [R] Vid: 0x1022
  84. [R] Pid: 0x2000
  85. [R] rev_u1 = 0x2
  86. [R] rev_u2 = 0x0
  87. [R] rev_u3 = 0x0
  88. [R] rev    = 0x10
  89. [R] rev2   = 0x88
  90. [R] subsys = 0x20001022
  91. Checking PCI\VEN_1022&DEV_2000&SUB_20001022
  92. Checking PCI\VEN_1022&DEV_2000
  93. Found PCI\VEN_1022&DEV_2000 in netamd2.inf
  94. [S] Packet len = 0xc4 (196)
  95. [S] Result code: 0x0
  96. [S] type: 0x2
  97. [S] base offset = 0x24 (36)
  98. [S] drv_off = 0x50 (80)
  99. [S] srv_off: 0x6a (106) -> 98 from start
  100. [S] plen: 0x56 (86)
  101. [S] p_off: 0x76 (118) -> 110 from start
  102. [S] hid: PCI\VEN_1022&DEV_2000 - Len 0x15 (21)
  103. [S] drv: pcntpci5.sys - Len 0xc (12)
  104. [S] srv: PCnet - Len 0x5 (5)
  105. [S] Len data now -2 = 0x54 (84)
  106. [S] Description (REG_EXPAND_SZ [2]) = Scheda Ethernet PCI AMD PCNET Family
  107. [S] Characteristics (REG_SZ [1]) = 132
  108. [S] BusType (REG_SZ [1]) = 5
  109. [S] Total Params: 3

  110. Finally if xpe starts but tcpip network will not work, windows shares are ok, any solution?

  111. Windows RIS installation from the net
  112. If you want to use windows remote installation service you should use winnt-ris.sif and rename it to winnt.sif, you can setup both xpe from pxe and windows installation by renaming ntldr and winnt.sif and hex-editing the files, I'll add an howto soon for this. Also make sure you have files in the path specified in winnt.sif.

  113. Note: Right now windows installation from the net works only if bypassing all ris stuff, so you'll not able to use OSChooser.
  114. A detailed description about configuring this can be found here.

  115. Note: if your card doesn't support network boot you can use a floppy image made with Rom-O-Matic, part of Etherboot project. You need at least a version 5.3.8 image to support pxelinux, the etherboot-pci with all drivers doesn't compiles yet, you must wait some time. Select Floppy bootable ROM Image (.zdsk), default options are ok. Write it with RawriteWin from windows or using cat image.zdsk > /dev/fd0 from Linux.
  116. There is also a tool shipped with Windows Server named rbfg.exe that makes similar floppy images but it doesn't support all cards supported by etherboot.

  117. I've made a driver with support for most common nics, compiled drivers: 3c90x 3c595 eepro100 e1000 ns8390 rtl8139 tg3 tulip pcnet32 via-rhine forcedeth sis900 etherboot.zdsk
  118. Glossary

  119. Ris: Remote Installation System

  120. Binl: Boot Information Negotiation Layer

  121. PXE: Pre-Boot Execution Environment

  122. DHCP: Dynamic Host Configuration Protocol

  123. bootp: Bootstrap Protocol

  124. tftp: Trivial File Transfer Protocol
  125. ChangeLog

  126. binlsrv.py:
  127. 0.9 - Modified a bit the engine, now it supports amd64 entries but it can work differently
  128. 0.8 - Server options, more documentation, fixes on RQU packets
  129. 0.7 - Internal (not public)
  130. 0.6 - Added OFF packet
  131. 0.5 - Workaround for broken hosts file

  132. infparser.py:
  133. 0.8 - Display a warning instead of bombing for broken infs
  134. 0.7 - Fixed manifacturer.nt.5.1 problem
  135. 0.6 - Fixed problem with Altima inf
复制代码

论坛徽章:
0
66 [报告]
发表于 2011-11-16 16:41 |只看该作者
转一个老外的文章
kns1024wh 发表于 2011-11-16 16:35



   直接用ris-autoinst,ris-autoinst是一个ris-linux的辅助工具包,执行里面的安装脚本,可以自动安装和配置pxelinux,dhcp,tftpd,samba,ris-linux服务,一步到位,非常方便

论坛徽章:
33
ChinaUnix元老
日期:2015-02-02 08:55:39CU十四周年纪念徽章
日期:2019-08-20 08:30:3720周年集字徽章-周	
日期:2020-10-28 14:13:3020周年集字徽章-20	
日期:2020-10-28 14:04:3019周年集字徽章-CU
日期:2019-09-08 23:26:2519周年集字徽章-19
日期:2019-08-27 13:31:262016科比退役纪念章
日期:2022-04-24 14:33:24
67 [报告]
发表于 2011-11-16 16:52 |只看该作者
如果需要在Windows上面管理Linux,机器不太多的情况下可以考虑SecureCRT,它可以录制宏,也可以自己编写VBS脚本:
  1. #$language = "VBScript"
  2. #$interface = "1.0"

  3. Sub main

  4.     Dim objFSO, objFile, objShell, strPath, strPwd, strPwdRoot
  5.     Set objFSO = CreateObject("Scripting.FileSystemObject")
  6.     Set objFile = objFSO.OpenTextFile("C:\SecureSRT\pwd.txt", 1)
  7.     strPwd = objFile.ReadLine
  8.     strPwdRoot = objFile.ReadLine

  9.     ' turn on synchronous mode so we don't miss any data
  10.     crt.Screen.Synchronous = True

  11.     crt.Screen.WaitForString "#"
  12.     crt.Screen.Send "ssh 192.168.175.5" & VbCr

  13.     crt.Screen.WaitForString "assword:"
  14.     crt.Screen.Send strPwd & VbCr

  15.     crt.Screen.WaitForString "$"
  16.     crt.Screen.Send "su - root" & VbCr

  17.     crt.Screen.WaitForString "assword:"
  18.     crt.Screen.Send strPwdRoot & VbCr

  19.     crt.Screen.WaitForString "#"
  20.     crt.Screen.Send "su - oracle" & VbCr & VbCr

  21.     crt.Screen.WaitForString ":>"
  22.     crt.Screen.Send "sqlplus testdb" & VbCr

  23.     crt.Screen.WaitForString "Enter password:"
  24.     crt.Screen.Send "testpass" & VbCr

  25.     ' turn off synchronous mode to restore normal input processing
  26.     crt.Screen.Synchronous = False

  27. End Sub
复制代码

论坛徽章:
0
68 [报告]
发表于 2011-11-16 17:24 |只看该作者
如果需要在Windows上面管理Linux,机器不太多的情况下可以考虑SecureCRT,它可以录制宏,也可以自己编写VBS ...
Shell_HAT 发表于 2011-11-16 16:52



    用SecureCRT管理linux是很方便了

论坛徽章:
381
CU十二周年纪念徽章
日期:2014-01-04 22:46:58CU大牛徽章
日期:2013-03-13 15:32:35CU大牛徽章
日期:2013-03-13 15:38:15CU大牛徽章
日期:2013-03-13 15:38:52CU大牛徽章
日期:2013-03-14 14:08:55CU大牛徽章
日期:2013-04-17 11:17:19CU大牛徽章
日期:2013-04-17 11:17:32CU大牛徽章
日期:2013-04-17 11:17:37CU大牛徽章
日期:2013-04-17 11:17:42CU大牛徽章
日期:2013-04-17 11:17:47CU大牛徽章
日期:2013-04-17 11:17:52CU大牛徽章
日期:2013-04-17 11:17:56
69 [报告]
发表于 2011-11-16 18:20 |只看该作者
从事网游运维的兄弟们应该深有感触,往往在开新服的时候需要大批量的布署新的服务器,Red Hat 最新发布了网 ...
king_819 发表于 2011-11-16 16:16



    这个不错,收藏之

论坛徽章:
381
CU十二周年纪念徽章
日期:2014-01-04 22:46:58CU大牛徽章
日期:2013-03-13 15:32:35CU大牛徽章
日期:2013-03-13 15:38:15CU大牛徽章
日期:2013-03-13 15:38:52CU大牛徽章
日期:2013-03-14 14:08:55CU大牛徽章
日期:2013-04-17 11:17:19CU大牛徽章
日期:2013-04-17 11:17:32CU大牛徽章
日期:2013-04-17 11:17:37CU大牛徽章
日期:2013-04-17 11:17:42CU大牛徽章
日期:2013-04-17 11:17:47CU大牛徽章
日期:2013-04-17 11:17:52CU大牛徽章
日期:2013-04-17 11:17:56
70 [报告]
发表于 2011-11-16 18:22 |只看该作者
转一个老外的文章
kns1024wh 发表于 2011-11-16 16:35



    这个文章我看过,试验没成功,放弃了.可能是我的windows版本有问题吧
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP