Wednesday, December 25, 2013

KVM Virsh Console Access to Linux VM – RHEL 6

The console command within virsh is an excellent feature to have working for your virtual environments. For example, it can be really handy to watch a machine boot without launching a GUI tool ie. virt-manager. I personally find virsh console access a quicker way to configure networking settings which may not be able to be achieved via SSH, other than using virt-manager.

Step 1: Configure Serial Terminal
On your new RHEL 6 virtual machine, you’ll need to configure ttyS0. This serial interface is how “virsh console” gains access to your virtual machine.

Log into your virtual machine…

Create new ttyS0 config file.

Step 2: Allow login into ttyS0
By default RHEL 6 will not allow a user to login via ttyS0 unless we modify security.

Step 3: Start ttyS0
Make ttyS0 available, from your terminal execute the following command.

Step 3: Test Virsh Console
From your KVM server, connect to the console of your virtual machine.

Wednesday, December 18, 2013

Fedora 20 Heisenbug Post Installation Guide

Fedora 20 Post Installation Guide

Fedora 20 also known as 20 Heisenbug is the latest version of Fedora distro. It comes with many new features and software updates. Note: Almost every command shown here requires root privileges. So make sure you are logged in as root. Run su command to login as root.

Rpmfusion Repo
 
RPM Fusion Repository includes variety of applications which are not included in the main distro. Like mp3 codec, multimedia player for playing DVDs and many more.
It is recommended that you install RPM Fusion repo because most of the following packages require you to install RPM Fusion otherwise it may not work
   
#yum localinstall --nogpgcheck http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-20.noarch.rpm
#yum localinstall --nogpgcheck http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-20.noarch.rpm

Livna Repo
 
Some packages require you to install Livna Repo. Simply run he following commands to add and enable livna repo on your system.

#rpm -ivh http://rpm.livna.org/livna-release.rpm
#rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-livna

MP3 playback Rythmbox

Rythmbox is likely that it will be installed by default. If not installed then you can install it very easily.

#yum install rhythmbox

The default installation of rhytmbox wont allow you to play mp3. To play mp3 you need to add the codes
#yum install gstreamer-plugins-good gstreamer-plugins-bad gstreamer-plugins-ugly

Amarok

Amarok is the default audio player for KDE. It can also be installed on Gnome.

#yum install amarok phonon-backend-gstreamer

Audacious

Audacious is a winamp like audio player

#yum install audacious audacious-plugins

XMMS

XMMS is another winamp like audio player. And its one of my favorite. Its better than audacious in my eyes

#yum install xmms xmms-mp3
Banshee
Banshee allows you to import CDs, sync your music collection to an iPod, play music directly from an iPod, create playlists with songs from your library, and create audio and MP3 CDs from your music library.

#yum install banshee banshee-community-extensions

Video and DVD Playback
 

VLC player
VLC player is the best video player for Linux. It is capable of playing almost every video format.

#yum install vlc

XINE
 
Xine is another video player for Linux. It is very much like vlc player

#yum install xine xine-lib xine-lib-extras-freeworld

Mplayer with SM Player GUI
 
Mplayer is a VLC player like player for Linux. It is capable of playing almost all video and audio formats.

#yum install mplayer smplayer

Totem
Totem is the default video player for Fedora.

#yum install totem-xine xine-lib xine-lib-extras-freeworld

K9Copy

K9Copy is a free, open source DVD backup and DVD authoring program for Linux

#yum install k9copy

libdvdcss

libdvdcss is a free and open source software library for accessing and unscrambling DVDs encrypted with the Content Scramble System (CSS). libdvdcss is part of the VideoLAN project and is used by VLC media player and other DVD player software such as Ogle, xine-based players, and MPlayer.

#yum install libdvdcss

Adobe Flash Player Add the Adobe repo
   
#rpm -ivh http://linuxdownload.adobe.com/adobe-release/adobe-release-i386-1.0-1.noarch.rpm
#rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux
#yum install flash-plugin

Install Flash Player
#yum install flash-plugin
Acrobat Reader
Add adobe YUM Repo
   
#rpm -ivh http://linuxdownload.adobe.com/adobe-release/adobe-release-i386-1.0-1.noarch.rpm
#rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux
Install Adobe reader
#yum install AdobeReader_enu
Google Chrome
Add Google YUM Repo
#vi /etc/yum.repos.d/google.repo
And paste the following
Fedora 32-bit

[google-chrome]
name=google-chrome - 32-bit
baseurl=http://dl.google.com/linux/chrome/rpm/stable/i386
enabled=1
gpgcheck=1
gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub
Fedora 64-bit

