Difference between revisions of "Vnx-rootfsfedora"

From VNX
Jump to: navigation, search
Line 74: Line 74:
 
<li>From the virtual machine console:</li>
 
<li>From the virtual machine console:</li>
 
  ln -s /media/CDROM /media/cdrom
 
  ln -s /media/CDROM /media/cdrom
 +
udisks --mount /dev/sr0
 
  perl /media/cdrom/install_vnxdaemon
 
  perl /media/cdrom/install_vnxdaemon
 
</ul>
 
</ul>
<li>Delete udev network rules files:</li>
 
rm /etc/udev/rules.d/70-persistent-net.rules
 
 
<li>Enable login on the first serial line by creating a file named /etc/init/serial-ttyS0.conf with the following content:</li>
 
<li>Enable login on the first serial line by creating a file named /etc/init/serial-ttyS0.conf with the following content:</li>
 
  #This service maintains a getty on /dev/ttyS0.
 
  #This service maintains a getty on /dev/ttyS0.
Line 101: Line 100:
 
  chkconfig iptables off
 
  chkconfig iptables off
 
</ul>
 
</ul>
<li>Clean yum cache and stop the machine with:</li>
+
<li>Create a file /etc/vnx_root_fs_version to store version number and informacion about modification:
yum clean all
+
VER=v0.21
halt
+
OS=Fedora 14
 +
DESC=Basic Fedora 14 root-filesystem without GUI
 +
Create a script named /usr/local/bin/vnx_halt:
 +
#!/bin/bash
 +
# Clean yum cache
 +
yum clean all
 +
# Delete /etc/resolv.conf
 +
rm -f /etc/resolv.conf
 +
# Clean command history
 +
rm -f /root/.bash_history
 +
# Delete udev net rules files:
 +
rm -f /etc/udev/rules.d/70-persistent-net.rules
 +
# Ask for a message to save in /etc/vnx_root_fs_version file
 +
echo "Describe the modifications done to the root-fs to log them into /etc/vnx_r
 +
oot_fs_version file (1 line maximum):"
 +
read logmsg
 +
DATE=`date`
 +
echo "MODDATE=$DATE" >> /etc/vnx_root_fs_version
 +
echo "MODDESC=$logmsg" >> /etc/vnx_root_fs_version
 +
# Halt the system
 +
halt
 +
Give the script execution permissions:
 +
chmod +x /usr/local/bin/vnx_halt
 +
Stop the machine with that script:
 +
vnx_halt
 
</ul>
 
</ul>
  

Revision as of 20:18, 16 July 2011

How to create a Fedora root filesystem for VNX

