I love Free Software!

Pages

Funny Quotes to Think

When you say "I wrote a program that crashed Windows", people just stare at You blankly and say "Hey, I got those with the system, for free"

-Torvalds, Linus(1995-03-08)-

Saturday, July 10, 2010

Create a virtual HDD using qemu-img

When you create a virtual machine using KVM and virt-manager, virtual HDD will create in /var/lib/libvirt/images/ directory. Unfortunately I dont have enough  space in my / partition.
I faced difficulty in creating virtual HDD in other partion using virt-manager. To work around this issue, I used qemu-image. Using qemu-img you can create a new vitual HDD with any size on any of your partition

 # qemu-img create -f qcow debian.qcow 5G

This will create a Virtual HDD debain.qcow with size 5GB, later then you can select this HDD for installation using virt-manager

Create a shared network interface for KVM

KVM Virtual machines uses its own virtual network as the default network. If you want to access your virtual machine inside your LAN, you need to change your virtual network interface to shared network interface.

How to create shared interface ??
Configure your physical interface as a bridge in your machine (not in virtual machine). Then you can create a new network interface for you virtual machine with source interface as bridge

Here in my machine I have one interface eth0. I changed my physical interface to a bridge interface so that any of my virtual machine can share my physical interface for networking

edit your network configuration

 # vi /etc/network/interfaces

Change your configuration to make your interface eth0 as a bridge

auto eth0
iface eth0 inet manual

auto bro
iface br0 inet static
         address 192.168.1.10
         netmask 255.255.255.0
         gateway 192.168.1.1
         bridge-ports eth0
         bridge-stp on
         bridge-maxwait 0

This will create a bridge interface br0

Wednesday, July 7, 2010

Apache redirect webiste to another using mod_rewrite

In some situation you may need to redirect your website to another website.
For example I have two domains example.net and example.com. Since I don't have any web pages uploaded for example.net,  I just want to redirect example.net to my existing site example.com.

Create an Apache virtual host for example.net and redirect your website using mod_rewrite.

You can look apache site for more details about mod_rewrite module. Apache Rewrite Module

Here is my virtualhost configuration for example.net

<VirtualHost *:80>
    ServerAdmin admin@example.net
    DocumentRoot /var/www/example.net
    ServerName example.net
    ServerAlias www.example.net

<Directory /var/www/example.net>
Options +FollowSymLinks
RewriteEngine on
Redirect 301 / http://example.com/
RewriteCond %{HTTP_HOST} ^([^.:]+\.)*example\.net\.?(:[0-9]*)?$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]
</Directory>
</VirtualHost>

Thursday, June 17, 2010

Mount samba share on Linux

This is the way to mount samba share in your linux machine
  • Install smbfs package
# aptitude install smbfs

  • Create a mount point to mount your samba share

# mkdir /mnt/smbshare
  • mount samba share using mount command
# mount -t smbfs -o username=user,password=pass //smbserver/share /mnt/smbshare

Here user is the samba user who have access to the share. pass is the password for user. smbserver is machine name where samba is configured. share is the shared directory in samba server.

  • Adding samba mount to fstab

We can add mount to fstab, so that system will mount samba share every time system reboot
similar fstab entry is like this

//smbserver/share  /mnt/smbshare  smbfs  defaults,user,noauto,username=user,password=pass  0  0

Saturday, May 29, 2010

Sync your samba password using roundcube password plugin

Why I require this patch ?

Roundcube password plugin does not sync samba password. This patch can sync your samba password using roundcube password plugin

Apply this patch at your own risk . Dont forget to use --dry-run option before running this patch

How  to apply patch ?

  • Download patch file from download link listed below.
  • Copy patch file to directory /usr/share/roundcube/plugins/password/drivers.
  • For a safer side take a backup of your original ldap.php file.

        # cp ldap.php ldap.php.org
  • Now patch your ldap.php file.  


        #  patch -p0 < rcldappasswd.patch  
 
Where can I download this patch ?

I have uploaded the patch in below location.

Download RCLdapPatch

Saturday, May 8, 2010

Configure Modem Dial-in Debian

Install ppp and mgetty

aptitude install ppp pppconfig mgetty

Configure ppp using pppconfig

create users in /etc/ppp/pap-secrets

# client        server  secret                  IP addresses
dial-in              *       dial-in                       *


Configure /etc/mgetty/mgetty.config. if your modem is connected to /dev/ttyS0. Comment below lines

port ttyS0
  debug 3
  data-only y


Configure /etc/mgetty/dialin.config
add below lines at end of file
all

Check following lines are uncommented in /etc/mgetty/login.config
/AutoPPP/ -     a_ppp   /usr/sbin/pppd auth -chap +pap login debug

Add below lines to /etc/inittab
s0:23:respawn:/sbin/mgetty ttyS0

Now dial from your windows machine. For authentication you can use user dial-in

Tuesday, March 30, 2010

Sending HTML mails using RT web interface

Request Tracker uses templates to send mails. For replying mails RT is using Correspondence template.
Change your Correspondence templates in such a way that it use Content-Type as text/html 

Correspondence template:

Content-Type: text/html
     RT-Attach-Message: yes

     {$Transaction->Content()}