Thursday, 6 October 2011

Grep Command in Linux(RHEL5 and RHEL6) and Regular Expressions

Grep Command is use to extract keyword from specific files in Linux Operating systems.
Grep command can be use with pipes to work effectively.


Friday, 23 September 2011

Fedora 15 Bugs And There Troubleshooting commands

Unable to Run Internet Graphically using NetworkManager(PPP Connection) in Fedora15

Hi students,
Welcome to the new world of Fedora with F15 in market but with many new features in graphics,GNOME 3 in F15 we have new security features as as well in some networking services or better to say in networking daemons and one of that networking daemon is "pppd".This "pppd" daemon is responsible for running internet connection using mobile or data card like airtel internet connection through mobile phone or using Tata Photon or Relience NetConnect to connect your F15 to internet.Now in Fedora15 this daemon is actually restricted by Selinux security context and you will not be able to connect to your device for internet connectivity .So today I will tell you guys how to overcome this restriction in F15.


Actually when you access internet connection using "pppd" then Selinux will prevent /usr/sbin/pppd from reading the lnk_file /var/lock because of different Selinux Context.The default context type label of /var/lock is var_lock_t  which is actually denied by Selinux in enforcing mode.


So you need to change the context type of /var/lock file using following commands:-

Login with  root to do the following task.....

1. chcon -t  pppd_etc_t  /var/lock


2. semanage fcontext -a -t pppd_etc_t '/var/lock'

3. restorecon -v '/var/lock'

Finally remove your Internet device and plug-in again and check your connectivity .

Now enjoy with your Internet connection
############################# ENJOY#######################################










Saturday, 25 June 2011

How to schedule tasks in Linux/RHEL6/RHEL5(Crontab configuration)

Crontab is use to define a job which will run at a particular time period.Crontab is use to define jobs or tasks which root wants to run at regular period of time for example daily jobs,weekly jobs,hourly jobs or monthly jobs.For single time schedule tasks we can use "AT" command but the difference between AT command and Crontab is that in AT command we cannot define jobs to run daily,hourly,weekly,monthly .

Now to edit Crontab we need to know about few files before define a job.
/etc/cron.allow
/etc/cron.deny

These two files are use to define Cronjobs Access Control

  • If neither /etc/cron.allow nor /etc/cron.deny exists only root is allowed to define a cronjobs.
  • If only /etc/cron.deny exists in that case all users except those listed in this file can define cronjobs.
  • If only /etc/cron.allow exists in that case root and all the users listed in this file can define cronjobs.
  • If both file exists then cron.deny is ignored.
Note:-- By default /etc/cron.deny file exits but its empty that means every user is allow to define a cronjob.Now if you create a new empty /etc/cron.allow file then none of the user will be allow to define a cronjob only root can define.

Steps to define a new cronjob:-

1.  Login with root user and type in gnome-terminal or virtual-terminal the following command
      crontab -e
2. This command open a empty file with vi editor.Now you need to type the time and the comand in this blank file but with a specific syntax.



Friday, 24 June 2011

Virtualization In RHEL-5 orRHEL-6 (REDHAT ENTERPRISE LINUX)

Virtualization is the main topic now a days everybody is thinking about.I must tell you if you want to go out for Virtualization than RHEL (Redhat Enterprise Linux) is best Operating system which can solve all your needs regarding Virtualization.


RHEL-6 is best Linux OS for Desktop Virtualization.In RHEL6 we have KVM packages which make easier for linux guys to install multiple OS in Single linux Base machine with worrying about product key like we had in VMware Workstation. So in this documentation i will tell you the steps to configure basic KVM virtualization in RHEL6.....

Steps To Configure KVM Based Virtual Machines in RHEL6.

 

Thursday, 16 June 2011

How to Repair Corrupted bashrc file in RHEL6

