Monday, 6 July 2015

how to configure pxe boot in linux

 Preboot Execution Environment (PXE)
here I am going to configure pxe server in linux centos6.6 (or) RHEL6.6  
 Server IP: 172.66.0.224
 Subnet 
Mask:255.255.255.0
 Server Hostname: server.example.in

Pre-requisites for configuring a PXE Server

     Step 1:- First configure dhcp server for dynamic ip allocation
     Step 2:- Http (or) FTP server
     Step 3:- tftp-server configuration [ Trivial File Transfer Protocol ]
  Disable Selinux

[root@server~]vim /etc/sysconfig/selinux

SELINUX=disabled

Check whether selinux is diabled or not
[root@server ~]# getenforce
Disabled

[root@server ~]# chkconfig iptables off


[root@server ~]# service iptables stop


Then Install the required packages
# yum -y install dhcp tftp-server syslinux http ftp vsftpd
[root@server ~]# cat /etc/dhcp/dhcpd.conf
#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.sample
#   see 'man 5 dhcpd.conf'
#
option domain-name "example.in";
option domain-name-servers server.example.in;
default-lease-time 600;
max-lease-time 7200;
authoritative;

subnet 172.66.0.0 netmask 255.255.255.0 {
range dynamic-bootp 172.66.0.10 172.66.0.25;
option broadcast-address 172.66.0.255;
option routers 172.66.0.1;

  allow booting;
        allow bootp;

        next-server 172.66.0.224;
        filename "pxelinux.0";
}

# service dhcpd restart
Shutting down dhcpd:                                       [  OK  ]
Starting dhcpd:                                                  [  OK  ]
 

create separate directory to save all the installation files

# mkdir -p /var/lib/tftpboot/images/rhel6

Prepare installation media on PXE server

# mount /dev/sr0 /var/lib/tftpboot/images/rhel6

 (or)


If you have an iso file, just mount it on this newly created directory using this command

[root@server ~]# mount -t iso9660 -o loop /ISOS/rhel-server-6.6-x86_64-dvd.iso
/var/lib/tftpboot/images/rhel6/

Configure HTTP/FTP server

HTTP server

Go To Line NO :262
ServerAdmin root@server.example.in

Go To Line NO :276
ServerName server.example.in:80
Go To Line NO :292
DocumentRoot "/var/lib/tftpboot/images"

<VirtualHost 172.66.0.224:80>
    ServerAdmin root@server.example.in
    DocumentRoot /var/lib/tftpboot/images
    ServerName server.example.in
</VirtualHost>

<Directory /var/lib/tftpboot/images>
AllowOverride None
Options Indexes FollowSymlinks
Order allow,deny
Allow from all
</Directory>

# /etc/init.d/httpd restart
Manually browse this url
http://172.66.0.224/rhel6

# vi /etc/vsftpd/vsftpd.conf
anonymous_enable=YES
anon_root=/var/lib/tftpboot/images

# /etc/init.d/vsftpd restart

Manually browse this url
ftp://172.66.0.224/rhel6

Configure TFTP server
# cp /usr/share/syslinux/pxelinux.0     /var/lib/tftpboot/
# cp /usr/share/syslinux/chain.c32     /var/lib/tftpboot/
# cp /usr/share/syslinux/menu.c32     /var/lib/tftpboot/
# cp /usr/share/syslinux/memdisk     /var/lib/tftpboot/
# cp /usr/share/syslinux/mboot.c32     /var/lib/tftpboot/

# mkdir /var/lib/tftpboot/pxelinux.cfg

# vim /var/lib/tftpboot/pxelinux.cfg/default
DEFAULT menu.c32
PROMPT 0
TIMEOUT 100
ONTIMEOUT Local

MENU TITLE PXE Menu

MENU seperator
LABEL RHEL 6.6
KERNEL images/rhel6/images/pxeboot/vmlinuz
APPEND initrd=images/rhel6/images/pxeboot/initrd.img
method=http://172.66.0.224/rhel6 devfs=nomount
APPEND initrd=images/rhel6/images/pxeboot/initrd.img
method=ftp://172.66.0.224/rhel6 devfs=nomount

[root@server ~]# cat /etc/xinetd.d/tftp
# default: off
# description: The tftp server serves files using the trivial file transfer \
#      protocol.  The tftp protocol is often used to boot diskless \
#      workstations, download configuration files to network-aware printers,
#      \
#      and to start the installation process for some operating systems.
service tftp
{
        socket_type              = dgram
        protocol            = udp
        wait                  = yes
        user                  = root
        server                       = /usr/sbin/in.tftpd
        server_args              = -s /var/lib/tftpboot
        disable                      = no
        per_source               = 11
        cps                   = 100 2
        flags                 = IPv4
}
[root@server ~]# /etc/init.d/xinetd restart
Stopping xinetd:                                           [  OK  ]
Starting xinetd:                                           [  OK  ]Configure DHCP server


