tag:blogger.com,1999:blog-66091715052224477772024-03-12T19:50:11.036-07:00Yet Another Linux BlogAnonymoushttp://www.blogger.com/profile/05933136031580025217noreply@blogger.comBlogger7125tag:blogger.com,1999:blog-6609171505222447777.post-2170856380532343202012-06-03T03:53:00.000-07:002012-06-04T02:51:24.315-07:00Conky Setup With Gmail and MPD cover<div dir="ltr" style="text-align: left;" trbidi="on">
Conky is a super lightweight system monitor and status which supports many features. It has been long time since I found a good conky script that satisfies me. So Crawling the net I managed to collect some scripts, combine them, modify them, and finally create some additional ones from scratch.<br />
<div>
<br /></div>
<div>
<b>The Result: </b></div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEia2dALCmZ-dmmuyCsAxeYuMjDCuoANM0HQMNicbcSLyQffV02kk7pR45CjSBe65enycL9GasosJVV7YSYmTZg0CK2b96sQ8U9TMj5tC9sA9P0LXOEWa9Mz8k0Bw5SZHD0gCGErbJoR_O8O/s1600/desktop2-june_2012.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="223" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEia2dALCmZ-dmmuyCsAxeYuMjDCuoANM0HQMNicbcSLyQffV02kk7pR45CjSBe65enycL9GasosJVV7YSYmTZg0CK2b96sQ8U9TMj5tC9sA9P0LXOEWa9Mz8k0Bw5SZHD0gCGErbJoR_O8O/s400/desktop2-june_2012.png" width="400" /></a></div>
<div>
<br /></div>
<div>
<b><br /></b><br />
<b>The Steps: </b></div>
<div>
<b><br /></b></div>
<div>
1. Download and copy the file from <a href="https://hotfile.com/dl/158142939/3bef9f2/qorrow_conky.tar.html">here</a>.</div>
<div>
2. Extract the file to your home folder :</div>
<div>
<span style="background-color: white; color: blue;"><br /></span></div>
<div>
<span style="background-color: white; color: blue;"> cd </span></div>
<div>
<span style="background-color: white; color: blue;"> tar xvf qorrow_conky.tar</span></div>
<div>
<br /></div>
<div>
3. Rename the file _conkyrc to .conkyrc. Also rename the folder _conky to .conky</div>
<div>
<br /></div>
<div>
4. Replace every instance of home directory path in .conkyrc with your home directory.</div>
<div>
<br /></div>
<div>
5. Edit the gmail.sh file replacing your gmail login and password (if you want conky to display your mails)</div>
<div>
<br /></div>
<div>
6. For mpd cover fetching to work properly edit the mpdcover.sh :</div>
<div>
6.1 Adjust the variables : music_dir= <-- put your mpd music library directory here.</div>
<div>
6.2 coverlovin_script= <-- put the path to the file coverlovin file (recommended vaule : /home/<your_name>/.conky/coverlovin.py</div>
<div>
<br />
Note 1 : mpc should be installed, cover fetching depends on it.</div>
<div>
Note 2 : The file is customized for my laptop resolution, so play with the size and gap values in .conkyrc to adjust it for your machine.</div>
<div>
<br /></div>
<div>
That is it, run the conky : </div>
<div>
conky &</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
</div>Anonymoushttp://www.blogger.com/profile/05933136031580025217noreply@blogger.com0tag:blogger.com,1999:blog-6609171505222447777.post-79095077477853082072012-04-24T14:59:00.000-07:002012-04-25T07:32:58.171-07:00Wireless Bridging For KVM<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial, Helvetica, sans-serif;">This tutorial aims to establish a wireless bridge between the host wireless interface and the guest Ethernet interface. The guest will behave as standalone machine with dedicated IP address and has full connectivity to the outside world. Even SSH between the host and the guest is available.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Keep in mind that this procedure works only with assigning the guest a static IP address not DHCP but the host can get its IP with static or DHCP.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">1. First install parprouted pakcage :</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">In CentOS :</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span><br />
<span style="background-color: white; color: blue; font-family: Times, 'Times New Roman', serif;">yum install parprouted</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">2. Enable IP forwarding in your host:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span><br />
<span style="background-color: white; color: blue; font-family: Times, 'Times New Roman', serif;">echo 1 > /proc/sys/net/ipv4/ip_forward</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">3. Configure the tap interface :</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span><br />
<span style="background-color: white; color: blue; font-family: Times, 'Times New Roman', serif;">tunctl -t tap0</span><br />
<span style="background-color: white; color: blue; font-family: Times, 'Times New Roman', serif;">ip link set tap0 up</span><br />
<span style="background-color: white; color: blue; font-family: Times, 'Times New Roman', serif;">ip addr add 10.10.10.10/32 dev tap0</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Important : the ip address of tap interface does not have to be in the same subnet of your wireless and guest IP addresses. For my case the wireless addresses in the subnet 192.168.0.0 network and tap0 is in 10.0.0.0 network, but the guest IP address MUST be on the same network of the wireless interface.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">4. Bridge your wireless LAN interface with the tap interface :</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span><br />
<span style="background-color: white; color: blue; font-family: Times, 'Times New Roman', serif;">parprouted ra0 tap0</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">My wireless interface is ra0 so replace with your interface (maybe wlan0)</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">5. If iptables firewall is active , we <b>MUST</b> add rules for allowing connections through tap0 :</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span><br />
<span style="background-color: white; color: blue; font-family: Times, 'Times New Roman', serif;">vi /etc/sysconfig/iptables</span><br />
<span style="background-color: white; color: blue; font-family: Times, 'Times New Roman', serif;"><br /></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">and add the following :</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span><br />
<br />
<span style="background-color: white; color: blue; font-family: Times, 'Times New Roman', serif;">-A INPUT -i tap0 -j ACCEPT </span><br />
<span style="background-color: white; color: blue; font-family: Times, 'Times New Roman', serif;">-A FORWARD -i tap0 -j ACCEPT </span><br />
<span style="background-color: white; color: blue; font-family: Times, 'Times New Roman', serif;">-A FORWARD -o tap0 -j ACCEPT </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">6. Now the bridge is ready. Start your VM :</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span><br />
<span style="background-color: white; color: blue; font-family: Times, 'Times New Roman', serif;">qemu-kvm -hda test.img -m 512 -net nic -net tap,ifname=tap0,script=no</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">I faced a little problem with the vnc connection : there was two mouse cursors and that was annoying and the solution is simple; add the option</span><br />
<span style="background-color: white; color: blue; font-family: Times, 'Times New Roman', serif;"> -usb -usbdevice tablet</span><span style="font-family: Arial, Helvetica, sans-serif;"> to the last qemu-kvm command.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">7. Inside the guest VM configure its interface with static IP address and this step depends on the type of your guest operating system. Remember : the same subnet of your wireless inerface. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Example : wlan0 address : 192.168.0.2 </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> Guest IP address : 192.168.0.3</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Also configure your guest DNS and Default gateway as that of your host.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span><br />
<br />
<br /></div>Anonymoushttp://www.blogger.com/profile/05933136031580025217noreply@blogger.com1tag:blogger.com,1999:blog-6609171505222447777.post-16591013047487919722012-04-07T15:23:00.000-07:002012-04-08T01:43:42.680-07:00Adding Additional Options to DHCP Client on Centos<div dir="ltr" style="text-align: left;" trbidi="on">
I struggled to solve this :)<br />
I wanted to add a dns server to /etc/resolv.conf before the name server the client gets from dhcp server.<br />
<br />
In Debian based linux the procedure is to add the option to /etc/dhclient.conf or similar then restart the network or bring up the interface, But in Centos / RHEL there is some trick :<br />
<br />
<b>You have to create a file named dhclient-<i><interface_name></i>.conf in the /etc.</b><br />
<br />
Example :<br />
<br />
To add another dns for the eth0 interface create :<b> /etc/dhclient-eth0.conf</b><br />
file and add this line to it :<br />
<div style="background-color: white; color: blue;">
prepend domain-name-servers 10.1.1.1;</div>
<br />
Where 10.1.1.1 is your additional name server<br />
<br />
In fact it is more logical as you can have different settings for different interfaces.<br />
<br />
<br /></div>Anonymoushttp://www.blogger.com/profile/05933136031580025217noreply@blogger.com0tag:blogger.com,1999:blog-6609171505222447777.post-52702353727209796272012-04-02T11:30:00.000-07:002012-04-02T11:31:30.161-07:00Anaconda Headless Rescue Mode<div dir="ltr" style="text-align: left;" trbidi="on">
One of the options you can pass to the grub boot entry options is the keyword : telnet<br />
<br />
Combined with assigning a static ip address for you machine you can remote rescue in case of troubles.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8xIHn55mPYIxZGsJl5heZSm0Xawwvtv9PjpPG6KWLjlhTOv10s3hsFw9maPbSHTrXp-EnKFYl0BQEbY-KpNWjcujlwxATUfRBzMxFOiw7QtEwchn2bbSh5-DpWpMOxAFaC3YTYSLSDGPP/s1600/Screenshot-1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="262" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8xIHn55mPYIxZGsJl5heZSm0Xawwvtv9PjpPG6KWLjlhTOv10s3hsFw9maPbSHTrXp-EnKFYl0BQEbY-KpNWjcujlwxATUfRBzMxFOiw7QtEwchn2bbSh5-DpWpMOxAFaC3YTYSLSDGPP/s400/Screenshot-1.png" width="400" /></a></div>
<br />
Then anaconda will wait for your telnet connection<br />
<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi54Pfj8IILCH3toFbMesSv0IrcUr2U_M0cn0HgxjhBzJI5xoRZ2ujGEHa3_6-wiC9wYuklvS4pEiYbWlQ5AHq5vLeMYfiLNbm8sZ0FjX8nTpt0-tG83Wo1sW_QVDalErSnHbKsz8ZTeBeP/s1600/Screenshot-2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="252" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi54Pfj8IILCH3toFbMesSv0IrcUr2U_M0cn0HgxjhBzJI5xoRZ2ujGEHa3_6-wiC9wYuklvS4pEiYbWlQ5AHq5vLeMYfiLNbm8sZ0FjX8nTpt0-tG83Wo1sW_QVDalErSnHbKsz8ZTeBeP/s400/Screenshot-2.png" width="400" /></a></div>
<br />
Finally, from your remote machine you can telnet to the machine :<br />
<br />
<div style="background-color: white; color: blue; font-family: "Courier New",Courier,monospace;">
telnet 192.168.1.100</div>
<br />
You are in rescue mode and you can do whatever you like to rescue the system.</div>Anonymoushttp://www.blogger.com/profile/05933136031580025217noreply@blogger.com0tag:blogger.com,1999:blog-6609171505222447777.post-14877574366885144932012-04-02T04:44:00.000-07:002012-04-02T04:45:02.775-07:00Redirecting Bacula Console Command's Output<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="font-family: Arial,Helvetica,sans-serif;">
Working with bconsole , Sometimes the output of certain commands is so long that it scrolls fast and yout terminal history size will not be sufficient to catch all the output. For example : </div>
<div style="font-family: Arial,Helvetica,sans-serif;">
<br /></div>
<div style="background-color: white; color: blue; font-family: "Courier New",Courier,monospace;">
*list files jobid=32</div>
<div style="font-family: Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: Arial,Helvetica,sans-serif;">
The output was 29870 lines .. so either set your terminal history size to 30000 and keep scrolling and sacrificing your RAM or use the redirecting way!</div>
<div style="font-family: Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: Arial,Helvetica,sans-serif;">
<b><u>The Redirecting Way:</u></b></div>
<div style="font-family: Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: Arial,Helvetica,sans-serif;">
While on bconsole command :</div>
<div style="font-family: Arial,Helvetica,sans-serif;">
<br /></div>
<div style="background-color: white; color: blue; font-family: "Courier New",Courier,monospace;">
*@output testfile</div>
<div style="background-color: white; color: blue; font-family: "Courier New",Courier,monospace;">
*list files jobid=32</div>
<div style="background-color: white; color: blue; font-family: "Courier New",Courier,monospace;">
*@output</div>
<div style="font-family: Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: Arial,Helvetica,sans-serif;">
where testfile is the name of the output file required.</div>
<div style="font-family: Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: Arial,Helvetica,sans-serif;">
Now you can easily less or grep yout new file. </div>
</div>Anonymoushttp://www.blogger.com/profile/05933136031580025217noreply@blogger.com0tag:blogger.com,1999:blog-6609171505222447777.post-7514175494878259012012-03-26T12:30:00.001-07:002012-04-02T04:46:16.304-07:00Creating Permanent Bridged Network Interface<div dir="ltr" style="text-align: left;" trbidi="on">
This is very useful in many cases like if you want to add additional security layer using firewall or if you want to rum KVM virtualizaions with permanent interfaces accessed by the hosts as if the guest is a real machine.<br />
<br />
I am using Centos 6.2 64 bit and I am using DHCP for assigning IP addressed and DNS and other configurations<br />
<br />
1. Install bridge-utils :yum install bridge-utils<br />
2. Bring down the interfaces eth0 : ifdown eth0<br />
3. Edit the configuration file of the eth0 interface to use the bridge and create a new file for the bridge :<br />
<br />
vi /etc/sysconfig/network-scripts/ifcfg-eth0<br />
DEVICE="eth0"<br />
NM_CONTROLLED="yes"<br />
ONBOOT="yes"<br />
HWADDR=64:31:50:04:93:B9<br />
TYPE=Ethernet<br />
BOOTPROTO=dhcp<br />
DEFROUTE=yes<br />
PEERDNS=yes<br />
PEERROUTES=yes<br />
IPV4_FAILURE_FATAL=yes<br />
IPV6INIT=no<br />
NAME="System eth0"<br />
# <br />
<b>BRIDGE=br0</b><br />
<br />
The most important line is BRIDGE=br0 where br0 is the name of the bridge device we shall create.<br />
<br />
vi /etc/sysconfig/network-scripts/ifcfg-br0<br />
<br />
DEVICE=br0<br />
<b>TYPE=Bridge</b><br />
BOOTPROTO=dhcp<br />
ONBOOT=yes<br />
DELAY=0<br />
<br />
Note the line TYPE=Bridge <br />
<br />
4. The most important part that peventing the bridge from functioning properly was the line : UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03 in the ifcfg-eth0 file so I commented it out.<br />
<br />
5 .Bring up the interfaces : ifup eth0 ; ifup br0;<br />
<br />
6. Configure the iptables firewall to accept connections from the new bridge interface br0 :<br />
<br />
vi /etc/sysconfig/iptables<br />
<br />
Add this line : <b>-A INPUT -i br0 -j ACCEPT</b><br />
<br />
7. Restart the iptables and network services<br />
<br />
service network restart<br />
service iptables restart<br />
<br />
That is it !<br />
<br />
<br /></div>Anonymoushttp://www.blogger.com/profile/05933136031580025217noreply@blogger.com0tag:blogger.com,1999:blog-6609171505222447777.post-2625809850375054012012-03-24T12:42:00.002-07:002012-04-02T04:47:48.970-07:00Installing ATI proprietary driver on Centos 6.2<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="font-family: Arial,Helvetica,sans-serif;">
ATI proprietary driver provides many features like 3D accelaration and surpasses the open source driver.Below is the steps of installing it.</div>
<div style="font-family: Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: Arial,Helvetica,sans-serif;">
* All commands issued as root</div>
<div style="font-family: Arial,Helvetica,sans-serif;">
1.Enable the <a href="http://elrepo.org/tiki/tiki-index.php?page=HomePage">Elrepo</a> repository <b>:<span style="font-family: "Courier New",Courier,monospace;">rpm -Uvh </span><a class="wiki external" href="http://elrepo.org/elrepo-release-6-4.el6.elrepo.noarch.rpm" style="font-family: "Courier New",Courier,monospace;" target="_blank">http://elrepo.org/elrepo-release-6-4.el6.elrepo.noarch.rpm</a></b></div>
<div style="font-family: Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: Arial,Helvetica,sans-serif;">
2.Install the fglrx-x11-drv and kmod-fglrx packages :<b> <span style="font-family: "Courier New",Courier,monospace;">yum install kmod-fglrx fglrx-x11-drv</span></b></div>
<div style="font-family: Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: Arial,Helvetica,sans-serif;">
3.Generate and initialize the new driver :<b> </b><span style="font-family: "Courier New",Courier,monospace;"><b>aticonfig --initial</b> </span></div>
<div style="font-family: Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: Arial,Helvetica,sans-serif;">
4.Now you have to reboot the system.</div>
<div style="font-family: Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: Arial,Helvetica,sans-serif;">
5.If you got a black blank screen you need to append "<b>nomodeset</b>" on the kernel in the grub boot loader entry for Centos.To make this permanent you have to edit the grub configuration files to make a new entry with this new option </div>
<div style="font-family: Arial,Helvetica,sans-serif;">
5.1 Create a new file in /etc/grub.d/XX_anyname where XX is a number which is greater than the greater number of scripts in this directory, for example if you have scripts like 11_kdjk 30_linux 40_custom, create a file 50_mynewEntry</div>
<div style="font-family: Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: Arial,Helvetica,sans-serif;">
6.Edit the file adding your centos with nomodeset boot option.I copied the existing centos entry generated by the system and pasted it adding the option :</div>
<div style="font-family: Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<b>#!/bin/sh -e<br />echo "Adding My Centos 6.2 with </b><b>nomodeset option for fglrx to work ..."<br />cat << EOF<br />set root=(hd0,4)<br />menuentry "Centos 6.2 with nomodeset for proprietart ATI driver" --class gnu-linux --class gnu --class os {<br /> insmod part_msdos<br /> insmod ext2<br /> set root='(hd0,msdos4)'<br /> search --no-floppy --fs-uuid --set=root f1c65fc9-acfc-4a39-974b-6c6c38cb29f7<br /> linux /boot/vmlinuz-2.6.32-220.7.1.el6.i686 root=/dev/sda4 </b><b>nomodeset<br /> initrd /boot/initramfs-2.6.32-220.7.1.el6.i686.img</b></div>
<div style="font-family: Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<b>}</b> </div>
<div style="font-family: Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: Arial,Helvetica,sans-serif;">
7.Run <b><span style="font-family: "Courier New",Courier,monospace;">update-grub2</span></b> or <b><span style="font-family: "Courier New",Courier,monospace;">grub-mkconfig</span></b> then <b><span style="font-family: "Courier New",Courier,monospace;">grub-install /dev/sda</span></b></div>
<div style="font-family: Arial,Helvetica,sans-serif;">
(replace /dev/sda) with your hard drive if necessary)</div>
<div style="font-family: Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: Arial,Helvetica,sans-serif;">
8.Reboot and select your new entry. That is it !</div>
<div style="font-family: Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: Arial,Helvetica,sans-serif;">
<br /></div>
<div style="font-family: Arial,Helvetica,sans-serif;">
</div>
</div>Anonymoushttp://www.blogger.com/profile/05933136031580025217noreply@blogger.com0