Difference between revisions of "Vnx-rootfscentos"

From VNX
Jump to: navigation, search
(Known issues)
(Configuration)
 
(36 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Title|How to create a CentOS root filesystem for VNX}}
+
{{Title|How to create a KVM CentOS root filesystem for VNX}}
 
 
(being updated...do not use)
 
  
 
== Basic installation ==
 
== Basic installation ==
  
Follow this procedure to create a CentOS based root filesystem for VNX. The procedure has been tested with CentOS 6.2.
+
Follow this procedure to create a KVM CentOS based root filesystem for VNX. The procedure has been tested with CentOS 5.6, 6.2, 6.4, 6.5 and 7.0.
 
<ul>
 
<ul>
 
<li>Create the filesystem disk image:</li>
 
<li>Create the filesystem disk image:</li>
  qemu-img create -f qcow2 vnx_rootfs_kvm_centos.qcow2 8GB
+
  qemu-img create -f qcow2 vnx_rootfs_kvm_centos.qcow2 20G
 
<li>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:</li>
 
<li>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:</li>
  wget ftp://ftp.rediris.es/mirror/CentOS/6.2/isos/i386/CentOS-6.2-i386-bin-DVD1.iso
+
  wget ftp://ftp.rediris.es/mirror/CentOS/X.X/isos/i386/CentOS-X.X-i386-bin-DVD1.iso
  cp CentOS-6.2-i386-bin-DVD1.iso /almacen/iso
+
  cp CentOS-X.X-i386-bin-DVD1.iso /almacen/iso
 
Note: latests versions of CentOS are distributed in two DVDs. However, only the first DVD is needed for basic installations; no need to download DVD2.
 
Note: latests versions of CentOS are distributed in two DVDs. However, only the first DVD is needed for basic installations; no need to download DVD2.
 
<li>Create the virtual machine with:</li>
 
<li>Create the virtual machine with:</li>
  vnx --create-rootfs vnx_rootfs_kvm_centos.qcow2 --install-cdrom /almacen/iso/CentOS-6.2-i386-bin-DVD1.iso --mem 768M
+
  vnx --create-rootfs vnx_rootfs_kvm_centos.qcow2 --install-media /almacen/iso/CentOS-X.X-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).  
 
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).  
<!--
+
 
<li>Create a libvirt XML definition (rootfs_centos.xml) containing the virtual machine description:</li>
+
Note: add '''"--arch x86_64"''' option for 64 bits virtual machines
<pre>
 
<domain type='kvm'>
 
  <name>CentOS</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/vnx_rootfs_centos-base.qcow2'/>
 
      <target dev='hda'/>
 
      <driver name="qemu" type="qcow2"/>
 
    </disk>
 
    <disk type='file' device='cdrom'>
 
      <source file='/almacen/iso/CentOS-6.2-i386-bin-DVD1.iso'/>
 
      <target dev='hdb'/>
 
    </disk>
 
    <interface type='network'>
 
      <source network='default'/>
 
    </interface>
 
    <serial type="pty">
 
      <target port="0"/>
 
    </serial>
 
    <console type="pty">
 
      <target port="0"/>
 
    </console>
 
    <graphics type='vnc'/>
 
  </devices>
 
</domain>
 
</pre>
 
Note: change "source file=" lines to whatever fits your case (use full paths).
 
<li>Start the virtual machine with:</li>
 
virsh create rootfs_centos.xml
 
<li>Access virtual machine console with:</li>
 
virt-viewer CentOS
 
-->
 
 
<li>Follow the CentOS installation assistant. At some point, you will have to choose among different system profiles: Desktop, Minimal Desktop, Minimal, Basic Server, etc.</li>
 
<li>Follow the CentOS installation assistant. At some point, you will have to choose among different system profiles: Desktop, Minimal Desktop, Minimal, Basic Server, etc.</li>
 
<!--ul>
 
<!--ul>
Line 71: Line 24:
 
</ul-->
 
</ul-->
  