[google-chrome]
name=google-chrome - 64-bit
baseurl=http://dl.google.com/linux/chrome/rpm/stable/x86_64
enabled=1
gpgcheck=1
gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub
Save the file using “:wq“.
Install Google Chrome

#yum install google-chrome-stable

Other Applications Filezilla
 
Filezilla is a FTP client and its one of the best

#yum install filezilla
7z or p7zip

#yum install p7zip

Unrar

Unrar utility for extracting, testing and viewing the contents of archives created with the RAR archiver version 1.50 and above.
#yum install unrar

Transmission bittorrent client
 
Transmission is a lightweight bittorrent client for Linux platform.
#yum install transmission

Wine
 
Wine is a is a compatibility layer capable of running Windows applications on Linux. It can run many windows applications even some games in Linux.
#yum install wine

Gparted
 
GParted is a free partition editor for graphically managing your disk partitions.
#yum install gparted

Gimp
Gimp is the most advanced Image Editor for Linux. This gimp has lot of useful features useful.
#yum install gimp yum install gimp-data-extras gimpfx-foundry gimp-lqr-plugin gimp-resynthesizer gnome-xcf-thumbnailer

Eclipse IDE
 
Eclipse is a multi-language Integrated development environment (IDE)
#yum install eclipse

Yum Extender : yumex
Yum Extender (yumex) is a GUI for the yum package manager. If you do not like installing everything from the terminal you can add a GUI installer.
Follow This Article to install Yum Extender (yumex) on Fedora 20

Skype Installation Dependencies:-
#yum install alsa-lib.i686 libXv.i686 libXScrnSaver.i686 qt.i686 qt-x11.i686 pulseaudio-libs.i686 pulseaudio-libs-glib2.i686 alsa-plugins-pulseaudio.i686 qtwebkit.i686 -y

#wget http://download.skype.com/linux/skype-4.2.0.11-fedora.i586.rpm

#yum localinstall skype-4.2.0.11-fedora.i586.rpm

Gnome Extension Installation
https://extensions.gnome.org/local/

Using "Gnome Link" create a account. List of extension.

Tuesday, December 3, 2013

Use google-authenticator for Fedora Login

Install Google Authenticator for Fedora

If you set up 2-step verification using SMS text message or Voice call and also want to be able to generate codes using the Android, iPhone or a Blackberry, you can use the Google Authenticator app to receive codes even if you don’t have an Internet connection or mobile service.
Prerequisite :-
Android Phone.
Barcode scanner.
Google Authenticator App on Phone.
On Laptop as Follow.
[root@localhost rajat]# yum install google-authenticator -y
Loaded plugins: langpacks, presto, refresh-packagekit
Resolving Dependencies
--> Running transaction check
---> Package google-authenticator-1.0-0.gita096a62.fc19.1.x86_64 will be installed
--> Finished Dependency Resolution

Dependencies Resolved


================================================================================================================

 Package                      Arch           Version                                       Repository      Size
================================================================================================================
Installing:
 google-authenticator         x86_64        1.0-0.gita096a62.fc19.1           fedora          33 k

Transaction Summary

================================================================================================================
Install  1 Package

Total download size: 28 k

Installed size: 56 k
Downloading Packages:
google-authenticator-1.0-0.gita096a62.fc19.1.x86_64.rpm                       |  33 kB  00:00:07
Running Transaction Check
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : google-authenticator-1.0-0.gita096a62.fc19.1.x86_64                               1/1
  Verifying  : google-authenticator-1.0-0.gita096a62.fc19.1.x86_64                               1/1

Installed:

  google-authenticator-1.0-0.gita096a62.fc19.1.x86_64


Complete!

Add line to following file:- 

#vi /etc/pam.d/gdm-password

auth         required        pam_google_authenticator.so


:wq

Save and close CTRL+D  (Become as normal user.)




once you type your password next screen you get which is google-authenticator

Wednesday, October 30, 2013

Using GNOME BOXES Management Virtual Machine. Fedora 19

 Using GNOME BOXES Management Virtual Machine.

Features

    View, access, and use:
        remote machines
        remote virtual machines
        local virtual machines
        When technology permits, set up access for applications on local virtual machines
    View, access, and use virtual machines on removable media
    View, access, and use shared connection / machines
    Share connections?
    Upload / publish virtual machines
    Select favorites
    Search for connections

Use cases

    Connect to a local virtual machine for testing.
    Connecting to a work machine from home.
    Connect to a work machine over a low quality cellular network.