[root@server ~]# chkconfig dhcpd on
[root@server ~]# chkconfig httpd on
[root@server ~]# chkconfig xinetd on
[root@server ~]# chkconfig vsftpd on



 Next we have to test your PXE server by boot a machine & select the option “Network Boot” from bios
Finally You should see the screen like this 








If you want to configure PXE with Kickstart Please follow with these step:- 



[root@server ~]# mkdir /var/lib/tftpboot/images/Kickstart



[root@server ~]# cp /root/anaconda-ks.cfg /var/lib/tftpboot/images/Kickstart/rhel-ks.cfg



[root@server ~]# chmod 644 /var/lib/tftpboot/images/Kickstart/rhel-ks.cfg



[root@server ~]# openssl passwd -1

Password:
Verifying - Password:
$1$A83yvaDO$y8kao5aS1FrDxWjl50o9c1

[root@server ~]# vim /var/lib/tftpboot/images/Kickstart/rhel-ks.cfg

#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Firewall configuration
firewall --disabled
# Install OS instead of upgrade
install
# Use network installation
url --url="http://172.66.0.224/rhel6"
# Root password
rootpw --iscrypted $1$tsz92mVC$.gXLh0Wu8PdmF5LvCFNG9.
# System authorization information
auth  --useshadow  --passalgo=sha512
# Use graphical install
graphical
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# SELinux configuration
selinux --disabled
# Installation logging level
logging --level=info
# Reboot after installation
reboot
# System timezone
timezone  Asia/Kolkata
# System bootloader configuration
bootloader --location=mbr
# Partition clearing information
clearpart --all  
# Disk partitioning information
part / --fstype="ext4" --size=10000
part /boot --fstype="ext4" --size=200
part swap --fstype="swap" --size=1000

%packages
@basic-desktop
@desktop-debugging
@desktop-platform
@fonts
@general-desktop
@graphical-admin-tools
@input-methods
@legacy-x
@remote-desktop-clients
@x11
abrt-gui
alacarte
audit-viewer
bitmap-fixed-fonts
bitmap-lucida-typewriter-fonts
bltk
byzanz
cjkuni-fonts-ghostscript
dvgrab
firstaidkit-gui
freerdp
gconf-editor
gedit-plugins
gnome-games
gnome-pilot
gnome-pilot-conduits
krb5-auth-dialog
libXmu
libXp
openmotif
openmotif22
oprofile-gui
pcp
policycoreutils-gui
qt-mysql
qt-odbc
qt-postgresql
qt3-MySQL
qt3-ODBC
qt3-PostgreSQL
rdesktop
rhythmbox-upnp
sabayon
sabayon-apply
seahorse-plugins
setroubleshoot
spice-client
spice-xpi
system-config-kickstart
system-config-lvm
tigervnc
tigervnc-server
totem-upnp
tsclient
vim-X11
vinagre
wireshark-gnome
xcb-util-image
xcb-util-keysyms
xcb-util-wm
xguest
xorg-x11-fonts-75dpi
xorg-x11-fonts-ISO8859-1-75dpi
xorg-x11-fonts-ISO8859-14-100dpi
xorg-x11-fonts-ISO8859-14-75dpi
xorg-x11-fonts-ISO8859-15-75dpi
xorg-x11-fonts-ISO8859-2-100dpi
xorg-x11-fonts-ISO8859-2-75dpi
xorg-x11-fonts-ISO8859-9-100dpi
xorg-x11-fonts-ISO8859-9-75dpi
xorg-x11-fonts-cyrillic
xorg-x11-fonts-ethiopic
xorg-x11-twm
xorg-x11-xdm
xrestop
xterm

%end

[root@server ~]# vim /var/lib/tftpboot/pxelinux.cfg/default
DEFAULT menu.c32
PROMPT 0
TIMEOUT 100
ONTIMEOUT Local

MENU TITLE PXE Menu

MENU seperator
LABEL RHEL 6.6
KERNEL images/rhel6/images/pxeboot/vmlinuz
#APPEND initrd=images/rhel6/images/pxeboot/initrd.img
method=http://172.66.0.224/rhel6 devfs=nomount
#APPEND initrd=images/rhel6/images/pxeboot/initrd.img
method=ftp://172.66.0.224/rhel6 devfs=nomount
APPEND initrd=images/rhel6/images/pxeboot/initrd.img
ks=http://172.66.0.224/Kickstart/rhel-ks.cfg ksdevice=eth0