<li>Once the installation is finished (the system will have to be rebooted to carry out the final steps), configure the serial console following these [http://blog.zelut.org/2010/05/05/configure-serial-console-access-on-centos-5/ instructions].</li>
+
<li>Once the installation is finished and the installer asks for rebooting the system, just stop the virtual machine using "virsh destroy ..." command and continue with the configuration phase.</li>
<li>Finally, delete the net udev rules file, halt the system and restart it with the following command:</li>
+
</ul>
rm /etc/udev/rules.d/70-persistent-net.rules
 
vnx --modify-rootfs vnx_rootfs_kvm_centos.qcow2 --update-aced
 
Note: ignore the errors "timeout waiting for response on VM socket".
 
  
 
== Configuration ==
 
== Configuration ==
  
 
<ul>
 
<ul>
<li>Access the system through the text console to easy the copy-paste of commands:</li>
+
<li>Restart the system with the following command:</li>
 +
vnx --modify-rootfs vnx_rootfs_kvm_centos.qcow2 --update-aced --mem 768M
 +
Note: ignore the errors "timeout waiting for response on VM socket".
 +
Note2: 768M are needed if you are installing a root filesystem with desktop interface; 512M are enough for a text version.
 +
<li>Configure the serial console:</li>
 +
<ul>
 +
<li>For CentOS 5.X and 6.X, following these [http://blog.zelut.org/2010/05/05/configure-serial-console-access-on-centos-5/ instructions].</li>
 +
<li>For CentOS 7.X, by executing:</li>
 +
grubby --update-kernel=ALL --args="console=ttyS0"
 +
</ul>
 +
<li>Delete the net udev rules file and reboot the system:</li>
 +
rm /etc/udev/rules.d/70-persistent-net.rules
 +
halt
 +
<li>Once started, access the system through the text console to easy the copy-paste of commands:</li>
 
  virsh console vnx_rootfs_kvm_centos.qcow2
 
  virsh console vnx_rootfs_kvm_centos.qcow2
 
<li>Check that you have network connectivity. Maybe you have to activate the network interface by hand:</li>
 
<li>Check that you have network connectivity. Maybe you have to activate the network interface by hand:</li>
 
  dhclient eth1
 
  dhclient eth1
 
Note: use "ip link show" to know which network interface to use.
 
Note: use "ip link show" to know which network interface to use.
<li>Configure the RPMForge repository following the procedure described [http://wiki.centos.org/AdditionalResources/Repositories/RPMForge?action=show&redirect=Repositories%2FRPMForge#head-5aabf02717d5b6b12d47edbc5811404998926a1b here]:</li>
+
<!--li>Configure the RPMForge repository following the procedure described [http://www.tecmint.com/how-to-enable-epel-repository-for-rhel-centos-6-5/ here]:</li-->
 +
<!--
 
  yum install wget
 
  yum install wget
  wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
+
  wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.i686.rpm
 
  rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
 
  rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
  rpm -K rpmforge-release-0.5.2-2.el6.rf.*.rpm
+
  rpm -K rpmforge-release-0.5.3-1.el6.rf.*.rpm
  rpm -i rpmforge-release-0.5.2-2.el6.rf.*.rpm
+
  rpm -i rpmforge-release-0.5.3-1.el6.rf.*.rpm
 +
 
 +
Note: change 'i686' by 'x86_64' for 64 bits root filesystems.
 +
-->
 +
<li>Install daemonize package (e.g. for CentOs 7; change url to whatever version corresponds):</li>
 +
yum install https://kojipkgs.fedoraproject.org//packages/daemonize/1.7.7/1.el7/x86_64/daemonize-1.7.7-1.el7.x86_64.rpm
 +
 
 
<li>Update the system and install additional packages</li>
 
<li>Update the system and install additional packages</li>
 
  yum update
 
  yum update
  yum install perl perl-XML-DOM perl-XML-Parser acpid daemonize
+
  yum install perl perl-XML-LibXML perl-NetAddr-IP acpid perl-Sys-Syslog
 +
Note: if you get a dependencies error when installing LibXML package, try installing 'perl-XML-SAX' package instead.
 +
 
 
<li>Install VNX autoconfiguration daemon:</li>
 
<li>Install VNX autoconfiguration daemon:</li>
 
  mount /dev/sdb /mnt/
 
  mount /dev/sdb /mnt/
Line 116: Line 88:
 
  chkconfig iptables off
 
  chkconfig iptables off
 
  chkconfig ip6tables off
 
  chkconfig ip6tables off
 +
<li>Or, if using a "minumum installation", install network utilities:</li>
 +
yum install telnet wget openssh-clients traceroute tcpdump
 
<!--li>Enable IPv6 by deleting the following lines in /etc/modprobe.conf:</li>
 
<!--li>Enable IPv6 by deleting the following lines in /etc/modprobe.conf:</li>
 
  alias ipv6 off
 
  alias ipv6 off
  options ipv6 disable=1
+
  options ipv6 disable=1 -->
</ul-->
+
</ul>
 +
 
 
<li>Create a file /etc/vnx_rootfs_version to store version number and informacion about modifications:</li>
 
<li>Create a file /etc/vnx_rootfs_version to store version number and informacion about modifications:</li>
 
<pre>
 
<pre>
VER=v0.24
+
VER=v0.25
OS=CentOS 6.2
+
OS=CentOS 6.5
DESC=Basic CentOS 6.2 root-filesystem without GUI
+
DESC=Basic CentOS 6.5 root-filesystem without GUI
 
</pre>
 
</pre>
<li>Stop the machine with that script:</li>
+
<li>Finally, stop the virtual machine with:</li>
 
  vnx_halt
 
  vnx_halt
 +
''vnx_halt'' deletes some caches and log files and optionally lets you write a short message to ''/etc/vnx_rootfs_version file'' describing the latest modifications done.
 
</ul>
 
</ul>
  
Line 142: Line 118:
 
<li>Finally, halt the system using:</li>
 
<li>Finally, halt the system using:</li>
 
  vnx_halt
 
  vnx_halt
''vnx_halt'' deletes some caches and log files and lets you write a short message to ''/etc/vnx_rootfs_version file'' describing the modifications done.
 
 
</ul>
 
</ul>
  

Latest revision as of 01:25, 3 November 2016

How to create a KVM CentOS root filesystem for VNX

Basic installation

Follow this procedure to create a KVM CentOS based root filesystem for VNX. The procedure has been tested with CentOS 5.6, 6.2, 6.4, 6.5 and 7.0.

  • Create the filesystem disk image:
  • qemu-img create -f qcow2 vnx_rootfs_kvm_centos.qcow2 20G
    
  • 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/X.X/isos/i386/CentOS-X.X-i386-bin-DVD1.iso
    cp CentOS-X.X-i386-bin-DVD1.iso /almacen/iso
    

    Note: latests versions of CentOS are distributed in two DVDs. However, only the first DVD is needed for basic installations; no need to download DVD2.

  • Create the virtual machine with:
  • vnx --create-rootfs vnx_rootfs_kvm_centos.qcow2 --install-media /almacen/iso/CentOS-X.X-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).

    Note: add "--arch x86_64" option for 64 bits virtual machines

  • 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 and the installer asks for rebooting the system, just stop the virtual machine using "virsh destroy ..." command and continue with the configuration phase.

Configuration

  • Restart the system with the following command:
  • vnx --modify-rootfs vnx_rootfs_kvm_centos.qcow2 --update-aced --mem 768M
    

    Note: ignore the errors "timeout waiting for response on VM socket". Note2: 768M are needed if you are installing a root filesystem with desktop interface; 512M are enough for a text version.

  • Configure the serial console:
    • For CentOS 5.X and 6.X, following these instructions.
    • For CentOS 7.X, by executing:
    • grubby --update-kernel=ALL --args="console=ttyS0"
      
  • Delete the net udev rules file and reboot the system:
  • rm /etc/udev/rules.d/70-persistent-net.rules
    halt
    
  • Once started, access the system through the text console to easy the copy-paste of commands:
  • virsh console vnx_rootfs_kvm_centos.qcow2
    
  • Check that you have network connectivity. Maybe you have to activate the network interface by hand:
  • dhclient eth1
    

    Note: use "ip link show" to know which network interface to use.

  • Install daemonize package (e.g. for CentOs 7; change url to whatever version corresponds):
  • yum install https://kojipkgs.fedoraproject.org//packages/daemonize/1.7.7/1.el7/x86_64/daemonize-1.7.7-1.el7.x86_64.rpm
    
  • Update the system and install additional packages
  • yum update
    yum install perl perl-XML-LibXML perl-NetAddr-IP acpid perl-Sys-Syslog
    

    Note: if you get a dependencies error when installing LibXML package, try installing 'perl-XML-SAX' package instead.

  • Install VNX autoconfiguration daemon:
  • mount /dev/sdb /mnt/
    perl /mnt/vnxaced-lf/install_vnxaced
    
  • Optionally:
    • Disable the services you are not going to use to speed up the virtual machine startup (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 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
      
    • Or, if using a "minumum installation", install network utilities:
    • yum install telnet wget openssh-clients traceroute tcpdump
      
  • Create a file /etc/vnx_rootfs_version to store version number and informacion about modifications:
  • VER=v0.25
    OS=CentOS 6.5
    DESC=Basic CentOS 6.5 root-filesystem without GUI
    
  • Finally, stop the virtual machine with:
  • vnx_halt
    

    vnx_halt deletes some caches and log files and optionally lets you write a short message to /etc/vnx_rootfs_version file describing the latest modifications done.

Installing additional software

To install additional software or to modify your root file system, you just have to:

  • Start a virtual machine from it:
  • vnx --modify-rootfs vnx_rootfs_kvm_centos.qcow2
    
  • Check network connectivity. Maybe you have to activate the network interface by hand:
  • dhclient eth1
    

    Note: use "ip link show" to know which network interface to use.

  • Do the modifications you want.
  • Finally, halt the system using:
  • vnx_halt
    

Updating VNXACED

You can automatically update the VNXACE daemon with the following command:

vnx --modify-rootfs vnx_rootfs_kvm_centos.qcow2 --update-aced -y

Known issues

  • When executing commands using vnx "--exe" option in virtual machines configured with exec_mode="cdrom", 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.