This Blog is to share our knowledge and expertise on Linux System Administration and VMware Administration

Wednesday, November 4, 2015

Red Hat Enterprise Virtualization Manager (RHEVM) minimum hardware requirements.

Wednesday, November 04, 2015 0
Red Hat Enterprise Virtualization Manager servers must run Red Hat Enterprise Linux 6. A number  of additional hardware requirements must also be met.

Item                   Limitations
RAM                  A minimum of 3 GB of RAM is required.
PCI Devices      At least one network controller with a minimum bandwidth of 1 Gbps (Rec)

Storage             A minimum of 3 GB of available local disk space is recommended.

Monday, November 2, 2015

How to Manage Software with YUM in Linux Server?

Monday, November 02, 2015 0
Use the yum utility to modify the software on your system in four ways:

    To install new software from package repositories
    To install new software from an individual package file
    To update existing software on your system
    To remove unwanted software from your system

[Important]            Installing Software from a Package File


To use yum, specify a function and one or more packages or package groups. Each section below gives some examples.

For each operation, yum downloads the latest package information from the configured repositories.

The yum utility searches these data files to determine the best set of actions to produce the required result, and displays the transaction for you to approve. The transaction may include the installation, update, or removal of additional packages, in order to resolve software dependencies.

This is an example of the transaction for installing tsclient:
==================================================================
 Package                 Arch       Version          Repository        Size
==================================================================
Installing:
 tsclient                   i386       0.132-4          base              247 k
Installing for dependencies:
 rdesktop                i386       1.3.1-5            base              107 k
Transaction Summary
==================================================================
Install      2 Package(s)
Update       0 Package(s)
Remove       0 Package(s)
Total download size: 355 k

Is this ok [y/N]:
Format of YUM Transaction Reports:
Review the list of changes, and then press y to accept and begin the process. If you press N or Enter, yum does not download or change any packages.

Package Versions
 The yum utility only displays and uses the newest version of each package, unless you specify an older version.
The yum utility also imports the repository public key if it is not already installed on the rpm keying.

This is an example of the public key import:

warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 443E1821
public key not available for tsclient-0.132-4.i386.rpm
Retrieving GPG key from http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-4
Importing GPG key 0x443E1821 "CentOS-4 Key<centos-4key@centos.org>"
Is this ok [y/N]:

Format of yum Public Key Import

 Check the public key, and then press y to import the key and authorize the key for use. If you press N or Enter, yum stops without installing any packages.
To ensure that downloaded packages are genuine, yum verifies the digital signature of each package against the public key of the provider. Once all of the packages required for the transaction are successfully downloaded and verified, yum applies them to your system.

Downloads are Cached

The yum utility keeps downloaded data files and packages for reuse. You may copy packages from the repository cache directories under /var/cache/yum/, and use them elsewhere if you wish. If you remove a package from the cache, you do not affect the copy of the software installed on your system.

Installing New Software with YUM:

 To install the package tsclient, enter the command:
 yum install tsclient

To install the package group MySQL Database, enter the command:
yum groupinstall "MySQL Database"

Updating Software with YUM:
yum update tsclient

Note: New Software Versions Require Reloading

If a piece of software is in use when you update it, the old version remains active until the application or service is restarted. Kernel updates take effect when you reboot the system.

To update all of the packages in the package group MySQL Database, enter the command:
yum groupupdate "MySQL Database"

Removing Software with YUM:

To remove software, yum examines your system for both the specified software, and any software which claims it as a dependency. The transaction to remove the software deletes both the software and the dependencies.
yum remove tsclient

To remove all of the packages in the package group MySQL Database, enter the command:
yum groupremove "MySQL Database"

Searching for Packages with YUM:
Use the search features of yum to find software that is available from the configured repositories, or already installed on your system. Searches automatically include both installed and available packages.

The format of the results depends upon the option. If the query produces no information, there are no packages matching the criteria.

Searching by Package Name and Attributes
yum list tsclient

To make your queries more precise, specify packages with a name that include other attributes, such as version or hardware architecture. To search for version 0.132 of the application, use the command:
yum list tsclient-0.132

Advanced Searches:

If you do not know the name of the package, use the search or provides options. Alternatively, use wild cards or regular expressions with any yum search option to broaden the search criteria.

The search option checks the names, descriptions, summaries and listed package maintainers of all of the available packages to find those that match. For example, to search for all packages that relate to PalmPilots, type:
yum search PalmPilot

This provides function checks both the files included in the packages and the functions that the software provides. This option requires yum to download and read much larger index files than with the search option.

