Wednesday, December 8, 2010

Red Hat Enterprise Linux 6 Technical Details: What's New


Red Hat Enterprise Linux 6, the latest release of Red Hat's trusted datacenter platform, delivers advances in application performance, scalability, and security. With Red Hat Enterprise Linux 6, you can deploy physical, virtual, and cloud computing within your datacenter, reducing complexity, increasing efficiency, and minimizing administration overhead while leveraging technical skills and operational know-how. Red Hat Enterprise Linux 6 is an ideal platform to translate current and future technology innovations into the best value and scale for IT solutions.

Efficiency, Scalability, and Reliability

Scalability

  • Red Hat Enterprise Linux 6 supports more sockets, more cores, more threads, and more memory.

Efficient Scheduling

  • The CFS schedules the next task to be run based on which task has consumed the least time, task prioritization, and other factors. Using hardware awareness and multi-core topologies, the CFS optimizes task performance and power consumption.

Reliability, Availability, and Serviceability (RAS)

  • RAS hardware-based hot add of CPUs and memory is enabled.
  • When supported by machine check hardware, the system can recover from some previously fatal hardware errors with minimal disruption.
  • Memory pages with errors can be declared as "poisoned", and will be avoided.

Filesystems

  • The new default file system, ext4, is faster, more robust, and scales to 16TB.
  • The Scalable File System Add-On contains the XFS file system, which scales to 100TB.
  • The Resilient Storage Add-On includes the high availability, clustered GFS2 file system.
  • NFSv4 is significantly improved over NFSv3, and is backwards compatible.
  • Fuse allows filesystems to run in user space allowing testing and development on newer fused-based filesystems (such as cloud filesystems).

High Availability

  • The web interface based on Conga has been re-designed for added functionality and ease of use.
  • The cluster group communication system, Corosync, is mature, secure, high performance, and light-weight.
  • Nodes can re-enable themselves after failure without administrative intervention using unfencing.
  • Unified logging and debugging simplifies administrative work.
  • Virtualized KVM guests can be run as managed services which enables fail-over, including between physical and virtual hosts.
  • Centralized configuration and management is provided by Conga.
  • A single cluster command can be used to manage system logs from different services, and the logs have a consistent format that is easier to parse.

Power Management

  • The tickless kernel feature keeps systems in the idle state longer, resulting in net power savings.
  • Active State Power Management and Aggressive Link Power Management provide enhanced system control, reducing the power consumption of I/O subsystems. Administrators can actively throttle power levels to reduce consumption.
  • Realtime drive access optimization reduces filesystem metadata write overhead.

Unprecedented Resource Management

System Resource Allocation

  • Cgroups organize system tasks so that they can be tracked, and so that other system services can control the resources that cgroup tasks may consume (Partitioning). Two user-space tools, cgexec and cgclassify, provide easy configuration and management of cgroups.
  • Cpuset applies CPU resource limits to cgroups, allowing processing performance to be allocated across tasks.
  • The memory resource controller applies memory resource limits to cgroups.
  • The network resource controller applies network traffic limits to cgroups.

Storage

  • A snapshot of a logical volume may be merged back into the original logical volume, reverting changes that occurred after the snapshot.
  • Mirror logs of regions that need to be synchronized can be replicated, supporting high availability.
  • LVM hot spare allows the behavior of a mirrored logical volume after a device failure to be explicitly defined.
  • DM-Multipath allows paths to be dynamically selected based on queue size or I/O time data.
  • Very large SAN-based storage is supported.
  • Automated I/O alignment and self-tuning is supported.
  • Filesystem usage information is provided to the storage device, allowing administrators to use thin provisioning to allocate storage on-demand.
  • SCSI and ATA standards have been extended to provide alignment and I/O hints, allowing automated tuning and I/O alignment.
  • DIF/DIX provides better integrity checks for application data.

Networking

  • UDP Lite tolerates partially corrupted packets to provide better service for multimedia protocols, such as VOIP, where partial packets are better than none.
  • Multiqueue Networking increases processing parallelism for better performance from multiple processors and CPU cores.
  • Large Receive Offload (LRO) and Generic Receive Offload (GRO) aggregate packets for better performance.
  • Support for Data Center Bridging includes data traffic priorities and flow control for increased Quality of Service.
  • New support for software Fiber Channel over Ethernet (FCoE) is provided.
  • iSCSI partitions may be used as either root or boot filesystems.
  • IPv6 is supported.

Designed-In Security