Various operating systems installation ISOs, CD/DVDs and USB sticks:

    Fedora 16 and 17
    Windows XP and 7
    Debian, Ubuntu etc.

Before launching Boxes need check following.

[root@rajat rajat]# setenforce 0

"You need to switch SELinux on host to Permissive mode using command setenforce 0 after each boot."

[root@rajat rajat]# rpm -qa libvirt\* spice\* kvm\*
libvirt-daemon-driver-nwfilter-1.0.5.1-1.fc19.x86_64
libvirt-daemon-driver-qemu-1.0.5.1-1.fc19.x86_64
spice-server-0.12.3-1.fc19.x86_64
libvirt-gconfig-0.1.6-1.fc19.x86_64
libvirt-glib-0.1.6-1.fc19.x86_64
libvirt-daemon-driver-secret-1.0.5.1-1.fc19.x86_64
libvirt-daemon-driver-storage-1.0.5.1-1.fc19.x86_64
libvirt-daemon-kvm-1.0.5.1-1.fc19.x86_64
spice-glib-0.19-1.fc19.x86_64
libvirt-client-1.0.5.1-1.fc19.x86_64
spice-gtk3-0.19-1.fc19.x86_64
libvirt-gobject-0.1.6-1.fc19.x86_64
libvirt-daemon-1.0.5.1-1.fc19.x86_64
libvirt-daemon-driver-nodedev-1.0.5.1-1.fc19.x86_64
spice-vdagent-0.14.0-2.fc19.x86_64
libvirt-daemon-driver-network-1.0.5.1-1.fc19.x86_64
libvirt-daemon-driver-interface-1.0.5.1-1.fc19.x86_64















Friday, October 18, 2013

Fedora 19 Schrodinger’s Cat Post Installation Guide

Fedora 19 also known as 19 Schrodinger’s Cat is the latest version of Fedora distro. It comes with many new features and software updates.
Note: Almost every command shown here requires root privileges. So make sure you are logged in as root. Run su command to login as root.
Rpmfusion Repo
RPM Fusion Repository includes variety of applications which are not included in the main distro. Like mp3 codec, multimedia player for playing DVDs and many more.
It is recommended that you install RPM Fusion repo because most of the following packages require you to install RPM Fusion otherwise it may not work


#yum localinstall --nogpgcheck http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-19.noarch.rpm
#yum localinstall --nogpgcheck http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-19.noarch.rpm
Livna Repo
Some packages require you to install Livna Repo. Simply run he following commands to add and enable livna repo on your system.
#rpm -ivh http://rpm.livna.org/livna-release.rpm
#rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-livna
MP3 playback
Rythmbox
Rythmbox is likely that it will be installed by default. If not installed then you can install it very easily.
#yum install rhythmbox
The default installation of rhytmbox wont allow you to play mp3. To play mp3 you need to add the codes
yum install gstreamer-plugins-good gstreamer-plugins-bad gstreamer-plugins-ugly
Amarok
Amarok is the default audio player for KDE. It can also be installed on Gnome.
#yum install amarok phonon-backend-gstreamer
Audacious
Audacious is a winamp like audio player
#yum install audacious audacious-plugins
XMMS
XMMS is another winamp like audio player. And its one of my favorite. Its better than audacious in my eyes
#yum install xmms xmms-mp3
Banshee
Banshee allows you to import CDs, sync your music collection to an iPod, play music directly from an iPod, create playlists with songs from your library, and create audio and MP3 CDs from your music library.
#yum install banshee banshee-community-extensions
Video and DVD Playback
VLC player
VLC player is the best video player for Linux. It is capable of playing almost every video format.
#yum install vlc
XINE
Xine is another video player for Linux. It is very much like vlc player
#yum install xine xine-lib xine-lib-extras-freeworld
Mplayer with SM Player GUI
Mplayer is a VLC player like player for Linux. It is capable of playing almost all video and audio formats.
#yum install mplayer smplayer
Totem
Totem is the default video player for Fedora.
#yum install totem-xine xine-lib xine-lib-extras-freeworld
K9Copy
K9Copy is a free, open source DVD backup and DVD authoring program for Linux
#yum install k9copy
libdvdcss
libdvdcss is a free and open source software library for accessing and unscrambling DVDs encrypted with the Content Scramble System (CSS). libdvdcss is part of the VideoLAN project and is used by VLC media player and other DVD player software such as Ogle, xine-based players, and MPlayer.
#yum install libdvdcss
Adobe Flash Player
Add the Adobe repo