Hi students,
As now a days you are using RHEL6 and i want to let you that RHEL6 is totally different from RHEL5 in terms of boot process and also in service handling and some others.But today i want to let you how to repair the corrupted .bashrc of root user or /etc/bashrc which is actually the global file for every user.Actually what every Rhel5 linux admin think when we have corrupted bashrc file and we cant login to my root account from runlevel 3 or runlevel 5 because may be somebody put some nasty commands like init 6 in my root bashrc file or in /etc/bashrc file so now what a rhel5 admin do ,he reboot the machine and move to the single user mode .But I want to tell you one thing that in RHEL6 in single user mode bashrc file works so if your bashrc file is corrupted or having some nasty commands so you cannot even access your single user mode.So now my tips will help you.

Now in RHEL6 you need to move to emergency mode by typing the following commands:-

note:->>>(Actually there is no emergency mode command in RHEL6 like we have in RHEL5 ,in RHEL5 we have to type emergency in grub screen in RHEL-5)

1. Reboot the machine and Press any to stop the boot process at grub screen
2. Now when you are with black/blue grub screen ,press e to edit the grub .
3. Now when you press e to edit the grub ,you have three lines with you ,now move to second line and again press e to edit the second line.
4. Now you need to add init=/bin/bash at the end of the line after a single space.But remember one thing there should not be any space in the above option,it should be init=/bin/bash
5. Ater this press enter and then b to boot the machine .
6. Now after booting you have a single user shell but remember one thing you are workng in emergency mode so you file system is in readonly mode.
7. So now you need to make your filesystem read-write mode by the following command:-
    mount -o remount,rw /

8. Now you have read-write permission on your / filesystem,so run the following command to open your bashrc file or /etc/bashrc file.

      vim .bashrc

       or
      vim /etc/bashrc

and remove the nasty or any line which corrupts your bashrc file or for example if somebody puts init 6 in your bashrc file and your system is continously reboots, so now you can remove that option or lines from your bashrc files.


9. After this reboot the pc and enjoy....

Wednesday, 15 June 2011

How To Repair Corrupted Grub of RHEL 6


Hi students,

As you are bit in touch with linux and you want to install linux but some times when you install linux and you get some Bootmanager is corrupted or grub > error when you dual boot your linux with any other windows os .So today i will let you know how you can remove this error and boot your both the OSes.


1. Insert the dvd(or 1st cd ) of RHEL6.
2. when your linux cd boot your pc and you have multiple option ,but you need to select a option which says
Recue environment




3. Now select the language and other appropriate options

4. Then select continue to mount your partition in read and write mode.

5. After mounting your partition in read and write mode type the command given below when you have sh shell prompt

chroot /mnt/sysimage

6. Now type this command

grub-install /dev/hda (if you have sata hard disk then use sda in place of hda)

7. Type exit

8. Type exit again

9. System will Reboot !!! enjoy

How To Repair Corrupted Grub of RHEL 5


Hi students,

As you are bit in touch with linux and you want to install linux but some times when you install linux and you get some Bootmanager is corrupted or grub > error when you dual boot your linux with any other windows os .So today i will let you know how you can remove this error and boot your both the OSes.


1. Insert the dvd(or 1st cd ) of RHEL5.
2. when your linux cd boot your pc and you have a prompt like this

boot:_

Write linux rescue command here

boot: linux rescue

3. Now select the language and other appropriate options

4. Then select continue to mount your partition in read and write mode.

5. After mounting your partition in read and write mode type the command given below when you have sh shell prompt

chroot /mnt/sysimage

6. Now type this command

grub-install /dev/hda (if you have sata hard disk then use sda in place of hda)

7. Type exit

8. Type exit again

9. System will Reboot !!! enjoy

How To configure PXE server in Linux(RHEL5-RHEL6)

PXE server helps to install the operating systems through network boot. Its very useful and very time saving.

This post tells how to configure a PXE Server in Redhat linux and other variants.
###PXE Configuration###
To configure PXE we need to install following Packages.
dhcp + tftp + syslinux

###Install the packages###
#yum -y install dhcp*
#yum -y install tftp*
#yum -y install syslinux*

###Open the dhcp configuration file and add the following###
#vi /etc/dhcpd.conf
subnet 192.168.1.0
netmask 255.255.255.0
gateway 192.168.1.1
range From 192.168.1.128 To 192.168.1.254

allow booting;
allow bootp;
next-server 192.168.1.3; (ip of server)
filename "pxelinux.0";
:wq