Restart the Xinetd Service

[root@server ~]# /etc/init.d/xinetd restart

Stopping xinetd:  [ OK ]
Starting xinetd:    [ OK ]



Whatever machines you want to install OS boot a machine & select the option called “Network Boot” from bios
After booting it will show you a Screen like this









Tuesday, 2 June 2015

difference between soft and hard link in linux...........???

Hardlink


  • Hardlink is possible within the same filesystem

  • Hardlink pointing to the same inode

  • Hardlink cannot create a link for a directory

  • Hardlink does not break even if you change the name of the original file


Softlink (symlink)


  • Softlink is possible in a different filesystem

  • Softlink have different inode 

  • Softlink can be used to create a link for both directory & file

  • Softlink will break if you change the name of the original file because it resolves the name of the file each time you access it through the softlink.

Inode(Index Node):-

Inode is a data structure (or) it is a file structure on a file system, Each inode stores the attributes of the file system objects.Inode contains the following information about the file:-

  • Inode Number
  • File Change (or) Modify Time
  • Owner (user-id of the file) & (group-id of the file)
  • Size of the File 
  • Device ID (this identifies the device containing the file).
  • Disk Block Location
  • Number of links
  • Status flags

To create Softlink in linux:-

Use the following syntax:-
# ln -s <source-file> <link-file>

[root@lenovo ~]# ln -s /var/ftp/pub/file1.txt /softlink/file1.txt

[root@lenovo ~]# ll -ltrh /softlink/
lrwxrwxrwx. 1 root root 22 Jun  8 10:26 file1.txt -> /var/ftp/pub/file1.txt

To unlink the file in linux:-

Use the following syntax:-
# unlink <linkname>
[root@lenovo ~]# unlink /softlink/file1.txt


To create Hardlink in linux:-

Use the following syntax:-
#ln <source-file> <link-file>

[root@lenovo ~]# ln /var/ftp/pub/file2.txt /linkdir/file2.txt
[root@lenovo ~]# ls -li /var/ftp/pub/file2.txt
1181563 -rw-r--r--. 2 root root 0 Jun  8 10:50 /var/ftp/pub/file2.txt
[root@lenovo ~]# ls -li /linkdir/file2.txt
1181563 -rw-r--r--. 2 root root 0 Jun  8 10:50 /linkdir/file2.txt
[Note:-  see after creating hardlink both the files showing same inode number]

Tuesday, 28 April 2015

rsh configuration in linux

How to configure rsh in linux centos or redhat ..............????


This post shows you how to configure rsh in cluster environment

[root@lenovo ~]# yum install rsh rsh-server -y 

 Edit the configuration file for enabling rsh and rlogin

[root@lenovo ~]#vim /etc/xinetd.d/rsh

 service shell
 {
  socket_type             = stream
  wait                    = no
  user                    = root
  log_on_success          += USERID
  log_on_failure          += USERID
  server                  = /usr/sbin/in.rshd
  disable                 = no
 }
  you have to change only option "disable = no" .

 

[root@lenovo ~]# service xinetd restart 

 .rhosts file must be present in users home directory. This file allows a users to login without a password, Now i am going to create this file under root users home directory.

[root@lenovo ~]# vim ~/.rhosts
 

[root@lenovo ~]# cat ~/.rhosts
localhost
lenovo.example.com
client1.example.com
client2.example.com

 

[root@lenovo ~]# chmod 0600 ~/.rhosts

[root@lenovo ~]# vim /etc/securetty

Edit file /etc/securetty & append these entry

rsh 

rexec 

rlogin 

 

 


 

 


Friday, 17 April 2015

How to create GPT disk label in RHEL or CentOS....???error "sda Must have a GPT disk label"


GPT(GUID Partition Table)
MBR and GPT are two different ways of storing the partitioning information. In RHEL6 the default way of partitioning a harddisk is to use a MS-DOS disk label.This type of partitioning a hard disk is an old method.Unfortunately this way of partitioning does have some problems that is MBR works with disks up to 2TB, But it can't handle disks more than 2TB.

NOTE:- RHEL 6.3 or later the installer will automatically use GPT partitioning for disks larger than 2TB in size.

Have you ever seen this error "sda Must have a GPT disk label" while installing RHEL (or) CentOS

 
Disable UEFI Mode in your machine BIOS setup 

[OR] 

Another way you can use PARTED Utility to resolve this issue:-

parted is a command which is used for disk partitioning and partition resizing program.

First PRESS CTRL+ALT+F2 to go to terminal for running parted utility from GUI

