Vnx-rootfscentos

From VNX
Revision as of 14:10, 20 May 2012 by David (talk | contribs) (Basic installation)
Jump to: navigation, search

How to create a CentOS root filesystem for VNX

(being updated...do not use)

Basic installation

Follow this procedure to create a CentOS based root filesystem for VNX. The procedure has been tested with CentOS 6.2.

  • Create the filesystem disk image:
  • qemu-img create -f qcow2 vnx_rootfs_kvm_centos.qcow2 8GB
    
  • Get CentOS installation DVD (we recommend to use the complete DVD; the LiveDVD version does not include the customization menu to choose among different installation profiles: minimal, desktop, etc). For example:
  • wget ftp://ftp.rediris.es/mirror/CentOS/6.2/isos/i386/CentOS-6.2-i386-bin-DVD1.iso
    cp CentOS-6.2-i386-bin-DVD1.iso /almacen/iso
    

    Note: for Cent=S 6.2 only the first DVD is needed. You do not need to download DVD2.

  • Create the virtual machine with:
  • vnx --create-rootfs vnx_rootfs_kvm_centos.qcow2 --install-cdrom /almacen/iso/CentOS-6.2-i386-bin-DVD1.iso --mem 768M
    

    Note: around 768M of memory are needed to use the graphical installation assistant. With the textual assistant the memory requirements are lower (known to work with 512M).

  • Follow the CentOS installation assistant. At some point, you will have to choose among different system profiles: Desktop, Minimal Desktop, Minimal, Basic Server, etc.
  • Once the installation is finished (the system will have to be rebooted to carry out the final steps), halt the system and restart it with the following command:
  • vnx --modify-rootfs vnx_rootfs_kvm_centos-6.2-v024.qcow2 --update-aced
    

    Configuration

    • Once installation is finished, configure the RPMForge repository following the procedure described here:
    • wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm
      rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
      rpm -K rpmforge-release-0.5.2-2.el5.rf.*.rpm
      rpm -i rpmforge-release-0.5.2-2.el5.rf.*.rpm
      
    • Update the system and install additional packages
    • yum update
      yum install perl perl-XML-DOM perl-XML-Parser acpid daemonize
      
    • Install VNX autoconfiguration daemon:
      • From the host execute:
      • /usr/share/vnx/bin/vnx_update_aced CentOS /usr/share/vnx/aced/vnx-aced-lf-0.1b.tgz 
        
      • From the virtual machine console:
      • mkdir /media/cdrom
        mount /dev/cdrom /media/cdrom
        perl /media/cdrom/install_vnxdaemon
        
    • Configure the serial console following these instructions.
    • Disable the services you are not going to use (you can see the list of active services with "chkconfig --list"). For example to disable sendmail and bluetooth:
    • chkconfig sendmail off
      chkconfig bluetooth off
      
    • Disable eth0 autoconfiguration to avoid delays at startup. Edit /etc/sysconfig/network-scripts/ifcfg-eth0 file and change "ONBOOT" line to:
    • ONBOOT=no
      
    • Optionally:
      • Disable the firewall. Firewall is enabled by default which could be problematic for testing purpose systems. If desired, disable it using the following command:
      • chkconfig iptables off
        chkconfig ip6tables off
        
      • Enable IPv6 by deleting the following lines in /etc/modprobe.conf:
      • alias ipv6 off
        options ipv6 disable=1
        
    • Create a file /etc/vnx_rootfs_version to store version number and informacion about modifications:
    • VER=v0.21
      OS=CentOS 5.6
      DESC=Basic CentOS 5.6 root-filesystem without GUI
      
    • Create a script named /usr/local/bin/vnx_halt:
    • #!/bin/bash
      echo "** Cleaning yum cache..."
      yum clean all
      echo "** Deleting /etc/resolv.conf..."
      rm -f /etc/resolv.conf
      echo "** Cleaning command history...."
      rm -f /root/.bash_history
      # Delete VNXACE log
      rm -f /var/log/vnxaced.log
      while true; do
          # Ask for a message to save in /etc/vnx_rootfs_version file
          echo    "** Save a log message in /etc/vnx_rootfs_version file "
          echo -n "** describing the modifications done? "
          read -n 1 -p "[y/n] " answer
          echo ""
          case $answer in
              [Yy]* )
                      echo "** Log message (1 line maximum):"
                      read logmsg
                      DATE=`date`
                      echo "MODDATE=$DATE" >> /etc/vnx_rootfs_version
                      echo "MODDESC=$logmsg" >> /etc/vnx_rootfs_version
                      break;;
              [Nn]* ) break;;
              * )     echo "** Error: please answer 'y' or 'n'.";;
          esac
      done
      echo ""
      echo "** Halting the system..."
      halt
      
    • Give the script execution permissions:
    • chmod +x /usr/local/bin/vnx_halt
      
    • Stop the machine with that script:
    • vnx_halt
      

    Installing additional software

    To install additional software or modify your root file system, you just have to start it as described above and make the operations required on the filesystem.

    • Start the virtual machine (directly using virsh or the vnx_modify_rootfs utility):
     /usr/share/vnx/bin/vnx_modify_rootfs rootfs_centos.xml 
    
    • Install the software:
    yum install ...
    
    • Stop the machine with:
    vnx_halt
    

    Known issues

    • When executing commands using vnx "--exe" option, traces like the followinf appear on the consoles:
    • hdb: tray open
      end_request: I/O error, dev hdb, sector 8388352
      

      They are generated as a result of mount command execution by the VNX daemon. Commands are correctly executed. To be further investigated.