###Copy the pxlinux.0 file to /tftpboot###
#cd /tftpboot
#cp /usr/lib/syslinux/pxelinux.0 .

###Copy the kernel and initrd.img files from DVD[/media/images/pxeboot/] to /tftpboot/###
#cp -rv /media/images/pxeboot/initrd.img .
#cp -rv /media/images/pxeboot/vmlinuz .

###Add kickstart file to /tftpboot/###
#vi ks.cfg Only if wanted. Otherwise you have to do attended remote installation.
nfs --server 192.168.1.2 --dir /media/rhel5 Just an example line!

###Create PXE configuration directory###
#mkdir /tftpboot/pxelinux.cfg/
#cd /tftpboot/pxelinux.cfg/

###Create PXE configuration file### That is ###/tftpboot/pxelinux.cfg/default file###
#vi default
PROMPT 1 To give the prompt [boot: ]. Otherwise it will automatically install the default label
DISPLAY boot.msg It shows the 1st window for options.
TIMEOUT 100 Wait for the choice this much time and after that will continue with deafult.
DEFAULT main Defines the main installation method. The default one.
ONERROR LOCALBOOT 0
LABEL main The declaration of main label. In case if we didint give choice, this will execute.
KERNEL vmlinuz If in /tftpboot/ directory. If it is in /tftpboot/RHEL5-NFS u've to give RHEL5-NFS/vmlinuz
APPEND initrd=initrd.img Path of initrd.img.
LABEL 1
KERNEL Kernel location of choice 1 in boot.msg
APPEND Location of initrd.img

An Example
kernel RHEL5-NFS/vmlinuz
append initrd=RHEL5-NFS/initrd.img ramdisk_size=6457 method=nfs:192.168.1.2:/media/rhel5 ip=dhcp
LABEL 2
settings for option 2.
:wq

###Creating options message for the PXE boot###
#cd /tftpboot/
#vi boot.msg
##########################
Installing RHEL5 You can design this as you like.
##########################

1. RHEL5 NFS
2. RHEL5 FTP Set all these according to the entries in /tftpboot/pxelinux.cfg/default
3. RHEL5 HTTP
4. RHEL5 RESCUE

##########################

NOTE: Give execute permission for all files in /tftpboot/

###Restart the services###
#service dhcpd start
#service xinetd start
#chkconfig tftp on
#chkconfig dhcpd on
#chkconfig xinetd on.



########Need comments for updates and suggestions #######

Tuesday, 14 June 2011

How Check the CPU Temperature and Control The Temperature ....

Steps to  Solve CPU Overheating .

  • 1. Stop Overclocking your CPU
  • 2. Make sure your Heat Sink is placed properly above the processor.
  • 3. Clean the Processor fan, Heat Sink and other peripherals.
  • 4. Use High Speed fans.
  • 5. Use CPU Heat Sink Paste in the processor.
  • 6. Make sure your didnot restrict the speed of CPU fan in BIOS.
  • 7. Check your SMPS.
  • 8. Use proper ventilation in your room.

Monday, 13 June 2011

HOW TO INSTALL RHEL6 IN A PC

Hi Students,
                    So today we are planning to to install RHEL6 on a machine,but firstly i would like to update you all that the hardware requirement for RHEL-6 is totally different from RHEL-5.So firstly we see what is the hardware requirement for RHEL-6:-
  •  Memory Requirement for X86  Architecture:-
    Minimum RAM for Text mode >> 384MB
    Minimum RAM for Gui mode >> 400MB
    Recommended  RAM for Gui(graphical installation)  >> 512MB
    • CPU Requirement For X86 Architecture :-
    Virtualization Technology(VT) supported Processors should use to go for RHEL6 with Virtualization support.
    Core2duo with VT support,iCore3,iCore5,iCore7,Dell Vostro supports RHEL6 with Virtualization support.



    Note:- >> If you have only 64 bit machine i.e core2 duo or any other 64 bit machine without VT support so you can only install RHEL-6 but you cannot install KVM(Kernal Virtual Machine) in RHEL-6 if you have no VT support in your Processor.