KDE remove autostart programs
Had a situation where kde was starting programs automatically on restart.
Found the file
/home/user/.kde/share/config/ksmserverrc
Edited this file to disable autostart of programs on logout
GPS on Linux
Compile kernel with usb-modem feature
Connect the GPS to usb port ….
Check /var/log/messages
$ tailf /var/log/messages
Jun 20 22:26:39 localhost kernel: usb 6-2: new full speed USB device using uhci_hcd and address 3
Jun 20 22:26:40 localhost kernel: usb 6-2: configuration #1 chosen from 1 choice
Jun 20 22:26:40 localhost kernel: cdc_acm 6-2:1.0: ttyACM0: USB ACM device
Device created is ttyACM0
This should give you a continuous stream
$ cat /dev/ttyACM0
$GPRMC,071601.00,A,1907.09660,N,07252.30735,E,0.029,235.62,130711,,,A*67
$GPGGA,071601.00,1907.09660,N,07252.30735,E,1,09,2.21,33.2,M,-62.8,M,,*40
$GPGSV,3,1,12,13,82,086,34,20,11,177,35,19,43,072,35,10,25,274,*77
$GPGSV,3,3,12,07,40,343,15,11,20,137,31,08,25,316,10,28,32,250,*7A
$GPZDA,071601.00,13,07,2011,00,00*60
Now that the device is detected lets install the rpms required
$ yum install -y gpsd gpsd-clients
Incase Not created Please create
Created startup script
$ cat /etc/init.d/gpsd
#!/bin/sh
#
# gpsd Service daemon for mediating access to a GPS
#
# chkconfig: – 44 66
# description: gpsd is a service daemon that mediates access to a GPS sensor \
# connected to the host computer by serial or USB interface, \
# making its data on the location/course/velocity of the sensor \
# available to be queried on TCP port 2947 of the host computer.
# processname: gpsd
# pidfile: /var/run/gpsd.pid
# http://fedoraproject.org/wiki/FCNewInit/Initscripts
### BEGIN INIT INFO
# Provides: gpsd
# Required-Start: network
# Required-Stop: network
# Should-Start:
# Should-Stop:
# Default-Start:
# Default-Stop:
# Short-Description: Service daemon for mediating access to a GPS
# Description: gpsd is a service daemon that mediates access to a GPS sensor
# connected to the host computer by serial or USB interface, making its
# data on the location/course/velocity of the sensor available to be
# queried on TCP port 2947 of the host computer.
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
exec=”/usr/sbin/gpsd”
prog=$(basename $exec)
PIDFILE=/var/run/gpsd.pid
CONTROL_SOCKET=/var/run/gpsd.sock
[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
: ${OPTIONS:=-n}
: ${DEVICE:=/dev/ttyACM0}
lockfile=/var/lock/subsys/$prog
start() {
[ "$EUID" != "0" ] && exit 4
echo -n $”Starting $prog: “
daemon $exec -P $PIDFILE -F $CONTROL_SOCKET $OPTIONS $DEVICE
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop() {
[ "$EUID" != "0" ] && exit 4
echo -n $”Stopping $prog: “
killproc $prog
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}
restart() {
stop
start
}
case “$1″ in
start|stop|restart)
$1
;;
force-reload)
restart
;;
status)
status $prog
;;
try-restart|condrestart)
if status $prog >/dev/null ; then
restart
fi
;;
reload)
status $prog >/dev/null || exit 7
# If config can be reloaded without restarting, implement it here,
# remove the “exit”, and add “reload” to the usage message below.
action $”Service $prog does not support the reload action: ” /bin/false
exit 3
;;
*)
echo $”Usage: $0 {start|stop|status|restart|try-restart|force-reload}”
exit 2
esac
$ echo “/etc/init.d/gpsd start ” >> /etc/rc.local
Or start it via services
Graphic front end
$ /usr/bin/xgps
Running cgps utility, I can obtain the following (You will know where I am by interpreting the Lat/Lon). cgps runs on serial or console terminal and connects to local port 2947, which is the default port that gpsd listened to for serving queries from client programs:
$ cgps localhost 2947
CGPS Test Client
┌───────────────────────────────────────────┐┌─────────────────────────────────┐
│ Time: 2011-07-13T06:27:43.00Z ││PRN: Elev: Azim: SNR: Used: │
│ Latitude: 19.118427 N ││ │
│ Longitude: 72.871813 E ││ │
│ Altitude: 50.3 m ││ │
│ Speed: 0.0 kph ││ │
│ Heading: 356.4 degrees ││ │
│ HPE: 8 m ││ │
│ VPE: 13 m ││ │
│ Climb: 0.0 m/min ││ │
│ Status: 3D FIX ││ │
│ Change: 0 secs ││ │
│ ││ │
│ ││ │
└───────────────────────────────────────────┘└─────────────────────────────────┘
┌───────────────────────────────────────────┐
│Command: │
└───────────────────────────────────────────┘
GPSD,O=GGA 1310538463.00 0.005 19.118427 72.871813 50.30 ? ? 356
.4500 0.011 0.000 ? ? ?
GPSD,O=GSA 1310538463.00 0.005 19.118427 72.871813 50.30 8.32 13.20 356.4500
0.011 0.000 165.6961 16.64 ?
There are two more native way to interact with gpsd for retrieving GPS data – by telnet or gpspipe. Since gpsd listen to port 2947, you can just “telnet” to it. Once connect, type ‘p’ or ‘d’ followed by return will query for position and time respectively
$ telnet localhost 2947
Trying 127.0.0.1…
Connected to localhost.
Escape character is ‘^]’.
p
GPSD,P=19.118280 72.871878
d
GPSD,D=2011-07-13T06:33:19.00Z
$ gpspipe -r localhost 2947
GPSD,R=1
$GPGSV,4,2,14,10,25,287,14,32,05,165,,06,16,048,33,23,63,124,48*70
$GPGSV,4,3,14,03,29,054,35,07,36,330,,16,08,039,,08,20,305,29*74
$GPGSV,4,4,14,11,15,147,,28,25,239,26*7B
$GPGLL,1907.09502,N,07252.31343,E,065047.00,A,A*6C
$GPZDA,065047.00,13,07,2011,00,00*61
Setting up time via gps
#!/bin/bash
#setup time via gps
i=0;
while [ "$i" -lt 5 ];
do
sleep 5
(echo d ; sleep 1; echo d; sleep 1; echo d) | (nc localhost 2947) > /tmp/gps_time &
TEST=$!
sleep 4
kill -s SIGINT $TEST
i=$(($i+1))
date=$`cat /tmp/gps_time | tail -n 1`
year=$(echo $date | sed ‘s/.*D=\([0-9]*\)-.*/\1/’)
[ "$year" -gt 2004 ] && break
done;
echo “slept $i times while waiting gps lock..”
echo “Setting date $date”
export TZ=UTC
date $(echo $date | sed ‘s/GPSD,D=\([0-9]*\)\(.*\):.*/\2\1/’ | sed ‘s/[^0-9]//g’)
sleep 2
export TZ=”/usr/share/zoneinfo/Asia/Calcutta”
add3sec=`date –date=’3 seconds’`
date -s “${add3sec}”
date
hwclock –systohc
hwclock
Getting Location via bash
#!/bin/bash
#setup time via gps
i=0;
while [ "$i" -lt 5 ];
do
sleep 5
(echo dp ) | (nc localhost 2947) > /tmp/gps_location &
TEST=$!
sleep 1
kill -s SIGINT $TEST
i=$(($i+1))
echo $i
done;
echo “slept $i times while waiting gps lock..”
cat /tmp/gps_location| \
awk -F “P=” ‘{ print $NF}’ | \
awk ‘{ print “Latitude: ” $1 ” Longitude: ” $2}’
Debian Squeeze change root password
== Method 1 ==
Boot into grub, select single user but do not press enter.
Press e to bring you into edit mode.
Scroll down to the kernel line, it starts with “linux /boot/vmlinuz-2.6…….”
Scroll to the end of that line and press space key once and type
init=/bin/bash
Press Crtl x to boot
$ remount / as rw
$ mount -rw -o remount /
Change password with
$ passwd
type your new password, hit enter and reboot.
== Method 2 ==
Boot from another installation of Debian. (One can use a LiveCD to get access to the “/” partition.)
Then, mount the partition where you have Squeeze’s “/”, then changed directory to /mnt/etc
Used vim as an editor to edit the file shadow.
It found the line starting with root:
Deleted everything between the first and second colons, and voila’,
root::$6$fsdsdgdsg74.:14862:0:99999:7:::
Reboot as root without a password.
At the end use passwd to set a new root password.
Download YouTube Videos on Linux
-
Download Software
# yum install youtube-dl
-
Download YouTube Videos
# youtube-dl http://www.youtube.com/watch?vxxxxxxx
Pidgin + The certificate for omega.contacts.msn.com could not be validated
If in pidgin you get a error
The certificate for omega.contacts.msn.com could not be validated. The certificate chain presented is invalid
On connection with msn…..
My guess is the old certificate in pidgins folder is outdated
This is what I did to fix it
cd $HOME/.purple/certificates/x509/tls_peers
rm omega.contacts.msn.com ows.messenger.msn.com rsi.hotmail.com
wget http://files.andreineculau.com/projects/pidgin/omega.contacts.msn.com.txt
mv omega.contacts.msn.com.txt omega.contacts.msn.com
Restart Pidgin and you should be good to go
NOTE: Can be fixed by deleting certificate from Pidgin menu Tools/Certificate.
ELSE
Also found this method while browsing
Solution
a. open https://omega.contacts.msn.com/
b. On the URL bar, click on the security lock (usually just in front of the URL). Click on the certificate information.
c. Go to the Detail tab and click the “Export” button. Save the file as “omega.contacts.msn.com” (without the quotes).
d. Copy and paste this file to $HOME/.purple/certificates/x509/tls_peers
Tata Phonone / Reliance Netconnect (wvdial)
Getting the required software
# yum install wvdial usb_modeswitch usb_modeswitch-data
Stopping network
# /etc/init.d/network stop
Plug in modem in usb outlet and check output
# tail -f /var/log/messages
kernel: usb 2-1.1: new full speed USB device using ehci_hcd and address 4
kernel: usb 2-1.1: New USB device found, idVendor=19d2, idProduct=fff5
kernel: usb 2-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
kernel: usb 2-1.1: Product: USB Storage
kernel: usb 2-1.1: Manufacturer: ZTE, Incorporated
kernel: usb 2-1.1: SerialNumber: 000000000002
kernel: Initializing USB Mass Storage driver…
kernel: scsi6 : usb-storage 2-1.1:1.0
kernel: usbcore: registered new interface driver usb-storage
kernel: USB Mass Storage support registered.
usb_modeswitch: switching 19d2:fff5 (ZTE, Incorporated: USB Storage)
kernel: usb 2-1.1: USB disconnect, address 4
kernel: usb 2-1.1: new full speed USB device using ehci_hcd and address 5
kernel: usb 2-1.1: New USB device found, idVendor=19d2, idProduct=fff1
kernel: usb 2-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
kernel: usb 2-1.1: Product: ZTE CDMA Tech
kernel: usb 2-1.1: Manufacturer: ZTE, Incorporated
kernel: scsi7 : usb-storage 2-1.1:1.5
kernel: usbcore: registered new interface driver usbserial
kernel: USB Serial support registered for generic
kernel: usbcore: registered new interface driver usbserial_generic
kernel: usbserial: USB Serial Driver core
kernel: USB Serial support registered for GSM modem (1-port)
kernel: option 2-1.1:1.0: GSM modem (1-port) converter detected
kernel: usb 2-1.1: GSM modem (1-port) converter now attached to ttyUSB0
kernel: option 2-1.1:1.1: GSM modem (1-port) converter detected
kernel: usb 2-1.1: GSM modem (1-port) converter now attached to ttyUSB1
kernel: option 2-1.1:1.2: GSM modem (1-port) converter detected
kernel: usb 2-1.1: GSM modem (1-port) converter now attached to ttyUSB2
kernel: option 2-1.1:1.3: GSM modem (1-port) converter detected
kernel: usb 2-1.1: GSM modem (1-port) converter now attached to ttyUSB3
kernel: option 2-1.1:1.4: GSM modem (1-port) converter detected
kernel: usb 2-1.1: GSM modem (1-port) converter now attached to ttyUSB4
kernel: usbcore: registered new interface driver option
kernel: option: v0.7.2:USB Driver for GSM modems
modem-manager: (ttyUSB1) opening serial device…
modem-manager: (ttyUSB0) opening serial device…
modem-manager: (ttyUSB4) opening serial device…
modem-manager: (ttyUSB2) opening serial device…
modem-manager: (ttyUSB3) opening serial device…
usb_modeswitch: switched to 19d2:fff1 (ZTE, Incorporated: ZTE CDMA Tech)
pcscd: winscard.c:309:SCardConnect() Reader E-Gate 0 0 Not Found
pcscd: winscard.c:309:SCardConnect() Reader E-Gate 0 0 Not Found
pcscd: winscard.c:309:SCardConnect() Reader E-Gate 0 0 Not Found
pcscd: winscard.c:309:SCardConnect() Reader E-Gate 0 0 Not Found
kernel: scsi 7:0:0:0: Direct-Access ZTE USB Storage FFF1 2.31 PQ: 0 ANSI: 2
kernel: sd 7:0:0:0: Attached scsi generic sg2 type 0
kernel: sd 7:0:0:0: [sdb] Attached SCSI removable disk
# wvdialconf
Editing `/etc/wvdial.conf’.
Scanning your serial ports for a modem.
Modem Port Scan: S0 S1 S2 S3
WvModem: Cannot get information for serial port.
ttyUSB0: ATQ0 V1 E1 — OK
ttyUSB0: ATQ0 V1 E1 Z — OK
ttyUSB0: ATQ0 V1 E1 S0=0 — OK
ttyUSB0: ATQ0 V1 E1 S0=0 &C1 — OK
ttyUSB0: ATQ0 V1 E1 S0=0 &C1 &D2 — OK
ttyUSB0: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 — OK
ttyUSB0: Modem Identifier: ATI — Manufacturer: QUALCOMM INCORPORATED
ttyUSB0: Speed 9600: AT — OK
ttyUSB0: Max speed is 9600; that should be safe.
ttyUSB0: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 — OK
WvModem: Cannot get information for serial port.
ttyUSB1: ATQ0 V1 E1 — failed with 2400 baud, next try: 9600 baud
ttyUSB1: ATQ0 V1 E1 — failed with 9600 baud, next try: 9600 baud
ttyUSB1: ATQ0 V1 E1 — and failed too at 115200, giving up.
WvModem: Cannot get information for serial port.
ttyUSB2: ATQ0 V1 E1 — failed with 2400 baud, next try: 9600 baud
ttyUSB2: ATQ0 V1 E1 — failed with 9600 baud, next try: 9600 baud
ttyUSB2: ATQ0 V1 E1 — and failed too at 115200, giving up.
WvModem: Cannot get information for serial port.
ttyUSB3: ATQ0 V1 E1 — failed with 2400 baud, next try: 9600 baud
ttyUSB3: ATQ0 V1 E1 — failed with 9600 baud, next try: 9600 baud
ttyUSB3: ATQ0 V1 E1 — and failed too at 115200, giving up.
WvModem: Cannot get information for serial port.
ttyUSB4: ATQ0 V1 E1 — failed with 2400 baud, next try: 9600 baud
ttyUSB4: ATQ0 V1 E1 — failed with 9600 baud, next try: 9600 baud
ttyUSB4: ATQ0 V1 E1 — and failed too at 115200, giving up.
Found a modem on /dev/ttyUSB0.
Modem configuration written to /etc/wvdial.conf.
ttyUSB0: Speed 9600; init “ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0″
# vi /etc/wvdial.conf
[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = Analog Modem
ISDN = 0
Phone = #777
Modem = /dev/ttyUSB0
Username = # In case of tata Username =internet
Password = # In case of tata Password =internet
Baud = 9600
# wvdial
It should now connect
mp3 on fedora-13
yum install amarok amarok-extras-nonfree xine-lib-extras-freeworld libtunepimp-extras-freeworld phonon gstream -y
rpm -ivh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm
yum install gstreamer-plugins-bad gstreamer-ffmpeg gstreamer-plugins-ugly -y
kill `pidof pulseaudio`
alsamixer
Linux disk cache
Linux has a supposedly good memory management feature that will use up any “extra” RAM you have to cache stuff.
Accessed file’s content gets cached in RAM for fast access eventhough we might not need it later in RAM.
$ free -m
total used free shared buffers cached
Mem: 1504 1490 14 0 24 809
-/+ buffers/cache: 656 848
Swap: 0 0 0
In Linux, you can clear the cache of the memory by using
$ sync; echo 3 > /proc/sys/vm/drop_caches; echo 0 > /proc/sys/vm/drop_caches
or
$ sync; sysctl -w vm.drop_caches=3; sysctl -w vm.drop_caches=0
$ free -m
total used free shared buffers cached
Mem: 1504 650 854 0 1 67
-/+ buffers/cache: 581 923
Swap: 0 0 0
sync should be run because this is a non-destructive operation, and dirty objects are not freeable. So you run sync in order to make sure all cached objects are freed.
Doing echo 3 is clearing pagecache, dentries and inodes but you could choose echo 1 to free pagecache only or echo 2 to free dentries and inodes.
redhat/centos build kernel rpm
Preparing System
$ yum install gcc make bison ncurses-devel rpm-build
Downloading the kernel source linux-2.6.30.10.tar.gz from http://kernel.org
$ nohup wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.30.10.tar.gz &
After you have done it, extract to /usr/src
$ tar zxvf linux-2.6.30.10.tar.gz -C /usr/src
enter to /usr/src
create a symlink to source code called linux, do this:
$ cd /usr/src
$ ln -sf linux-2.6.30.10 linux
drwxr-xr-x 3 root root 4096 Jul 16 14:09 kernels
lrwxrwxrwx 1 root root 12 Jul 16 16:18 linux -> linux-2.6.31
drwxr-xr-x 23 root root 4096 Sep 10 2009 linux-2.6.31
drwxr-xr-x 7 root root 4096 Jul 16 14:11 redhat
Copying the stock config into the dir
$ cd /usr/src/linux
$ cp /boot/config-`uname -r` .config
Compiling the kernel
$ cd /usr/src/linux
$ make clean
$ make menuconfig
If you want to add a custom tag that will identify the new kernel (if you want or skip this) , to accomplish this, do that:
I did not enter anything here and skipped this step
* On initial screen, go to General setup —>
* Select Local version – append to kernel release
┌─────────────── Local version – append to kernel release ────────────────┐
│ Please enter a string value. Use the key to move from the input |
│ field to the buttons below it. │
│ ┌─────────────────────────────────────────────────────────────────────┐
│ │ │
│ └─────────────────────────────────────────────────────────────────────┘
With this done, the resulting kernel.rpm will have the tag identifying it.
It is time to customize the kernel configuration to fit with your hardware.
After this quit menuconfig and start the compilation.
While you get out the configuration, you will be asked to save the changes. Answer Yes.
Run make rpm
$ make rpm
The compilation will start, good time to grab a coffee cause this is going to be long
WROTE:…….
/usr/src/redhat/SRPMS/kernel-2.6.30.10-1.src.rpm
/usr/src/redhat/RPMS/x86_64/kernel-2.6.30.10-1.x86_64.rpm
Take a backup of /boot dir for safety
$ tar czvf boot.tgz /boot/ /etc/grub.conf
Installing the new kernel rpm
$ rpm -ivh rpm -ivh /usr/src/redhat/RPMS/x86_64/kernel-2.6.30.10-1.x86_64.rpm
Preparing… ########################################### [100%]
1:kernel ########################################### [100%]
Confirming that alls ok
$ ls /boot
config-2.6.18-128.el5 grub message System.map-2.6.18-128.el5 vmlinux-2.6.30.10.bz2 vmlinuz-2.6.30.10
config-2.6.30.10 initrd-2.6.18-128.el5.img lost+found symvers-2.6.18-128.el5.gz System.map-2.6.30.10 vmlinuz-2.6.18-128.el5
Hmmm no initrd-2.6.30.10.img
To create the dependencies for the modules:
$ depmod 2.6.30.10
Create a new initrd with mkinitrd
$ mkinitrd -v /boot/initrd-2.6.30.10.img 2.6.30.10
Creating initramfs
Looking for deps of module ehci-hcd
Looking for deps of module ohci-hcd
Looking for deps of module uhci-hcd
Looking for deps of module ext3: jbd
Looking for deps of module jbd
Found root device hda2 for LABEL=/
Looking for driver for device hda2
Looking for deps of module ide:m-disk
Looking for driver for device hda3
Looking for deps of module ide:m-disk
Looking for deps of module ips: scsi_mod
Looking for deps of module scsi_mod
Looking for deps of module sd_mod: scsi_mod
Looking for deps of module ata_piix: scsi_mod libata
Looking for deps of module libata: scsi_mod
Looking for deps of module ide-disk
Looking for deps of module dm-mem-cache
No module dm-mem-cache found for kernel 2.6.30.10, aborting.
Opps errors …… Need to fix this
$ echo “DMRAID=no” > /etc/sysconfig/mkinitrd/noraid
$ chmod 755 /etc/sysconfig/mkinitrd/noraid
$ mkinitrd -v /boot/initrd-2.6.30.10.img 2.6.30.10
Creating initramfs
Looking for deps of module ehci-hcd
Looking for deps of module ohci-hcd
Looking for deps of module uhci-hcd
Looking for deps of module ext3: jbd
Looking for deps of module jbd
Found root device hda2 for LABEL=/
Looking for driver for device hda2
Looking for deps of module ide:m-disk
Looking for driver for device hda3
Looking for deps of module ide:m-disk
Looking for deps of module ips: scsi_mod
Looking for deps of module scsi_mod
Looking for deps of module sd_mod: scsi_mod
Looking for deps of module ata_piix: scsi_mod libata
Looking for deps of module libata: scsi_mod
Looking for deps of module ide-disk
Using modules: /lib/modules/2.6.30.10/kernel/drivers/usb/host/ehci-hcd.ko /lib/modules/2.6.30.10/kernel/drivers/usb/host/ohci-hcd.ko /lib/modules/2.6.30.10/kernel/drivers/usb/host/uhci-hcd.ko /lib/modules/2.6.30.10/kernel/fs/jbd/jbd.ko /lib/modules/2.6.30.10/kernel/fs/ext3/ext3.ko /lib/modules/2.6.30.10/kernel/drivers/scsi/scsi_mod.ko /lib/modules/2.6.30.10/kernel/drivers/scsi/sd_mod.ko /lib/modules/2.6.30.10/kernel/drivers/scsi/ips.ko /lib/modules/2.6.30.10/kernel/drivers/ata/libata.ko /lib/modules/2.6.30.10/kernel/drivers/ata/ata_piix.ko
/sbin/nash -> /tmp/initrd.w19233/bin/nash
/sbin/insmod.static -> /tmp/initrd.w19233/bin/insmod
copy from `/lib/modules/2.6.30.10/kernel/drivers/usb/host/ehci-hcd.ko’ [elf64-x86-64] to `/tmp/initrd.w19233/lib/ehci-hcd.ko’ [elf64-x86-64]
copy from `/lib/modules/2.6.30.10/kernel/drivers/usb/host/ohci-hcd.ko’ [elf64-x86-64] to `/tmp/initrd.w19233/lib/ohci-hcd.ko’ [elf64-x86-64]
copy from `/lib/modules/2.6.30.10/kernel/drivers/usb/host/uhci-hcd.ko’ [elf64-x86-64] to `/tmp/initrd.w19233/lib/uhci-hcd.ko’ [elf64-x86-64]
copy from `/lib/modules/2.6.30.10/kernel/fs/jbd/jbd.ko’ [elf64-x86-64] to `/tmp/initrd.w19233/lib/jbd.ko’ [elf64-x86-64]
copy from `/lib/modules/2.6.30.10/kernel/fs/ext3/ext3.ko’ [elf64-x86-64] to `/tmp/initrd.w19233/lib/ext3.ko’ [elf64-x86-64]
copy from `/lib/modules/2.6.30.10/kernel/drivers/scsi/scsi_mod.ko’ [elf64-x86-64] to `/tmp/initrd.w19233/lib/scsi_mod.ko’ [elf64-x86-64]
copy from `/lib/modules/2.6.30.10/kernel/drivers/scsi/sd_mod.ko’ [elf64-x86-64] to `/tmp/initrd.w19233/lib/sd_mod.ko’ [elf64-x86-64]
copy from `/lib/modules/2.6.30.10/kernel/drivers/scsi/ips.ko’ [elf64-x86-64] to `/tmp/initrd.w19233/lib/ips.ko’ [elf64-x86-64]
copy from `/lib/modules/2.6.30.10/kernel/drivers/ata/libata.ko’ [elf64-x86-64] to `/tmp/initrd.w19233/lib/libata.ko’ [elf64-x86-64]
copy from `/lib/modules/2.6.30.10/kernel/drivers/ata/ata_piix.ko’ [elf64-x86-64] to `/tmp/initrd.w19233/lib/ata_piix.ko’ [elf64-x86-64]
Adding module ehci-hcd
Adding module ohci-hcd
Adding module uhci-hcd
Adding module jbd
Adding module ext3
Adding module scsi_mod
Adding module sd_mod
Adding module ips
Adding module libata
Adding module ata_piix
Checking …….
$ ls /boot/initrd-2.6.30.10.img
initrd-2.6.30.10.img
Editing grub
Final phase, it remains only edit the grub.conf to use the new kernel.
Add the lines in and change default to boot with new kernel
title CentOS (2.6.30.10)
root (hd0,0)
kernel /vmlinuz-2.6.30.10 ro root=LABEL=/ rhgb quiet noacpi irqpoll acpi=off
initrd /initrd-2.6.30.10.img
Reboot. and check
$ reboot
After reboot
$ uname -a
Linux localhost.localdomain 2.6.30.10 #1 SMP Sat Jul 17 13:25:46 IST 2010 x86_64 x86_64 x86_64 GNU/Linux
KVM on centos5
Disable Selinux
Make sure that SELinux is disabled. Open /etc/selinux/config…
$ vi /etc/selinux/config
… set SELINUX to disabled:
$ reboot
or
Run
$ setenforce 0
[edit] Installing KVM
check if your CPU supports hardware virtualization
$ egrep ‘(vmx|svm)’ –color=always /proc/cpuinfo
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 syscall nx lm constant_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr lahf_lm
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 syscall nx lm constant_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr lahf_lm
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 syscall nx lm constant_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr lahf_lm
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 syscall nx lm constant_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr lahf_lm
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 syscall nx lm constant_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr lahf_lm
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 syscall nx lm constant_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr lahf_lm
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 syscall nx lm constant_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr lahf_lm
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 syscall nx lm constant_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr lahf_lm
install KVM and virtinst
$ yum install zlib-devel alsa-lib-devel SDL-devel gnutls-devel dev86 texi2html glibc-devel kvm qemu\
libvirt python-virtinst virt-manager libvirt libvirt-python python-virtinst qemu
$ yum install kvm qemu libvirt python-virtinst
$ yum install virt-manager libvirt libvirt-python python-virtinst
In case rpmforge repo is recquired for qemu
$ rpm -Uhv http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS//rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
[edit] Service Starting
Then start the libvirt daemon:
$ /etc/init.d/libvirtd start
To check if KVM has successfully been installed, run
$ virsh -c qemu:///system list
Id Name State
———————————-
Next we need to set up a network bridge on our server so that our virtual machines can be accessed from other hosts as if they were physical systems in the network.
$ yum install bridge-utils
… and configure a bridge. Delete the system startup links for NetworkManager and create system startup links for network:
$ chkconfig –del NetworkManager
$ chkconfig –levels 235 network on
[edit] Networking
Then create the file /etc/sysconfig/network-scripts/ifcfg-br0 (please use the BOOTPROTO, DNS1 (plus any other DNS settings, if any), GATEWAY, IPADDR, NETMASK and SEARCH values from the /etc/sysconfig/network-scripts/ifcfg-eth0 file):
$ vi /etc/sysconfig/network-scripts/ifcfg-br0
DEVICE=br0
TYPE=Bridge
BOOTPROTO=static
DNS1=192.168.2.234
GATEWAY=192.168.2.234
IPADDR=192.168.40.112
NETMASK=255.255.0.0
ONBOOT=yes
Modify /etc/sysconfig/network-scripts/ifcfg-eth0 by keeping these lines and hashing everything else
DEVICE=eth0
HWADDR=00:1E:C9:B5:0D:51
ONBOOT=yes
BRIDGE=br0
Then reboot the system:
$ reboot
[edit] Starting Hosts
Use graphical installation and run “Creating guests with virt-manager”
$ virt-manager &
Open the File -> Open Connection. The dialog box below appears. . Select a hypervisor and click the Connect button
OR
$ virt-install –accelerate –hvm –connect qemu:///system –network bridge:br0 –name rhel5support –ram=512 –file=/xen/rhel5support.img –file-size=6 –vnc –cdrom=/dev/cdrom
Using virt-install with KVM to create a Red Hat Enterprise Linux 5 guest using cdrom –hvm (full virt)
$ virt-install –name fedora11 –ram 512 –file=/var/lib/libvirt/images/fedora11.img –file-size=3 –vnc –cdrom=/var/lib/libvirt/images/fedora11.iso
Using virt-install to create a fedora 11 guest
[edit] Info
the xml files are loacted at
$ cd /etc/libvirt/qemu/
Starting the virt machines
$ virsh create kvm2.xml
List domains
$ virsh -c qemu:///system list
Id Name State
———————————-
1 kvm2 running
2 kvm1 running
Connect to kvm
$ virsh console kvm1
[edit] Managing Virtual Machines from the command line with `virsh`
Virtual machines can be managed on the command line with the virsh utility. The virsh utility is built around the libvirt management API and has a number of advantages over the traditional Xen xm tool:
virsh has a stable set of commands whose syntax & semantics will be preserved across updates to Xen.
virsh can be used as an unprivileged user for read-only operations (eg listing domains, getting info, etc)
virsh will (in future) be able to manage QEMU, VMWare, etc machines in additional to Xen, since libvirt is hypervisor agnostic.
To start a new virtual machine from an XML vm definition:
$ virsh create
To list the virtual machines currently running, use:
$ virsh list
To gracefully power off a guest use:
$ virsh shutdown
To save a snapshot of the machine to a file of your choosing:
$ virsh save
To restore a previously saved snapshot:
$ virsh restore
To export the XML config associated with a virtual machine:
$ virsh dumpxml <virtual machine (name | id | uuid)
For a complete list of commands available for use with virsh run:
$ virsh help
Or consult the manual page virsh(1)
-
Recent
- KDE remove autostart programs
- GPS on Linux
- Debian Squeeze change root password
- Download YouTube Videos on Linux
- Pidgin + The certificate for omega.contacts.msn.com could not be validated
- Tata Phonone / Reliance Netconnect (wvdial)
- mp3 on fedora-13
- Linux disk cache
- redhat/centos build kernel rpm
- KVM on centos5
- File Password Protection
- Building modules for rhel5 kernel
-
Links
-
Archives
- November 2011 (1)
- July 2011 (1)
- April 2011 (1)
- January 2011 (1)
- November 2010 (1)
- September 2010 (2)
- July 2010 (3)
- March 2010 (1)
- January 2010 (5)
- December 2009 (1)
- April 2009 (1)
- January 2009 (1)
-
Categories
-
RSS
Entries RSS
Comments RSS