Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1127545
  • 博文数量: 153
  • 博客积分: 10576
  • 博客等级: 上将
  • 技术积分: 2137
  • 用 户 组: 普通用户
  • 注册时间: 2007-12-02 21:01
文章分类

全部博文(153)

文章存档

2009年(43)

2008年(110)

分类: LINUX

2009-05-06 18:15:13

HOWTO Implement a simple BitTorrent and USB stick imaging scheme

From SystemImager

Jump to: navigation, search

Summary
We describe the process of using SystemImager 3.7.6 to image 20 identical machines to be used as data depots. Our setup uses a USB stick as autoinstall media and the BitTorrent transport for image deployment. We assume basic knowledge of the workings of SystemImager, and place emphasis on the generation autoinstall media. See the wiki page on BitTorrent for a more detailed explanation of the use of that transport.

Contents

[]


    Setting Up the Image Server (IS) and Golden Client (GC)

    In this particular example, we use machines made by supermicro which have Intel Xeon processors, 2GB RAM, and four 250GB SCSI hard drives. The hardware is only relevant in that it is fully supported by the standard SystemImager kernel. For hardware that is not supported, one solution is the UYOK functionality, which is discussed in this document.

    Our server hardware happens to be the same as the clients, but this need not be the case. We began by performing a base install of CentOS 4.4 on both the IS and the GC. Once dependences were resolved by installing packages perl-AppConfig perl-XML-Simple perl-XML-Parse perl-XML-Parser (and bittorrent on the IS), we installed System Configurator and SystemImager rpms:

    $ rpm -Uvh systemconfigurator-2.2.2-1.noarch.rpm \
                   systemimager-common-3.7.6-1.noarch.rpm \
                   systemimager-server-3.7.6-1.noarch.rpm \
                   systemimager-i386boot-standard-3.7.6-1.noarch.rpm \
                   systemimager-bittorrent-3.7.6-1.noarch.rpm
    
    $ rpm -Uvh systemconfigurator-2.2.2-1.noarch.rpm \
                   systemimager-common-3.7.6-1.noarch.rpm \
                   systemimager-client-3.7.6-1.noarch.rpm \
                   systemimager-i386initrd_template-3.7.6-1.noarch.rpm
    

    Taking the Image

    $ si_prepareclient --server  --my-modules --yes
    

    This will start the rsync daemon on the golden client and generate a kernel and initrd.img using the UYOK mechanism, where only the currently loaded modules are included.

    $ si_getimage --golden-client  \
                      --image  \
                      --ip-assignment DHCP \
                      --post-install reboot
    

    Because we will be booting from USB stick rather than over the network, we will not need to configure the IS as a boot server. Thus, we may decline the offer to run the si_addclients tool.

    Configuring Image Deployment via BitTorrent

    For our simple deployment, we only needed to edit a single line in /etc/systemimager/bittorrent.conf. We added the name of the image to the list of images distributed via BitTorrent:

    BT_IMAGES=
    

    We then started the systemimager-server-bittorrent daemon:

    $ /etc/init.d/systemimager-server-bittorrent start
    

    By default, BitTorrent images are compressed for transport (this is determined by the option BT_COMPRESS=y). Thus the image will be compressed before the daemon is started.

    Creating the Autoinstall USB Stick

    Selecting a kernel and initrd.img

    In our particular case, we first tried the kernel and initrd.img generated using UYOK, which can be found in :/etc/systemimager/boot/ or :/var/lib/systemimager/images//etc/systemimager/boot/. These worked well, but we found that the standard SystemImager kernel and initrd.img (located in :/usr/share/systemimager/boot/i386/standard/) worked just as well, and were much faster.

    Configuring Installation Parameters

    The clients must know the address of the IS and which autoinstall script to use (and thus which image to install). They must also be told to use the BitTorrent transport. Since all of our clients will be using the same image and will be configured to receive ip addresses and hostnames via DHCP, we will be able to use the same installation parameters for all of them.

    The mapping between clients and images can be defined on the IS, which can be accomplished in an automated fashion by using the si_addclients tool. In our case, we will be configuring the clients to request a particular image by using the IMAGE_NAME installation parameter, so that our setup can be configured to work in any DHCP environment so long as the IMAGESERVER installation parameter is properly set.

    Using local.cfg

    The local.cfg file maybe used for local configuration of installation parameters. It can be supplied to a client either on a floppy disk or on the USB stick itself. In our case, it might contain the following:

    IMAGESERVER=
    IMAGENAME=
    BITTORRENT=y
    

    In order to have it written to the USB stick, we would use the --config option with si_mkautoinstalldisk (see below).

    Using Kernel Boot Parameters in syslinux.cfg

    Because all of our clients will receive the same configuration, we may skip the use of local.cfg all together, and use kernel boot parameters exclusively An example usage of the --append option is as follows.

    --append "IMAGESERVER= IMAGENAME= BITTORRENT=y SKIP_LOCAL_CFG=y"
    

    These options will be written By skipping the local configuration, we save the time required to search for local.cfg in the clients' floppy drive.

    Running si_mkautoinstalldisk

    A USB stick is plugged into the image server and recognized as /dev/sde (by issuing dmesg). The following command formats the USB stick to act as the autoinstall media for our clients.

    $ si_mkautoinstalldisk --device /dev/sde \
                               --kernel  \
                               --initrd  \
                               --append "" \
                               --config 
    

    Installing the Image

    1. Plug the USB stick into the client
    2. Configure the client to boot from the USB stick
    3. Boot the client; the kernel and initrd.img should load into memory
    4. Remove the USB stick from the client (we don't want to boot to it again)
    5. The image should install; the autoinstallation script to be used is determined by the image name
    阅读(1800) | 评论(1) | 转发(0) |
    给主人留下些什么吧!~~

    meacheal2009-06-04 14:24:22

    好好干