# parted
(parted) print /dev/sda

(parted) select /dev/sda

(parted) mklabel gpt

(parted) yes

(parted) print /dev/sda

(parted) quit

 Finally PRESS CTRL+ALT+F1 for return back to GUI mode.

Monday, 13 April 2015

How to identify 64 bit processor in linux

[root@server Desktop]# grep flags /proc/cpuinfo | grep 'lm'

flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm arat epb xsaveopt pln pts dtherm fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid

[Note:- Check Flag Entry in above output "lm" If you see lm flag then you can able to run 64bit Operating System in your machine]

[root@server Desktop]# uname -m
x86_64

uname is a command used to print system information x86_64 means 64bit operating system, i686,i386 means 32 bit.
[ If your CPU is 64 bit machine then it will support both 32bit & 64bit operating system, But If your machine[CPU] is 32bit it will support only 32bit operating system not 64bit  ]

How to install and configure OpenMPI in linux

Message Passing Interface (MPI)

MPI is mostly used in High Performance Computing.The Message Passing Interface (MPI) is a library specification that allows HPC to pass information between its various nodes and clusters. Also call MPI "is a message-passing application programmer interface, It is a language-independent used to program parallel computers.

Downloading OpenMPI From here


http://www.open-mpi.org/software/ompi/v1.8/

# wget http://www.open-mpi.org/software/ompi/v1.8/downloads/openmpi-1.8.4.tar.gz

# tar -xvzf openmpi-1.8.4.tar.gz

# ./configure --prefix=/opt/openmpi

# make

# make install

Setting Up Environment Variables


# vim .bashrc

export PATH=/opt/openmpi/bin:$PATH

export LD_LIBRARY_PATH=/opt/openmpi/lib:$LD_LIBRARY_PATH 

To view your path type the following command

# echo $PATH

How to run mpi program in parallel computing is mentioned below

[user@lenovo ~]$ mpirun -np 4 -hostfile hostfile ./helloworld.sh



Wednesday, 8 April 2015

How to find processor speed on Linux OS

The File called cpuinfo_max_freq contains the maximum frequency in KHz

[root@lenovo ~]# cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq
3000000

(OR)

[root@lenovo ~]# cat /proc/cpuinfo
processor    : 0
vendor_id    : GenuineIntel
cpu family    : 6
model        : 23
model name    : Intel(R) Core(TM)2 Duo CPU     E8400  @ 3.00GHz
stepping    : 6
cpu MHz        : 2000.000
cache size    : 6144 KB
physical id    : 0
siblings    : 2
core id        : 0
cpu cores    : 2
apicid        : 0
initial apicid    : 0
fpu        : yes
fpu_exception    : yes
cpuid level    : 10
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 lahf_lm dts tpr_shadow vnmi flexpriority
bogomips    : 5984.89
clflush size    : 64
cache_alignment    : 64
address sizes    : 36 bits physical, 48 bits virtual
power management:

processor    : 1
vendor_id    : GenuineIntel
cpu family    : 6
model        : 23
model name    : Intel(R) Core(TM)2 Duo CPU     E8400  @ 3.00GHz
stepping    : 6
cpu MHz        : 3000.000
cache size    : 6144 KB
physical id    : 0
siblings    : 2
core id        : 1
cpu cores    : 2
apicid        : 1
initial apicid    : 1
fpu        : yes
fpu_exception    : yes
cpuid level    : 10
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 lahf_lm dts tpr_shadow vnmi flexpriority
bogomips    : 5984.89
clflush size    : 64
cache_alignment    : 64
address sizes    : 36 bits physical, 48 bits virtual
power management:

(OR)

[root@lenovo ~]# dmesg | grep CPU
SMP: Allowing 2 CPUs, 0 hotplug CPUs
NR_CPUS:4096 nr_cpumask_bits:2 nr_cpu_ids:2 nr_node_ids:1
PERCPU: Embedded 31 pages/cpu @ffff880002200000 s94872 r8192 d23912 u1048576
CPU: Physical Processor ID: 0
CPU: Processor Core ID: 0
mce: CPU supports 6 MCE banks
CPU0: Thermal monitoring handled by SMI
CPU0: Intel(R) Core(TM)2 Duo CPU     E8400  @ 3.00GHz stepping 06
CPU1: Thermal monitoring handled by SMI
Brought up 2 CPUs
microcode: CPU0 sig=0x10676, pf=0x1, revision=0x60c
microcode: CPU1 sig=0x10676, pf=0x1, revision=0x60c
microcode: CPU0 updated to revision 0x60f, date = 2010-09-29
microcode: CPU1 updated to revision 0x60f, date = 2010-09-29