Access Control

  • SELinux policies have been extended to more system services.
  • SELinux sandboxing allows users to run untrusted applications safely and securely.
  • File and process permissions have been systematically reduced whenever possible to reduce the risk of privilege escalation.
  • New utilities and system libraries provide more control over process privileges for easily managing reduced capabilities.
  • Walk-up kiosks (as in banks, HR departments, etc.) are protected by SELinux access control, with on-the-fly environment setup and take-down, for secure public use.
  • Openswan includes a general implementation of IPsec that works with Cisco IPsec.

Enforcement and Verification of Security Policies

  • OpenScap standardizes system security information, enabling automatic patch verification and system compromise evaluation.

Identity and Authentication

  • The new System Security Services Daemon (SSSD) provides centralized access to identity and authentication resources, enables caching and offline support.
  • OpenLDAP is a compliant LDAP client with high availability from N-way MultiMaster replication, and performance improvements.

Stable Application Development and Production Platform

Web Infrastructure

  • This release of Apache includes many improvements, see Overview of new features in Apache 2.2
  • A major revision of Squid includes manageability and IPv6 support
  • Memcached 1.4.4 is a high-performance and highly scalable, distributed, memory-based object caching system that enhances the speed of dynamic web applications.

Java

  • OpenJDK 6 is an open source implementation of the Java Platform Standard Edition (SE) 6 specification. It is TCK-certified based on the IcedTea project, and the implementation of a Java Web Browser plugin and Java web start removes the need for proprietary plugins.
  • Tight integration of OpenJDK and Red Hat Enterprise Linux includes support for Java probes in SystemTap to enable better debugging for Java.
  • Tomcat 6 is an open source and best-of-breed application server running on the Java platform. With support for Java Servlets and Java Server Pages (JSP), Tomcat provides a robust environment for developing and deploying dynamic web applications.

Development

  • Ruby 1.8.7 is included, and Rails 3 supports dependencies.
  • Version 4.4 of gcc includes OpenMP3 conformance for portable parallel programs, Integrated Register Allocator, Tuples, additional C++0x conformance implementations, and debuginfo handling improvements.
  • Improvements to the libraries include malloc optimizations, improved speed and efficiency for large blocks, NUMA considerations, lock-free C++ class libraries, NSS crypto consolidation for LSB 4.0 and FIPS level 2, and improved automatic parallel mode in the C++ library.
  • Gdb 7.1.29 improvements include C++ function, class, templates, variables, constructor / destructor improvements, catch / throw and exception improvements, large program debugging optimizations, and non-blocking thread debugging (threads can be stopped and continued independently).
  • TurboGears 2 is a powerful Internet-enabled framework that enables rapid web application development and deployment in Python.
  • Updates to the popular web scripting and programming languages PHP (5.3.2), Perl (5.10.1) include many improvements.

Application Tuning

  • SystemTap uses the kernel to generate non-intrusive debugging information about running applications.
  • The tuned daemon monitors system use and uses that information to automatically and dynamically adjust system settings for better performance.
  • SELinux can be used to observe, then tighten application access to system resources, leading to greater security.

Databases

  • PostgreSQL 8.4.4 includes many improvements, please see PostgreSQL 8.4 Feature Listfor details.
  • MySQL 5.1.47 improvement are listed here: What Is New in MySQL 5.1.
  • SQLite 3.6.20 includes significant performance improvements, and many important bug fixes. Note that this release has made incompatible changes to the internal OS interface and VFS layers (compared to earlier releases).

System API / ABI Stability

  • The Red Hat Enterprise Linux: Application Compatibility Specification document defines stable, public, system interfaces for the full ten-year life cycle of Red Hat Enterprise Linux 6. During that time, applications will not be affected by security errata or service packs, and will not require re-certification. Backward compatibility for the core ABI is maintained across major releases, allowing applications to span subsequent releases.

Integrated Virtualization

Kernel-Based Virtualization

  • The KVM hypervisor is fully integrated into the kernel, so all Red Hat Enterprise Linux system improvements benefit the virtualized environment.
  • The application environment is consistent for physical and virtual systems.
  • Deployment flexibility, provided by the ability to easily move guests between hosts, allows administrators to consolidate resources onto fewer machines during quiet times, or free up hardware for maintenance downtime.