To search for all packages that include files called libneon, type:
yum provides libneon

To search for all packages that either provides a MTA (Mail Transport Agent) service, or includes files with mta in their name:
yum provides MTA

Use the standard wildcard characters to run any search option with a partial word or name: ? to represent any one character, and * to mean zero or more characters. Always add the escape character (\) before wildcards.

To list all packages with names that begin with tsc, type:
yum list tsc\*

Understanding Matches
 Searches with yum show all of the packages that match your criteria. Packages must meet the terms of the search exactly to be  considered matches,  unless you use wildcards or a regular expression.

For example, a search query for shadowutils or shadow-util would not produce the package shadow-utils. This package would match and be shown if the query was shadow-util\?, or shadow\*.
Updating Your System with yum

Use the update option to upgrade all of your system software to the latest version with one operation.
yum update

Automatically Updating Your System
/sbin/chkconfig --level 345 yum on; /sbin/service yum start

How Daily Updates are Run

There is no separate yum service that runs on your system. The command given above enables the control script /etc/rc.d/init.d/yum.
This control script activates the script /etc/cron.daily/yum.cron, which causes the cron service to perform the system update  automatically at 4am each day.

Maintaining YUM
The yum system does not require any routine maintenance. To ensure that yum operations are carried out at optimal speed, disable or remove repository definitions which you no longer require. You may also clear the files from the yum caches in order to recover disk space.

Disabling or Removing Package Sources
 Set enable=0 in a definition file to prevent yum from using that repository. The yum utility ignores any definition file with this setting.

To completely remove access to a repository:
    Delete the relevant file from /etc/yum.repos.d/.
    Delete the cache directory from /var/cache/yum/.

Clearing the yum Caches

By default, yum retains the packages and package data files that it downloads, so that they may be reused in future operations without being downloaded again. To purge the package data files, use this command:
yum clean headers

Run this command to remove all of the packages held in the caches:
yum clean packages

For CentOS-4 users, to clean the metadata files use this command:
yum clean metadata

Purging cached files causes those files to downloaded again the next time that they are required. This increases the amount of time required to complete the operation.

Difference Between RHEL 5, 6, AND 7 - JOBS & SERVICES

Monday, November 02, 2015 0
Difference Between RHEL 5, 6, AND 7 - JOBS & SERVICES




Difference Between RHEL 5, 6, AND 7 - NETWORKING

Monday, November 02, 2015 0
Difference Between RHEL 5, 6, AND 7 - NETWORKING

How to resolve the Insufficient Free Extents for a Logical Volume in Linux Server?

Monday, November 02, 2015 0
 You may get the error message "Insufficient free extents" when creating a logical volume when you think you have enough extents based on the output of the vgdisplay or vgs commands. This is because this commands round figures to 2 decimal places to provide human-readable output. To specify exact size, use free physical extent count instead of some multiple of bytes to determine the size of the logical volume.

The vgdisplay command, by default, includes this line of output that indicates the free physical extents.

# vgdisplay
  --- Volume group ---
  ...
  Free  PE / Size       8780 / 34.30 GB

Alternately, you can use the vg_free_count and vg_extent_count arguments of the vgs command to display the free extents
and the total number of extents.

[root@tng3-1 ~]# vgs -o +vg_free_count,vg_extent_count
  VG     #PV #LV #SN Attr   VSize   VFree   Free #Ext
  testvg   2       0    0 wz--n- 34.30G 34.30G 8780 8780

With 8780 free physical extents, you can run the following command, using the lower-case l argument to use extents instead of bytes:

# lvcreate -l8780 -n testlv testvg

This uses all the free extents in the volume group.

# vgs -o +vg_free_count,vg_extent_count
  VG     #PV #LV #SN Attr   VSize  VFree Free #Ext
  testvg   2      1      0 wz--n- 34.30G    0     0 8780

Alternately, you can extend the logical volume to use a percentage of the remaining free space in the volume group by using the -l argument of the lvcreate command.

How to Recover from LVM Mirror Failure in Linux Server?

Monday, November 02, 2015 0
This section provides an example of recovering from a situation where one leg of an LVM mirrored volume fails because the underlying device for a physical volume goes down. When a mirror leg fails, LVM converts the mirrored volume into a linear volume, which continues to operate as before but without the mirrored redundancy. At that point, you can add a new disk device to the system to use as a replacement physical device and rebuild the mirror.

The following command creates the physical volumes which will be used for the mirror.