#rpm -ivh http://linuxdownload.adobe.com/adobe-release/adobe-release-i386-1.0-1.noarch.rpm
#rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux
#yum install flash-plugin

Install Flash Player
#yum install flash-plugin
Acrobat Reader
Add adobe YUM Repo

#rpm -ivh http://linuxdownload.adobe.com/adobe-release/adobe-release-i386-1.0-1.noarch.rpm
#rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux
Install Adobe reader
#yum install AdobeReader_enu
Google Chrome
Add Google YUM Repo
#vi /etc/yum.repos.d/google.repo
And paste the following
Fedora 32-bit






[google-chrome]
name=google-chrome - 32-bit
baseurl=http://dl.google.com/linux/chrome/rpm/stable/i386
enabled=1
gpgcheck=1
gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub
Fedora 64-bit






[google-chrome]
name=google-chrome - 64-bit
baseurl=http://dl.google.com/linux/chrome/rpm/stable/x86_64
enabled=1
gpgcheck=1
gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub
Save the file using “:wq“.
Install Google Chrome
#yum install google-chrome-stable
Other Applications
Filezilla
Filezilla is a FTP client and its one of the best
#yum install filezilla
7z or p7zip
#yum install p7zip
Unrar
Unrar utility for extracting, testing and viewing the contents of archives created with the RAR archiver version 1.50 and above.
#yum install unrar
Transmission bittorrent client
Transmission is a lightweight bittorrent client for Linux platform.
#yum install transmission
Wine
Wine is a is a compatibility layer capable of running Windows applications on Linux. It can run many windows applications even some games in Linux.
#yum install wine
Gparted
GParted is a free partition editor for graphically managing your disk partitions.
#yum install gparted
Gimp
Gimp is the most advanced Image Editor for Linux. This gimp has lot of useful features useful.
#yum install gimp yum install gimp-data-extras gimpfx-foundry gimp-lqr-plugin gimp-resynthesizer gnome-xcf-thumbnailer
Eclipse IDE
Eclipse is a multi-language Integrated development environment (IDE)
#yum install eclipse
Yum Extender : yumex
Yum Extender (yumex) is a GUI for the yum package manager. If you do not like installing everything from the terminal you can add a GUI installer.
Follow This Article to install Yum Extender (yumex) on Fedora 19

Skype Installation 
Dependencies:-
#yum install alsa-lib.i686 libXv.i686 libXScrnSaver.i686 qt.i686 qt-x11.i686 pulseaudio-libs.i686 pulseaudio-libs-glib2.i686 alsa-plugins-pulseaudio.i686 qtwebkit.i686 -y

#wget http://download.skype.com/linux/skype-4.2.0.11-fedora.i586.rpm

#yum localinstall skype-4.2.0.11-fedora.i586.rpm

Gnome Extension Installation
https://extensions.gnome.org/local/

Using "Gnome Link" create a account. List of extension.

Monday, August 26, 2013

Get Rid of Deleted Open Files

Sharing a nice articles which I found on web. Hope it will be useful to you as well..

You might have this scenario; Logfiles deleted while the process is still running. That's annoying: On your Linux-Server the /var filesystem is nearly full. You remove a very large logfile that you don't need with the rm command:

rajat@root-centos## df -Ph /var
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/root-var  7.1G  7.0G  100M  99% /var
rajat@root-centos## ls -l /var/log/myapp/userlog
rajat@root-centos## rm /var/log/myapp/userlog
rajat@root-centos## df -Ph /var
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/root-var  7.1G  7.0G  100M  99% /var

But what's that? The filesystem is still full. With lsof you can see, that the logfile is still opened in write mode:

rajat@root-centos## lsof | grep var/log/myapp/userlog
myapp    25139      root   4w     REG      3,12       0    2101404 /var/log/myapp/userlog (deleted)

To actually free up the space you would have to stop the logging process. But since this might be a mission critical application this is not always an option. Is there any way to get rid of the file without stopping the logging process?

Find the deleted file's representation under /proc

Actually we cannot remove the file as long as the file is still in use by a process. But what we can do is: Getting the size down to 0. Thanks to Linux' enhanced /proc filesystem.

And that's how you do it:

First find the process that still uses the file (we already did that - see above):

rajat@root-centos## lsof | grep var/log/myapp/userlog
myapp    25139      root   4w     REG      3,12       0    2101404 /var/log/myapp/userlog (deleted)
lsof tells us that a process with PID=25139 has opened the file (with number 4) in write mode. See the bolded part of the lsof output.

