3. Creating a prototype system image

  1. Create an LVM logical volume on the server to store the protosystem:

    
    lvcreate --size size-of-protosystem --name DemoSystem VGStateless
    mke2fs /dev/VGStateless/DemoSystem
    mkdir /srv/stateless/protosystems/DemoSystem
    mount /dev/VGStateless/DemoSystem /srv/stateless/protosystems/DemoSystem
    
    
  2. Perform a standard installation on a test machine, selecting the packages you wish to be installed on the clients.

    Use the rsync on the server to copy the files from the test machine to the prototype system area created above.

    On the test machine:

    service iptables stop

    On the server:

    rsync -e ssh -av --exclude '/proc/*' --exclude '/sys/*' IP-address-of-test-machine:/ /srv/stateless/protosystems/DemoSystem

  3. Edit /etc/fstab within the prototype system

    [Note]Note

    At this step, and in the subsequent ones, when we refer to editing a file within the prototype system, we mean in the hierarchy below /srv/stateless/protosystems/DemoSystem. So, for example, to edit /etc/fstab within the prototype system, we mean you should be editing /srv/stateless/protosystems/DemoSystem/etc/fstab. You can do this by manually expanding the paths, or by using chroot.

    Make sure the devices for / and /boot are LABEL=/ and LABEL=/boot respectively, delete the swap partition line.

    Configure NFS mounted home directories by adding the line:

    server-address:/home/users /home/users   nfs  rw,nosuid,nodev,hard,intr,bg,rsize=8192,wsize=8192

    Create the mountpoint within the protosystem:

    mkdir /srv/stateless/protosystems/DemoSystem/home/users
  4. Install the latest versions of the readonly-root and stateless-client packages into the prototype system.

    You can do this by editing /etc/yum.conf within the prototype system and appending these lines:

    
    [StatelessLinux]
    name=Stateless Linux
    baseurl=http://people.redhat.com/dmalcolm/stateless

    and then running yum within the protosystem:

    chroot /srv/stateless/protosystems/DemoSystem
    yum install readonly-root stateless-client
    

  5. Configure nss-ldap by editing /etc/ldap.conf within the prototype system

    1. Change host line to be host server-address

    2. Change base line from base example.com to base dc=stateless-test, dc=fubar, dc=org

    Edit /etc/nsswitch.conf within the prototype system; change passwd, shadow, and group lines to be files ldap

  6. Create an entry representing the new protosystem within the LDAP directory

    ldapadd -x -W -D"cn=Manager, dc=stateless-test, dc=fubar, dc=org" <<EOF
    dn: statelessConfigurationName=DemoSystem,dc=stateless,ou=services, dc=stateless-test, dc=fubar, dc=org
    objectClass: statelessConfiguration
    statelessConfigurationName: DemoSystem
    
    # Need the previous blank line to correctly terminate the above entry
    EOF
    
  7. Ensure that the kernel module for the "snapshot" device-mapper target is loaded by running dmsetup targets. If snapshot is not listed, you will need to load the relevant kernel module:

    insmod /lib/modules/kernel-version/kernel/drivers/md/dm-snapshot.ko

    Rerun dmsetup targets, and snapshot should now be listed.