[root@test ~]# pvcreate /dev/sd[abcdef][12]
  Physical volume "/dev/sda1" successfully created
  Physical volume "/dev/sda2" successfully created
  Physical volume "/dev/sdb1" successfully created
  Physical volume "/dev/sdb2" successfully created
  Physical volume "/dev/sdc1" successfully created
  Physical volume "/dev/sdc2" successfully created
  Physical volume "/dev/sdd1" successfully created
  Physical volume "/dev/sdd2" successfully created
  Physical volume "/dev/sde1" successfully created
  Physical volume "/dev/sde2" successfully created
  Physical volume "/dev/sdf1" successfully created
  Physical volume "/dev/sdf2" successfully created

The following commands creates the volume group vg and the mirrored volume lvgroupfs

[root@test ~]# vgcreate vg /dev/sd[abcdef][12]
  Volume group "vg" successfully created


[root@test ~]# lvcreate -L 750M -n lvgroupfs -m 1 vg /dev/sda1 /dev/sdb1 /dev/sdc1
  Rounding up size to full physical extent 752.00 MB
  Logical volume "lvgroupfs" created

We can use lvs command to verify the layout of the mirrored volume and the underlying devices for the mirror leg and the mirror log. Note that in the first example the mirror is not yet completely synced; you should wait until the Copy% field displays 100.00 before continuing.

[root@test ~]# lvs -a -o +devices
  LV                                  VG   Attr   LSize   Origin Snap%  Move Log          Copy% Devices
  lvgroupfs                        vg   mwi-a- 752.00M                  lvgroupfs_mlog 21.28 lvgroupfs_mimage_0(0),lvgroupfs_mimage_1(0)
  [lvgroupfs_mimage_0]   vg   iwi-ao 752.00M                                       /dev/sda1(0)
  [lvgroupfs_mimage_1]   vg   iwi-ao 752.00M                                       /dev/sdb1(0)
  [lvgroupfs_mlog]            vg   lwi-ao   4.00M                                       /dev/sdc1(0)

[root@test ~]# lvs -a -o +devices
  LV                                VG   Attr   LSize   Origin Snap%  Move Log          Copy%  Devices
  lvgroupfs                      vg   mwi-a- 752.00M                  lvgroupfs_mlog 100.00  lvgroupfs_mimage_0(0),lvgroupfs_mimage_1(0)
  [lvgroupfs_mimage_0] vg   iwi-ao 752.00M                                        /dev/sda1(0)
  [lvgroupfs_mimage_1] vg   iwi-ao 752.00M                                        /dev/sdb1(0)
  [lvgroupfs_mlog]          vg   lwi-ao   4.00M     i                                  /dev/sdc1(0)

In this example, the primary leg of the mirror /dev/sda1 fails. Any write activity to the mirrored volume causes LVM to detect the failed mirror. When this occurs, LVM converts the mirror into a single linear volume. In this case, to trigger the conversion, we execute a dd command

[root@test ~]# dd if=/dev/zero of=/dev/vg/lvgroupfs count=10
10+0 records in
10+0 records out

You can use the lvs command to verify that the device is now a linear device. Because of the failed disk, I/O errors occur.

[root@test ~]# lvs -a -o +devices
  /dev/sda1: read failed after 0 of 2048 at 0: Input/output error
  /dev/sda2: read failed after 0 of 2048 at 0: Input/output error
  LV                     VG   Attr   LSize   Origin Snap%  Move Log Copy%  Devices
  lvgroupfs           vg   -wi-a- 752.00M                               /dev/sdb1(0)

 At this point you should still be able to use the logical volume, but there will be no mirror redundancy.

To rebuild the mirrored volume, you replace the broken drive and recreate the physical volume. If you use the same disk rather than replacing it with a new one, you will see "inconsistent" warnings when you run the pvcreate command.

[root@test ~]# pvcreate /dev/sda[12]
  Physical volume "/dev/sda1" successfully created
  Physical volume "/dev/sda2" successfully created

[root@test ~]# pvscan
  PV /dev/sdb1   VG vg   lvm2 [67.83 GB / 67.10 GB free]
  PV /dev/sdb2   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdc1   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdc2   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdd1   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdd2   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sde1   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sde2   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdf1   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdf2   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sda1              lvm2 [603.94 GB]
  PV /dev/sda2              lvm2 [603.94 GB]

Next you extend the original volume group with the new physical volume.

[root@test ~]# vgextend vg /dev/sda[12]
  Volume group "vg" successfully extended