Knowing the PID of the process and the file number we can visit its representation under /proc:

rajat@root-centos## cd /proc/25139/fd
rajat@root-centos#:/proc/25139/fd#  ls -l 4
lr-x------ 1 root root 64 2010-01-07 17:10 4 -> /var/log/myapp/userlog (deleted)
We can do almost everything with this file (called 4 here) what we can do with a real file: we can less it, copy it, and we can change its contents!


Free up the Space

As already said, we cannot remove the file, but what we can do is getting the size down to zero. And that's done as with every other file, e.g. if you use bash (or ksh) - what is most likely under Linux:

rajat@root-centos## > /proc/25139/fd/4
rajat@root-centos## df -Ph /var
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/root-var  7.1G  4.9G  1.2G  69% /var
As we see there is again free space under /var, and the process is still running:

rajat@root-centos## lsof | grep var/log/myapp/userlog
myapp    25139      root   4w     REG      3,12       0        0  /var/log/myapp/userlog (deleted)

What more could be done...?

As said before you can work on this file as you work on real files. That means, you could even save this file and compress it before getting its size down to 0:

rajat@root-centos## cp /proc/25139/fd/4 /tmp/userlog
rajat@root-centos## gzip -9 /tmp/userlog
rajat@root-centos## mv /tmp/userlog.gz /var/log/myapp/userlog.1.gz
rajat@root-centos## > /proc/25139/fd/4

Final Remarks

This procedure helps you if you are in a pinch - but basically you should never remove such an open file, because you still have an issue here: The process still writes to this file - and the only way to see what it logs is to use the procedure to save the file as shown above.

So remember to bring the size down to 0 in the first place instead:

rajat@root-centos## > /var/log/myapp/userlog
This way the space in the filesystem is freed immediately - and you still see what your application is writing to this file.


Monday, June 10, 2013

Cent OS 6.4 as PuppetMaster 3.2.1 installation and configuration

What is Puppet?

Puppet is IT automation software that helps system administrators manage infrastructure throughout its

lifecycle, from provisioning and configuration to patch management and compliance. Using Puppet, you

can easily automate repetitive tasks, quickly deploy critical applications, and proactively manage

change, scaling from 10s of servers to 1000s, on-premise or in the cloud.

How Puppet Works

Puppet uses a declarative, model-based approach to IT automation.

Define the desired state of the infrastructure’s configuration using Puppet’s declarative

configuration language.
Simulate configuration changes before enforcing them.
Enforce the deployed desired state automatically, correcting any configuration drift.
Report on the differences between actual and desired states and any changes made enforcing the desired

state.

Puppet Master Server Install & Configuration

#vi /etc/hosts
192.168.100.1 master.puppet.bom master
192.168.100.2 client.puppet.bom client

#yum install puppet-server -y

#vi /etc/puppet/puppet.conf
dns_alt_name = master.puppet.bom

#vi /etc/sysconfig/puppet
PUPPET_SERVER=master.puppet.bom

#service puppetmaster restart && chkconfig puppetmaster on

#puppet cert list
#puppet cert sign client.puppet.bom

Now we need create "Puppet Policy" @/etc/puppet/manifest/site.pp

[root@master ~]# cat /etc/puppet/manifests/site.pp
# Create "/tmp/testfile" if it doesn't exist.
class test_class {
    file { "/tmp/testfile":
       ensure => present,
       mode   => 600,
       owner  => root,
       group  => root
    }
}

# tell puppet on which client to run the class
node default {
    include test_class
}

file {'/etc/puppet/files/MobileWorld.jar':
  ensure => present,
  mode   => '0777',
  owner  => 'root',
  group  => 'root',
  source => 'puppet:///files/MobileWorld.jar',
}
file {'/etc/motd':
                        source => 'puppet:///files/motd',
}

file {'/etc/puppet/files/mMobile.jar':
  ensure => present,
  mode   => '0777',
  owner  => 'root',
  group  => 'root',
  source => 'puppet:///files/mMobile.jar',
}

[root@master ~]#

Puppet Slave Install & Configuration

#vi /etc/hosts
#vi /etc/hosts
192.168.100.2 client.puppet.bom client
192.168.100.1 master.puppet.bom master

#yum install puppet -y

#vi /etc/puppet/puppet.conf
[agent]
server = master.puppet.bom

#vi /etc/default/puppet
START=yes

#service puppet restart && chkconfig puppet on

#puppet agent --test

At the client end need write a one crontab.

* * * 1 * puppet --onetime --no-daemonize --logdest syslog > /dev/null 2>&1