Follow this procedure to create a fedora based root filesystem for VNX. The procedure has been tested with Fedora 14.

  • Create the filesystem disk image:
  • qemu-img create -f qcow2 root_fs_fedora-base.qcow2 5GB
    
  • Get Fedora installation DVD (use the complete DVD; do not use the Live version, as it seems the installation wizard does not include the customization menu). For example:
  • wget ftp://ftp.rediris.es/mirror/fedora/14/Fedora/i386/iso/Fedora-14-i386-DVD.iso
    cp Fedora-14-i386-DVD.iso /almacen/iso
    
  • Create a libvirt XML definition (root_fs_freebsd.xml) containing the virtual machine description:
  • <domain type='kvm'>
      <name>Fedora</name>
      <memory>524288</memory>
      <vcpu>1</vcpu>
      <os>
        <type arch="i686">hvm</type>
        <boot dev='hd'/>
        <boot dev='cdrom'/>
      </os>
      <features>
         <pae/>
         <acpi/>
         <apic/>
      </features>
      <clock sync="localtime"/>
      <devices>
        <emulator>/usr/bin/kvm</emulator>
        <disk type='file' device='disk'>
          <source file='/usr/share/vnx/filesystems/root_fs_fedora-base.qcow2'/>
          <target dev='hda'/>
        </disk>
        <disk type='file' device='cdrom'>
          <source file='/almacen/iso/Fedora-14-i386-DVD.iso'/>
          <target dev='hdb'/>
        </disk>
        <interface type='network'>
          <source network='default'/>
        </interface>
        <serial type="pty">
          <target port="1"/>
        </serial>
        <console type="pty">
          <target port="1"/>
        </console>
        <graphics type='vnc'/>
      </devices>
    </domain>
    

    Note: change "source file=" lines to whatever fits your case (use full paths).

  • Start the virtual machine with:
  • virsh create root_fs_fedora.xml
    
  • Access virtual machine console with:
  • virt-viewer Fedora
    
  • Follow Fedora installation menus to install:
    • A "minimal" system, if you want a server rootfs without user interface
    • One of the other options (e.g "web server", "desktop system", etc) if you want a system with graphical user interface
  • Once installation is finished, stop the machine, edit root_fs_fedora.xml file and comment the following line in cdrom disk specification:
  • Start the virtual machine again with:
  • virsh create root_fs_fedora.xml
    
  • Update the system and install additional packages
  • yum update
    yum install perl perl-XML-DOM acpid udisks
    

    Note: if yum fails, check that the network is working. Maybe you will have to manually execute "dhclient eth0", at least in the case of a minimal installation.

  • Install VNX autoconfiguration daemon:
    • From the host execute:
    • /usr/share/vnx/bin/vnx_update_aced Fedora /usr/share/vnx/aced/vnx-aced-lf-0.1b.tgz 
      
    • From the virtual machine console:
    • ln -s /media/CDROM /media/cdrom
      udisks --mount /dev/sr0
      perl /media/cdrom/install_vnxdaemon
      
  • Enable login on the first serial line by creating a file named /etc/init/serial-ttyS0.conf with the following content:
  • #This service maintains a getty on /dev/ttyS0.
    start on stopped rc RUNLEVEL=[2345]
    stop on starting runlevel [016]
    respawn
    exec /sbin/agetty /dev/ttyS0 9600 vt100-nav
    
  • Besides, you have to add ttyS0 to /etc/securetty file if you want to login root on that console:
  • echo "ttyS0" >> /etc/securetty
    
  • If you have chosen a "minimum installation", activate network services (they are disable by default):
  • chkconfig --level 3 network on
    
  • Optionally:
    • Install other services, for example, an apache server:
    • yum install httpd
      update-rc.d -f apache2 remove   # to avoid automatic start
      
    • Or, if using a "minumum installation", install network utilities:
    • yum install telnet wget openssh-clients
      
    • If you want automatic login, just edit /etc/gdm/custom.conf and add the following lines:
    • AutomaticLoginEnable=true
      AutomaticLogin=vnx
      
    • Disable the firewall. Firewall is enabled by default which could be problematic for testing purpose systems. If desired, disable it graphically in "System|Administration|Firewall" option, or using the following command from the command line:
    • chkconfig iptables off
      
  • Create a file /etc/vnx_root_fs_version to store version number and informacion about modification: VER=v0.21 OS=Fedora 14 DESC=Basic Fedora 14 root-filesystem without GUI Create a script named /usr/local/bin/vnx_halt:
    1. !/bin/bash
    2. Clean yum cache
    yum clean all
    1. Delete /etc/resolv.conf
    rm -f /etc/resolv.conf
    1. Clean command history
    rm -f /root/.bash_history
    1. Delete udev net rules files:
    rm -f /etc/udev/rules.d/70-persistent-net.rules
    1. Ask for a message to save in /etc/vnx_root_fs_version file
    echo "Describe the modifications done to the root-fs to log them into /etc/vnx_r oot_fs_version file (1 line maximum):" read logmsg DATE=`date` echo "MODDATE=$DATE" >> /etc/vnx_root_fs_version echo "MODDESC=$logmsg" >> /etc/vnx_root_fs_version
    1. Halt 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 root_fs_fedora.xml 
  • Install the software:
yum install ...
  • Delete udev rules files:
rm /etc/udev/rules.d/70-persistent-net.rules
  • Stop the machine with:
halt

Known problems