Leverages Kernel Features

  • Hardware abstraction enables applications to move from physical to virtualized environments independently of the underlying hardware.
  • Increased scalability of CPUs and memory provides more guests per server.
  • Block storage benefits from selectable I/O schedulers and support for asynchronous I/O.
  • Cgroups and related CPU, memory, and networking resource controls provide the ability to reduce resource contention and improve overall system performance.
  • Reliability, Availability, and Serviceability (RAS) features (e.g., hot add of processors and memory, machine check handling, and recovery from previously fatal errors) minimize downtime.
  • Multicast bridging includes the first release of IGMP snooping (in IPv4) to build intelligent packet routing and enhance network efficiency.
  • CPU affinity assigns guests to specific CPUs.

Guest Acceleration

  • CPU masking allows all guests to use the same type of CPU.
  • SR-IOV virtualizes physical I/O card resources, primarily networking, allowing multiple guests to share a single physical resource.
  • Message signaled interrupts deliver interrupts as specific signals, increasing the number of interrupts.
  • Transparent hugepages provides significant performance improvements for guest memory allocation.
  • Kernel Same Page (KSM) provides reuse of identical pages across virtual machines (known as deduplication in the storage context).
  • The tickless kernel defines a stable time model for guests, avoiding clock drift.
  • Advanced paravirtualization interfaces include non-traditional devices such as the clock (enabled by the tickless kernel), interrupt controller, spinlock subsystem, and vmchannel.

Security

  • In virtualized environments, sVirt (powered by SELinux) protects guests from one another

Microsoft Windows Support

  • Windows WHQL-certified drivers enable virtualized Windows systems, and allow Microsoft customers to receive technical support for virtualized instances of Windows Server

Enterprise Manageability

Installation, Updates, and Deployment

  • Anaconda supports installation of a “minimal platform” as a specific server installation, or as a strategy for reducing the number of software packages to increase security.
  • Red Hat Network and Red Hat Network Satellite continue to provide management, provisioning, and monitoring for large deployments.
  • Installation options have been reorganized into “workload profiles” so that each system installation will provide the right software for specific tasks.
  • Dracut, a replacement for mkinitrd, minimizes the impact of underlying hardware changes, is more maintainable, and makes it easier to support third party drivers.
  • The new yum history command provides information about yum transactions, and supports undo and redo of selected operations.
  • Yum and RPM offer significantly improved performance.
  • RPM signatures use the Secure Hash Algorithm (SHA256) for data verification and authentication, improving security.
  • Storage devices can be designated for encryption at installation time, protecting user and system data. Key escrow allows recovery of lost keys.
  • Standards Based Linux Instrumentation for Manageability (SBLIM) manages systems using Web-Based Enterprise Management (WBEM).
  • ABRT enhanced error reporting speeds triage and resolution of software failures.

Routine Task Delegation

  • PolicyKit allows administrators to provide users access to privileged operations, such adding a printer or rebooting a desktop, without granting administrative privileges.

Printing

  • Improvements include better printing, printer discovery, and printer configuration services from cups and system-config-printer.
  • SNMP-based monitoring of ink and toner supply levels and printer status provides easier monitoring to enable efficient inventory management of ink and toner cartridges.
  • Automatic PPD configuration for postscript printers, where PPD option values are queried from printer, are available in CUPS web interface.

Microsoft Interoperability

  • Samba improvements include support for Windows 2008R2 trust relationships: Windows cross-forest, transitive trust, and one-way domain trust.
  • Applications can use OpenChange to gain access to Microsoft Exchange servers using native protocols, allowing mail clients like Evolution to have tighter integration with Exchange servers.

Monday, November 22, 2010

zenity Installation

zenity is a rewrite of gdialog, the GNOME port of dialog which allows you to display dialog boxes from the commandline.

zenity is a rewrite of gdialog, the GNOME port of dialog which allows you to display dialog boxes from the commandline and shell scripts.

If you understand, things are just as they are. If you don't understand, things are just as they are.

The simplest way to compile this package is:

1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself.

Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for.

2. Type `make' to compile the package.

3. Optionally, type `make check' to run any self-tests that come with the package.