[root@test ~]# pvscan
  PV /dev/sdb1   VG vg   lvm2 [67.83 GB / 67.10 GB free]
  PV /dev/sdb2   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdc1   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdc2   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdd1   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdd2   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sde1   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sde2   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdf1   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sdf2   VG vg   lvm2 [67.83 GB / 67.83 GB free]
  PV /dev/sda1   VG vg   lvm2 [603.93 GB / 603.93 GB free]
  PV /dev/sda2   VG vg   lvm2 [603.93 GB / 603.93 GB free]

Convert the linear volume back to its original mirrored state.

[root@test ~]# lvconvert -m 1 /dev/vg/lvgroupfs /dev/sda1 /dev/sdb1 /dev/sdc1
  Logical volume mirror converted.

You can use the lvs command to verify that the mirror is restored.

[root@test ~]# lvs -a -o +devices
  LV                                   VG   Attr   LSize   Origin Snap%  Move Log          Copy% Devices
  lvgroupfs                         vg   mwi-a- 752.00M                  lvgroupfs_mlog 68.62 lvgroupfs_mimage_0(0),lvgroupfs_mimage_1(0)
  [lvgroupfs_mimage_0]    vg   iwi-ao 752.00M                                       /dev/sdb1(0)
  [lvgroupfs_mimage_1]     vg   iwi-ao 752.00M                                       /dev/sda1(0)
  [lvgroupfs_mlog]             vg   lwi-ao   4.00M                                       /dev/sdc1(0)

Difference Between RHEL 5, 6, AND 7 - SYSTEM BASICS & BASIC CONFIGURATION

Monday, November 02, 2015 0
Difference Between RHEL 5, 6, AND 7 - SYSTEM BASICS &  BASIC CONFIGURATION



Understanding the Virsh Command in Linux Virtualization

Monday, November 02, 2015 0
Connecting to a Hypervisor  (Unsupported now)
virsh connect <name>

Where <name> is the machine name of the hypervisor. If you want to initiate a read—only connection, append the above command with —readonly.

Creating a Virtual Machine
virsh create <path to XML configuration file>

Configuring an XML Dump
virsh dumpxml [domain-id | domain-name | domain-uuid]

This command outputs the domain information (in XML) to stdout . If you save the data to a file, you can use the create option to recreate the virtual machine.

Suspending a Virtual Machine
virsh suspend [domain-id | domain-name |domain-uuid]

When a domain is in a suspended state, it still consumes system RAM. There will also be no disk or network I/O when suspended. This operation is immediate and the virtual machine must be restarted with the resume option

Resuming a Virtual Machine
virsh resume [domain-id | domain-name | domain-uuid]

This operation is immediate and the virtual machine parameters are preserved in a suspend and resume cycle.

Saving a Virtual Machine
virsh save [domain-name][domain-id | domain-uuid][filename]

This stops the virtual machine you specify and saves the data to a file, which may take some time given the amount of memory in use by your virtual machine. You can restore the state of the virtual machine with the restore option

Restoring a Virtual Machine
virsh restore [filename]

This restarts the saved virtual machine, which may take some time. The virtual machine's name and UUID are preserved but are allocated for a new id.

Shutting Down a Virtual Machine
virsh shutdown [domain-id | domain-name | domain-uuid]

You can control the behavior of the rebooting virtual machine by modifying the on_shutdown parameter of the xmdomain.cfg file.

Rebooting a Virtual Machine
virsh reboot [domain-id | domain-name | domain-uuid]

 You can control the behavior of the rebooting virtual machine by modifying the on_reboot parameter of the xmdomain.cfg file.

Terminating a Domain
virsh destroy [domain-name | domain-id | domain-uuid]

This command does an immediate ungraceful shutdown and stops any guest domain sessions (which could potentially lead to file corrupted file systems still in use by the virtual machine). You should use the destroy option only when the virtual machine's
operating system is non-responsive. For a paravirtualized virtual machine, you should use the shutdown option .

Converting a Domain Name to a Domain ID
virsh domid [domain-name | domain-uuid]

Converting a Domain ID to a Domain Name
virsh domname [domain-name | domain-uuid]

Converting a Domain Name to a UUID
virsh domuuid [domain-id | domain-uuid]

Displaying Virtual Machine Information
virsh dominfo [domain-id | domain-name | domain-uuid]

Displaying Node Information
virsh nodeinfo

 The outputs displays something similar to:
CPU model                    x86_64
CPU (s)                      8
CPU frequency                2895 Mhz
CPU socket(s)                2    
Core(s) per socket           2
Threads per core:            2
Numa cell(s)                 1
Memory size:                 1046528 kb
This displays the node information and the machines that support the virtualization process.

Displaying the Virtual Machines
virsh list domain-name [ ——inactive  |  ——all]


