Tuesday, February 12, 2008

Fedora 8 additional repository

If you are using fedora linux, here are a few additional repositories that you might want to install in addition to the official repository and the installation instruction.

  1. Livna rpm
    • Download the installer from here
    • Install the repository
      • rpm -Uvh livna-release-8.rpm
  2. freshrpms
    • Download the installer from here
    • Install the repository
      • rpm -Uvh freshrpms-release-1.1-1.fc.noarch.rpm
  3. atrpms
    • Import the atrpms signing key
      • rpm --import http://ATrpms.net/RPM-GPG-KEY.atrpms
    • Create atrpms.conf in /etc/yum.repos.d/
      • touch /etc/yum.repos.d/atrpms.conf
    • Add the below lines to the atrpms.conf file
      • [atrpms]
        name=Fedora Core $releasever - $basearch - ATrpms
        baseurl=http://dl.atrpms.net/f$releasever-$basearch/atrpms/stable
        gpgkey=http://ATrpms.net/RPM-GPG-KEY.atrpms
        gpgcheck=1
You can start using yum to install any software and yum will pick source from these new repositories straight away.

Monday, February 11, 2008

Accessing data on xen lvm guest image

Accessing xen guest image is very easy if the image is not lvm partitioned. But the main problem arise when the image is of lvm format and normal mount command cannot be used. Here I will show both the way. The first is when ext filesystem is used, and the second is when lvm is used.

To mount xen guest image (without lvm)

1. check the partition on the image
# fdisk -lu
The result will be something like this:



2. Mount using offset option
# mount -o loop,offset=106929152 /path/to/image /mnt
where 106929152=208846*512, 208846 is the start of the partition. Using this way, you only mount the second partition and not the whole image

3. You can now access your image at /mnt

To mount xen guest image (with lvm)

1. Check the partition on the image
# fdisk -lu /path/to/image

2. You have to install kpartx to handle lvm partiton
# yum install kpartx

3. Run kpartx on the image
# kpartx -av /path/to/image

4. Run vgscan to scan volume group available
# vgscan

5. Run vgchange to activate the volume group in the image
# vgchange -ay VolGroup00

6. Use lvs to see what is the name of your low volume group
# lvs

7. Mount the low volume group
# mount /dev/VolGroup00/LogVol01 /mnt

8. You can access your lvm image at the mounted directory which is /mnt

9. To unmount it, a few commands have to be executed (umount for unmounting, vgchange -an to deactivate volume group, kpartx -d to delete device map and losetup -d to delete loop device used)
# umount /mnt/
# vgchange -an VolGroup00
# kpartx -d /path/to/image
# losetup -d /dev/loop0

Hope this will be useful

Friday, February 1, 2008

Text viewer

To view text in linux, there are several tools that one can use. The purpose of the text viewer is to view the text file and not editing it. Some of it also equipped with search function to ease reading.
If you are using GUI, you can use gedit, which is available if you are using gnome desktop environment. Gedit works as both editor and viewer. If you are using KDE desktop, you can use KEdit.

In the absence of GUI, a few tools can be used, such as less and more. These 2 tools is quite similar with only the difference in name.
To use less:
# less filename

and similarly to use more:
# more filename

Another tool that can be used is cat. Cat's purpose is to concatenate 2 file into one, but if used to a single file, cat will display the file to standard output. To use cat:
# cat filename

Thursday, January 17, 2008

Installing multimedia codecs in linux

Codecs, is an important element when we are talking about playing and watching multimedia files. To install codecs on linux box, it is an easy task. Just follow the below instructions :-) :

  1. Download the codecs source from here. Thank you to the mplayer team for this magnificent codecs source.
  2. Login as superuser
    • # su -
  3. Extract the downloaded archive
    • # tar -xvjf all-20061022.tar.bz2
  4. Make 2 directories if they are not already exist.
    • # mkdir /usr/local/lib/codecs
    • # mkdir /usr/lib/win32
  5. Copy the content of the extracted directory to the newly created directory
    • # cp all-20061022/* /usr/local/lib/codecs
    • # cp all-20061022/* /usr/lib/win32
  6. Change the permission of the directories to 755
    • # chmod 755 /usr/local/lib/codecs
    • # chmod 755 /usr/lib/win32
  7. Finish. Congratulations, you have managed to install multimedia codecs into your linux box. You can test it by playing any video with your favorite media player.

Monday, January 14, 2008

Backup using tar and ssh

Doing backup is important. You do not want to store your backup at the same machine where the data is stored. It is to avoid data loss when the machine broke down. To do this job, you can use tar paired with ssh to archive your important data and transfer it through network to another machine. Below are the steps:

1. Make sure the backup machine is installed with ssh server and the service is running
# yum install openssh-server
# service sshd start

2. Go to the folder where you want to backup. Use tar to archive and send it though network to backup machine
# tar -cvjf - /path/to/backup | ssh user@backupmachine "cat > /home/backup.tar.bz2"

3. Finish. Congatulations, your backup file is now safely kept in the backup machine