4. Type `make install' to install the programs and any data files and documentation.

5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution.
Requirements:

· scrollkeeper
· intltool
· gtk+-2.0
· libglade-2.0
· libgnomecanvas-2.0

Bash Scripting

Introduction

Linux Shell

Computer understand the language of 0's and 1's called binary language. Shell is a special program which accepts instruction or commands in English and if its a valid command, it passes the command to the kernel. Shell is not part of system kernel, but uses the system kernel to execute programs, create files etc.

Shell Script

Normally shells are interactive. It means shell accept command from you (via keyboard) and execute them. But if you use command one by one (sequence of 'n' number of commands) , the you can store this sequence of command to text file and tell the shell to execute this text file instead of entering the commands. This is know as shell script.

How to write shell script

  • Write shell script with a text example (for example vi).
  • set execute permission: chmod +x your-script-name
  • Execute script:bash your-script-name or ./your-script-name
Example
$vi first.sh
#
# My first shell script
#
clear
echo "first shell script"
$chmod +x first.sh
$./first.sh

Basics

Variables

In Linux (Shell), there are two types of variable:
  • System variables - Created and maintained by Linux itself. This type of variable defined in CAPITAL LETTERS.
  • User defined variables (UDV) - Created and maintained by user. This type of variable defined in lower letters.
#!/bin/bash
 
x=10            #NOT x = 10 no spaces
X=20            #variables are case sensitive
$y=             #NULL variable
echo "x = $x"
echo "X = $X"
echo "y = $y"

Comments

#!/bin/bash
# This line is a comment.
echo "A comment will follow." # Comment here.
echo "The # here does not begin a comment."
echo 'The # here does not begin a comment.'
echo The \# here does not begin a comment.
echo The # here begins a comment.
 
echo ${PATH#*:}       # Parameter substitution, not a comment.
echo $(( 2#101011 ))  # Base conversion, not a comment.

Quotes

  • Double Quotes: " " -Anything enclose in double quotes removed meaning of that characters (except \ and $).
  • Single quotes: ' ' - Enclosed in single quotes remains unchanged.
  • Back quote: ` ` - To execute command

Shell Built in Variables

~ Shell Built in Variables~ Meaning
$#Number of command line arguments.
$?Exit Status
$*string that contains all arguments to shell
$@Same as above, except when quoted.
$-Option supplied to shell
$$PID of shell
$!PID of last started background process (started with &)

Input - Output redirection

Redirection symbols
  • >: To output Linux-commands result to file.
  • »: To output Linux-commands result to END of file.
  • <: To take input to Linux-command from file instead of keyboard.
Example 1
#!/bin/bash
clear
echo "ls > file_list"
ls > file_list
 
echo "ls -la >> file_list"
ls -la >> file_list
 
echo "cat < file_list"
cat < file_list
Example 2
$cat > sname
vivek
ashish
zebra
babu
Press CTRL + D to save.
$ sort < sname > sorted_names
$ cat sorted_names
Example 3
$ tr "[a-z]" "[A-Z]" < sname > cap_names
$ cat cap_names
Example 4
$ sort > new_sorted_names < sname
$ cat new_sorted_names

Pipes

A pipe is a way to connect the output of one program to the input of another program without any temporary file.
Example
$ ls |
$ who | sort
$ who | sort > user_list
$ who | wc -l
$ ls -l | wc -l
$ who | grep chrys

Filter

If a Linux command accepts its input from the standard input and produces its output on standard output is know as a filter. A filter performs some kind of process on the input and gives output.
Example
Suppose you have file called 'hotel.txt' with 100 lines data, And from 'hotel.txt' you would like to print contains from line number 20 to line number 30 and store this result to file called 'hlist' then give command:
$ tail +20 < hotel.txt | head -n30 >hlist

Processes

A process is program (command given by user) to perform specific Job. In Linux when you start process, it gives a number to process (called PID or process-id), PID starts from 0 to 65535.

Language Constructs

if condition

Example 1: Mathematical Operators
#!/bin/bash
 
if test $1 -gt 0
then
        echo "$1 > 0"
fi
 
if test $1 -ge 0
then
        echo "$1 >= 0"
fi
 
if test $1 -eq 0
then
        echo "$1 == 0"
fi
 
if test $1 -ne 0
then
        echo "$1 != 0"
fi
 
if test $1 -lt 0
then
        echo "$1 < 0"
fi
 
if test $1 -le 0
then
        echo "$1 <= 0"
fi
Example 2: Logical Operators
if test $1 -lt 0
then
        echo "$1 < 0"
fi
 
if test $1 -le 0
then
        echo "$1 <= 0"
fi
Example 3: String Operators
string_null=""
string1="string1"
 
if [ $string_null -n ]
then
        echo "not null string"
else
        echo "null string"
fi
 
if [ $string_null -z ]
then
        echo "null string"
else
        echo "not null string"
fi
 
if [ "$string_null" == "$string1" ]
then
        echo "strings equal"
else
        echo "strings not equal"
fi
 
if [ "$string_null" != "$string1" ]
then
        echo "strings not equal"
else
        echo "strings equal"
fi
Example 4: Test for files and directories
#!/bin/bash
 
if test -s $1
then
        echo "$1 not empty file"
fi
 
if test -f $1
then
        echo "$1 normal file. Not a directory"
fi
if test -e $1
then 
    echo "$1 exists"
fi 
 
if test -d $1
then
        echo "$1 is directory and not a file"
fi
 
if test -r $1
then
        echo "$1 is read-only file"
fi
 
if test -x $1
then
        echo "$1 is executable"
fi

if…else…fi

If given condition is true then command1 is executed otherwise command2 is executed.
#!/bin/sh
#
# Script to see whether argument is positive or negative
#
if [ $# -eq 0 ]
then
echo "$0 : You must give/supply one integers"
exit 1
fi
 
if test $1 -gt 0
then
echo "$1 number is positive"
else
echo "$1 number is negative"
fi

Multilevel if-then-else

#
#!/bin/sh
# Script to test if..elif...else
#
if [ $1 -gt 0 ]; then
  echo "$1 is positive"
elif [ $1 -lt 0 ]
then
  echo "$1 is negative"
elif [ $1 -eq 0 ]
then
  echo "$1 is zero"
else
  echo "Opps! $1 is not number, give number"
fi

Loops

for loops

Example 1
$ cat > testfor
for i in 1 2 3 4 5
do
echo "Welcome $i times"
done
Example 2
#!/bin/sh
#
#Script to test for loop
#
#
if [ $# -eq 0 ]
then
echo "Error - Number missing form command line argument"
echo "Syntax : $0 number"
echo "Use to print multiplication table for given number"
exit 1
fi
n=$1
for i in 1 2 3 4 5 6 7 8 9 10 #or for ((  i =     0 ;  i <= 10;  i++  ))
do
echo "$n * $i = `expr $i \* $n`"
done

while loops

#!/bin/sh
#
#Script to test while statement
#
if [ $# -eq 0 ]
then
   echo "Error - Number missing form command line argument"
   echo "Syntax : $0 number"
   echo " Use to print multiplication table for given number"
exit 1
fi
n=$1
i=1
while [ $i -le 10 ]
do
  echo "$n * $i = `expr $i \* $n`"
  i=`expr $i + 1`
done

case

# if no vehicle name is given
# i.e. -z $1 is defined and it is NULL
#
# if no command line arg
 
if [ -z $1 ]
then
  rental="*** Unknown vehicle ***"
elif [ -n $1 ]
then
# otherwise make first arg as rental
  rental=$1
fi
 
case $rental in
   "car") echo "For $rental Rs.20 per k/m";;
   "van") echo "For $rental Rs.10 per k/m";;
   "jeep") echo "For $rental Rs.5 per k/m";;
   "bicycle") echo "For $rental 20 paisa per k/m";;
   *) echo "Sorry, I can not gat a $rental for you";;
esac

Debugging Shell Scripts

-v Print shell input lines as they are read.
-x After expanding each simple-command, bash displays the expanded value of PS4 system variable, followed by the command and its expanded arguments.

Advanced Features

Local and Global Shell variables

Local variable can be used in same shell only.
Global variables or environment variables are available in all shells. Commands env or printenv can be used to display environment variables.

Functions

Function is series of instruction/commands. Function performs particular activity in shell i.e. it had specific work to do or simply say task.
sum() 
{
    if [ -z "$2" ]; then
        echo $1
    else
        a=$1;
        shift;
        b=`sum $@`
        echo `expr $a + $b`
    fi
}

Reading from the shell

Example 1
#/bin/sh
 
echo "Name?"
read name
echo "Age?"
read age
echo "Hello $name, you are $age years old"
Example 2
# Script to create simple menus and take action according to that selected
# menu item
#
while :
 do
    clear
    echo "-------------------------------------"
    echo " Main Menu "
    echo "-------------------------------------"
    echo "[1] Show Todays date/time"
    echo "[2] Show files in current directory"
    echo "[3] Show calendar"
    echo "[4] Start editor to write letters"
    echo "[5] Exit/Stop"
    echo "======================="
    echo -n "Enter your menu choice [1-5]: "
    read yourch
    case $yourch in
      1) echo "Today is `date` , press a key. . ." ; read ;;
      2) echo "Files in `pwd`" ; ls -l ; echo "Press a key. . ." ; read ;;
      3) cal ; echo "Press a key. . ." ; read ;;
      4) vi ;;
      5) exit 0 ;;
      *) echo "Opps!!! Please select choice 1,2,3,4, or 5";
         echo "Press a key. . ." ; read ;;
 esac
done