The ——inactive option lists inactive domains (domains that have been defined but are not currently active).
The —all domain lists all domains, whether active or not. Your output should resemble the this example:
ID                 Name                 State
————————————————
0                   Domain0             running
1                   Domain202           paused
2                   Domain010           inactive
3                   Domain9600          crashed

Here are the six domain states:
running           lists domains currently active on the CPU
blocked           lists domains that are blocked
paused            lists domains that are suspended
shutdown          lists domains that are in process of shutting down
shutoff           lists domains that are completely down.
crashed           lists domains that are crashed

Displaying Virtual CPU Information
virsh vcpuinfo [domain-id | domain-name | domain-uuid]

Configuring Virtual CPU Affinity
virsh vcpupin [domain-id | domain-name | domain-uuid] [vcpu] , [cpulist]

Where [vcpu] is the virtual VCPU number and [cpulist] lists the physical number of CPUs.

Configuring Virtual CPU Count
virsh setvcpus [domain-name | domain-id | domain-uuid] [count]

 Note that the new count cannot exceed the amount you specified when you created the Virtual Machine

Configuring Memory Allocation
virsh setmem [domain-id | domain-name]  [count]

You must specify the [count] in kilobytes. Note that the new count cannot exceed the amount you specified when you created the Virtual Machine. Values lower than 64 MB probably won't work.You can adjust the Virtual Machine memory as necessary.

Configuring Maximum Memory
virsh setmaxmem  [domain-name | domain-id | domain-uuid] [count]

You must specify the [count] in kilobytes. Note that the new count cannot exceed the amount
you specified when you created the Virtual Machine. Values lower than 64 MB probably won't work. The maximum memory doesn't affect the current use of the Virtual Machine (unless the new value is lower which should shrink memory usage).

BASIC MANAGEMENT OPTIONS


Resource Management Options

setmem         : changes the allocated memory.
setmaxmem  : changes maximum memory limit
setvcpus        : changes number of virtual CPUs.
vcpuinfo         : domain vcpu information.
vcpupin          : control the domain vcpu affinity.

Monitoring and troubleshooting Options

version        : show version
dumpxml        : domain information in XML
nodeinfo        : node information

virsh command output

The following are example outputs from common virsh commands:
the list command:
virsh # list

Id  Name                 State
----------------------------------
0   Domain-0             running
13  r5b2-mySQL01         blocked

the dominfo domain command:
virsh # dominfo r5b2-mySQL01

Id:             13
Name:           r5b2-mySQL01
UUID:           4a4c59a7-ee3f-c781-96e4-288f2862f011
OS Type:                 linux
State:          blocked
CPU(s):         1
CPU time:               11.0s
Max memory:     512000 kB
Used memory:    512000 kB

the domstate domain command:

virsh # domstate r5b2-mySQL01
blocked

the domuuid domain command:

virsh # domuuid r5b2-mySQL01
4a4c59a7-ee3f-c781-96e4-288f2862f011

the vcpuinfo domain command:

virsh # vcpuinfo r5b2-mySQL01
VCPU:           0
CPU:            0
State:          blocked
CPU time:       0.0s
CPU Affinity:   yy

the dumpxml domain command:

virsh # dumpxml r5b2-mySQL01
<domain type='xen' id='13'>
            <name>r5b2-mySQL01</name>
            <uuid>4a4c59a7ee3fc78196e4288f2862f011</uuid>
            <bootloader>/usr/bin/pygrub</bootloader>
            <os>
                                 <type>linux</type>
                                 <kernel>/var/lib/xen/vmlinuz.2dgnU_</kernel>
                                 <initrd>/var/lib/xen/initrd.UQafMw</initrd>
                                <cmdline>ro root=/dev/VolGroup00/LogVol00 rhgb quiet</cmdline>
            </os>
            <memory>512000</memory>
            <vcpu>1</vcpu>
            <on_poweroff>destroy</on_poweroff>
            <on_reboot>restart</on_reboot>
            <on_crash>restart</on_crash>
            <devices>
                                <interface type='bridge'>
                                                     <source bridge='xenbr0'/>
                                                    <mac address='00:16:3e:49:1d:11'/>
                                                     <script path='vif-bridge'/>
                                 </interface>
                                 <graphics type='vnc' port='5900'/>
                                 <console tty='/dev/pts/4'/>
            </devices>

the version domain command:

virsh # version
Compiled against library: libvir 0.1.7
Using library: libvir 0.1.7
Using API: Xen 3.0.1
Running hypervisor: Xen 3.0.0