Friday, May 29, 2009

KVM setup

I usually love to start from a brand new OS installation. That way we know what packages we actually need. Follow these instructions for both machines A and B.

1. Confirm your CPU has virtualisation support
egrep 'vmx|svm' /proc/cpuinfo

2. Install kvm packages
yum install kvm kmod-kvm qemu

3. Install appropriate kernel module
modprobe kvm-intel
OR
modprobe kvm-amd

4.Check whether the module is installed or not
lsmod | grep kvm
Also make sure the kvm is present as a device
ls -l /dev/kvm

5.Mount same NFS share at same path (say /mount_point)
mount server:/nfs_share /mount_point

6.Download ISO file for creation on virtual machine
wget -O /mount_point/fedora.iso http://mirror.cc.vt.edu/pub/fedora/linux/releases/10/Fedora/i386/iso/Fedora-10-i386-DVD.iso

7. Create VM image file
qemu-img create fedoraroot.img -f raw 10G

8. I do not know if there is a command line version of qemu. So if your server does not have GUI, you can use following commands
On server
export DISPLAY=your_machine:0.0
On your_machine
xhost +
You can specify server's name after + sign. But I prefer accepting whole world to avoid routing problems.

9. Start VM using
qemu-kvm -m 512 -cdrom fedora.iso -boot d fedoraroot.img

10. Once installation is done, change boot flag to "c"( which is default). You can also remove CD-ROM from VM.
qemu-kvm -m 512 fedoraroot.img

Wednesday, May 20, 2009

Wallpaper changer script

Tired of changing wallpaper everyday? You will get many soft-wares which will change it for you everyday. The only thing which I dint like about them is, they put a picture which is stored on your computer. SO there is possibility that you have seen that picture before. What about a truly random pic??
Here is the script:

rm -f ~/wallpaper/w.jpg ~/wallpaper/widescreen_rss.php
wget -O ~/wallpaper/widescreen_rss.php http://www.mlewallpapers.com/widescreen_rss.php
wget -O ~/wallpaper/w.jpg `grep enclosure ~/wallpaper/widescreen_rss.php | cut -d \" -f 2`
gconftool-2 -t str --set /desktop/gnome/background/picture_filename ~/wallpaper/w.jpg

Put it in your cron so that it will execute daily. You can modify this to fetch picture from any site which will give new picture daily.


All this can be done using following :

mkdir -p ~/new_installation/wallpaper
cat > ~/new_installation/wallpaper/wallpaper_changer.sh << END
rm -f ~/new_installation/wallpaper/w.jpg ~/new_installation/wallpaper/widescreen_rss.php
wget -O ~/new_installation/wallpaper/widescreen_rss.php http://www.mlewallpapers.com/widescreen_rss.php
wget -O ~/new_installation/wallpaper/w.jpg \`grep enclosure ~/new_installation/wallpaper/widescreen_rss.php | cut -d \" -f 2\`
gconftool-2 -t str --set /desktop/gnome/background/picture_filename ~/new_installation/wallpaper/w.jpg
END
chmod a+x ~/new_installation/wallpaper/wallpaper_changer.sh
cat >> /etc/sudoers << END
# crontab root scripts
action-owl ALL=(ALL) NOPASSWD:~/new_installation/wallpaper/wallpaper_changer.sh
END

For fedora :

cat >> /var/spool/cron/root << END
0 12 * * * ~/new_installation/wallpaper/wallpaper_changer.sh >/dev/null 2>&1
END

For ubuntu :

cat >> /var/spool/cron/crontabs/root << END
0 12 * * * ~/new_installation/wallpaper/wallpaper_changer.sh >/dev/null 2>&1
END


This will change wallpaper on 12 noon every day.

Tuesday, May 19, 2009

Installing 64 bit adobe in firefox

I have 64 bit ubuntu in office and for some strange reasons, it installs 32 bit flash player through apt-get. To install 64 bit version here are the commands to copy paste in terminal.


wget -O flash.tar.gz http://download.macromedia.com/pub/labs/flashplayer10/libflashplayer-10.0.22.87.linux-x86_64.so.tar.gz
tar xvzf flash.tar.gz
mkdir -p ~/.mozilla/plugins
mv libflashplayer.so ~/.mozilla/plugins
pkill firefox
firefox

Friday, May 15, 2009

Open terminal in current folder

One feature I really miss in Fedora after moving from redhat was opening a terminal in current folder of nautilus.
So my workaround is this :


echo gnome-terminal > ~/.gnome2/nautilus-scripts/terminal
chmod a+x ~/.gnome2/nautilus-scripts/terminal

Monday, May 11, 2009

MS office 2007 in openoffice

We need to have this plug-in in order to open docx and xlsx files in open-office.

http://rpm.pbone.net/index.php3/stat/4/idpl/10821603/com/odf-converter-integrator-0.2.0-2.i386.rpm.html

Thursday, May 7, 2009

Radio in linux

Being in linux, its a obvious thing to use command line for EVERYTHING. For example, listening songs. "Usual" folks just go on some site, either download or keep browser open if the site is providing media player itself. But in linux, its just a command (which can be run in background). I use following commands for listening radio :

mplayer -playlist http://asx.abacast.com/arabian_radio-city-64.asx -loop 0
mplayer - playlist http://www.1.fm/TuneIn/WM/energybbfm128k/Listen.aspx -loop 0
mplayer mmsh://citadelcc-wplj-fm.wm.llnwd.net/citadelcc_WPLJ_FM?MSWMExt=.asf


"-loop 0" because dont let a single corrupt packet stop your radio.

You can always find a radio station of your choice. One radio station which I would really like to promote is http://wnyu.org/.

Friday, May 1, 2009

Sopcast in linux

Love watching sports? But cant get working on linux??
Here is what I found.

1. Download sopcast for linux from http://code.google.com/p/sopcast-player/.
(No need to download player. Just the source i.e. sp-auth is enough)

2. Create a small script ('~/sop' in my case) as follows :

#!/bin/sh
while [ 1 ]
do
sp-sc $1 3908 8908 > /dev/null &
mplayer http://localhost:8908/tv.asf
done
pkill sp-sc


(while loop because mplayer doesn't start the stream in first attempt.)

3. Search the forums like http://myp2p.eu/index.php?part=sports for your favourite channel and get the sopcast link which will look like sop://broker1.sopcast.com:3912/10912

4.

./sop sop://broker1.sopcast.com:3912/10912


then sit back and enjoy!!!