Tuesday, February 27, 2007

Configuring Yum in RHEL5 for DVD source

In my last article I explained the problem I faced with the installation of software in RHEL5 Beta2. I tried system-config-packages and the old "rpm" command but nothing worked as it used to in earlier days. So I thought to dig into this thing and tried to find the possible cause and solution to this problem.

So I went on to GNU/Linx community and put up this question. Okay I got some inputs some directions and finally I got what I wanted. First of all let me tell you the scenario once more so that you can better get what I want to say.

Suppose you have installed a RHEL5 system and now after the installation is complete you want to install a package (which is not installed). You put in the DVD and mount it. Go to the said directory and try to install the package via the well old "rpm" command. But to your surprise you found that it failed due to dependency problems. Okay no problem. We all know how to deal with it. We use the "--aid" switch with our "rpm" command that will automatically install the dependency rpm first then the said rpm. Well we try that but it again failed with the same error message. That means it's not finding the dependency rpm. But wait. The dependency rpm and the rpm we want to install both are in the same directory then why is the "rpm" command failing.

Well that's because in RHEL5 (as in Fedora Core 6) all the things are controlled by "yum". I read somethings about "yum" and quickly found that it had problem with dvd sources. But I didn't found any thing on how to disable "yum" completely and go through the well old command line way of installing packages. But I found a way out by which "yum" can access DVD sources and if that happens we can install/un-install packages easily either via graphical tool(system-config-packages) or the command line via "yum" command.

Okay so let's start this.I inserted the RHEL5 Client DVD and mounted it on /media/dvd/


mkdir -p /media/dvd
mount /dev/dvd /media/dvd


Then I created a ISO file for this DVD using the "mkisofs" command.

mkisofs -o /opt/RHEL5.iso -r /media/dvd/

The above command took sometime as I was creating a image file for my DVD (approx 3.6GB). Well after sometime it finished. Now was the time to do the real job. There was no use of the DVD so i unmounted and ejected it.


umount /media/dvd/
eject


Now I created a directory which will act as mount point for the ISO file I created earlier.


mkdir -p /dvd/actual


Now I mounted the ISO file onto the above mount point. Note that to mount the ISO file we need to use special options. So let's see what is the command.


mount -r -o loop -t iso9660 /opt/RHEL5.iso /dvd/actual


The above command mounted the RHEL5 ISO on /dvd/actual. Now I went to the mount point directory and installed a rpm called "createrepo".


cd /dvd
rpm -Uvh actual/Client/creatrepo*


The need for this RPM arises because the DVD of RHEL5 (also of FC6) has "media:" written in it's metadata that creates problem with "yum". Now by using this createrepo I will create a copy of my own for the repodata that will not be having the "media:" thing and that will help me use the repodata with "yum" and hence the software using "yum" too like "system-config-packages" or "pirut".

Now it's time to create the repodata. This is how I did that (note: I didn't changed my current directory. Was where I was previously).


createrepo .


Above command indexed around 2239 Packages and created a repodata/ directory in the current directory of around 8.1 MB. This directory had the repomod.xml and other metadata files. Actually what it did was it indexed all the RPM's present in the current directory, that was "/dvd". So I had rpm's in

/dvd/actual/Client, /dvd/actual/VT, /dvd/actual/Workstation

All got indexed and the metadata was created.

I also copied the GPG key files to my hard disk (to tell yum to use them later).


cp /dvd/actual/*GPG* /opt


There were around 4-5 GPG files they got copied to /opt. Later we will see that we can make "yum" to read these GPG key files and verify a package before installing.

Now finally came the time to tell yum to use this repo to for my installations. That was done by creating a repo file in /etc/yum.repos.d/. This is how it was done:


cd /etc/yum.repos.d/
vi dvd.repo


Inside this file I wrote the following:


[dvd]
name=RHEL5DVD
baseurl=file:///dvd
enabled=1
gpgcheck=1
gpgkey=file:///opt/RPM-GPG-KEY file:///opt/RPM-GPG-KEY-beta file:///opt/RPM-GPG-KEY-fedora file:///opt/RPM-GPG-KEY-fedora-test


Saved the /etc/yum.repos.d/dvd.repo file. Now I thought of disabling the plugins for RHN and "InstallOnly Packages". So I went to /etc/yum/pluginconf.d/ and opened the configuration file for each plugin and made "enabled=1" to "enabled=0".

Now finally I updated my "yum" so that it reads the new repo and other settings once again. For that I did:


yum clean all
yum update


Voila.It's finally done. But hey wait.When I install a package from where will it select the package rpm.It will do that from the mounted ISO.That means I need to mount the ISO everytime.

Well I can use fstab for that.So I created a entry in /etc/fstab so that my ISO gets mounted automatically on boot.

Here was the entry I made in /etc/fstab:


/opt/RHEL5.iso /dvd/actual iso9660 defaults,ro,loop 0 0


Now I ran system-config-packages and search, browse, install and un-install RPM's easily. Now the GUI Package manager can search for installed as well as not installed rpm's. That's great. But the most important thing is that it if install a RPM which needs a dependency RPM (which is not installed) the Package manager will tell us that there is a dependency and will install it automatically.Great !. Same goes for un-installation of packages.If some package is acting as a dependency for some other package and we try to remove it then it will show a message and will ask us what to do.

For command line lovers "yum" command will work. Now they can search package via yum search or if they don't remember the name they can see the large list using yum list command.For installing yum install.This will handle the dependencies too.

Okay so I finally managed to find a way out. But it was a real pain.
But as they say "No Pain No Gain".

Meanwhile I have not formatted my RHEL5 but instead of that in my Vista partition I have installed Ubuntu 7.04 Herd 4. So now I have two Linux RHEL5 Beta2 (Client) and Ubuntu 7.04 Herd 4. Well I kept RHEL5 so that I can learn some more new things.

All in all Package management in RHEL/Fedora needs a great improvement.Today I call upon the developers to come together and help the Redhat guys to improve the "yum","pirut" and "system-config-packages".

Monday, February 26, 2007

Linux Distros

Well, it has been a long time since I wrote here. I have been busy with my exams and then got busy trying the new linux distro versions. In these days I tried my hands on the Redhat Enterprise Linux 5 Beta2(RHEL). It was a great experience trying a enterprise product. I downloaded the huge 3.6 GB Client DVD.So let's see how was the drive with RHEL5.

Installation procedure (anaconda) was exactly a copy of Fedora Core 6. I had tried FC6 earlier but only once and then I never used it. Same went for RHEL5. During installation it asked me to enter a key. That was the only difference I saw between FC6 and RHEL5 installation. I got the key from internet (I don't remember from where) and now I don't have the key. LOL.

The few changes I noted down between the previous release of RHEL and this release were that this release had 3D Desktop all because of AIGLX enabled Xorg 7.x. Compiz was providing the desktop effect. I also saw in this release Xen enabled 2.6.18 kernel. Oh wait. Let me show you the `uname -a` of RHEL5 beta2:

Linux deepsa.lenovo 2.6.18-1.2747.el5 #1 SMP Thu Nov 9 18:55:30 EST 2006 i686 i686 i386 GNU/Linux

Well the above one is not Xen enabled kernel but if you choose virtualiaztion as a installation option you surely get Xen only. Other changes were Eclipse, JAVA etc. development tools available in this release. I selected all of these and the Servers too. The installation took around 35 minutes. Wow. That was fast.
Okay. Now I booted the Kernel and as it should be, Xen started. Xend (Xen daemon) also started. Most notably I saw Avahi daemon. It was great to see it in RHEL(now surely will get to see some great desktop).

Okay so here came the Login screen. But hey what's that. My resolution was not according to my laptop it was 1024x768 it should be 1280x800. No problem. I logged in(via root). So as I have guessed it was just like Fedora 6. No change. The following hardware which I need as soon as I install a Operating System didn't worked in RHEL5.

a) Wireless Internet
b) Bluetooth
c) Proper Screen Resolution.

Okay. So I went on searching for drivers for ipw3945. I got to know that redhat had ipw3945 in Beta1 but they removed it due to some license problem. What the Fuck. They say if we include propertiery modules we get problem later. Here's what they say exactly (I have converted it into a story).

Suppose redhat includes ipw3945 for example in RHEL5. Client A purchase RHEL5 installs it and use it. And after sometime Client A gets problem in it. Client A calls the redhat customer support guy and ask to fix the problem. Customer support department detect problem was due to a propertiery module named ipw3945. The guy tells Client A to please not install the module. Now the Client tells the guy that if you have given the module you need to better fix it. Not installing the module is not a solution. In this case note that the client didn't required ipw3945 but ipw3945 was somewhere conflicting with some other crucial module. So redhat thought not to have propertiery module.

Now guys who need ipw3945 goes to atrpms and install from there. Note that installing these things from internet is a real pain. All because of the dependencies problem. I am of the favour that if Linux somehow solves the Dependency problem they really have a easy path ahead (Ubuntu has done it very well).

Okay so I went to the above mentioned website and downloaded the daemon rpm, kernel module rpm and installed them. Then via system-config-network I configured my wireless with a 128 bit WEP Key. Oh to my surprise I saw that my wireless doesn't starts at boot (even after telling it to start on boot automatically). I figured out a way soon. I have to switch off my wireless(on my laptop) and again switch it on after the boot process completes. The problem is that it is not associating with the Access point. I don't know if there is some other solution to this problem but I am going with the above solution right now.

Bluetooth was working without any problem so it was nice. Well now comes the resolution problem. I have been facing this problem with many linux distros. Only OpenSuse 10.1 gave me proper resolution for others I have to use 915resolution. So I did the same for RHEL5. I went to the website (mentioned above) and downloaded 915resolution configured it for 1280x800 and in such a way that the service for it starts automatically during boot. Okay now what I am left with. Xen? Yeah. I have tried this tool earlier with RHEL4 but never got success and to my surprise it was way too easy in RHEL5 Beta2 with the new virtualization manager (GUI) tool to create, configure and modify new virtual machines based on Xen. But I never got success in configuring one for me. And the major reason for that I find is my RAM. I need to have at-least 1GB RAM otherwise there is no point having Xen.

So I installed my old friend VMware workstation. But this time it was a new version. Yes the Beta 6.0. It was easy to install and configure as this time it has the code to compile vmnet and vmmon drivers for 2.6.18 kernel with GCC 4.1.1. Okay. So I got through with virtualization but hey wait. When we will see a user friendly open source virtualiaztion tool that has capablities just like VMware. Xen is promising but it's not for beginners.

Okay so what I am left now. Oh Yes. The 3D Desktop. Well it was easy just go to System > Preferences > 3D Desktop effects and enable it and BOOM it's on. Well it was Compiz utilizing AIGLX power. But as I have tried beryl and I felt in love with it along time ago I went on installing beryl via SVN on RHEL5. It was easy. I got beryl 0.2.0rc3 installed in a few minutes and up running with most of the effects and 3D Desktop is on. Well according to Redhat they have included 3D desktop just for a technological preview in RHEL5. They don't mean to have this kind of software in a enterprise product. It's good. Sometime we get bore at that time we can play with the desktop cubes. LOL.

Well now comes the most important part. And in a enterprise product like RHEL5 it's the servers. I tried DNS (BIND-9), APAHCE and SQUID. Well I found not much difference between the earlier (RHEL4) and these ones (RHEL5). The important difference I saw was in DNS. Earlier they use to have a caching-nameserver RPM in only AS and ES version not the WS version. But this time they had that rpm in Client RHEL5 Dvd. Well it's a DVD so it need to have more softwares. I didn't downloaded the Server DVD which was less in size. But I think the only difference between server and client DVD is that the server DVD is going to have the Cluster suite too (GFS too).

The installation of software via the DVD after a base installation is there can be easily done through system-config-packages. It tries to find a connection with RHN(Redhat Network for Update). But as my system is not registered with Redhat it couldn't connect to the RHN servers. But can I install RPM from the DVD via this GUI tool. Let's see.

I started system-config-packages. Searched for a package named zsh which was on the DVD but not installed the search result said no packages were found. But what's that. I have the package on the DVD. Okay I figured out the problem. The problem was that each time this Add/Remove Software program starts it runs a plugin called Loading "installonlyn" plugin. I don't know how to remove this plugin and how to get a new plugin that can search for me the software present on the DVD and not installed on my system. Okay now I tried to install a RPM from DVD that requires other dependency RPM's via command line (mostly the prefer way with linux administrators). I wanted to test --aid. I tried installing xfig rpm that depended on transfig rpm. Both the RPM's were in /mnt/Client/ directory. I gave the command:

[root@deepsa Client]# rpm -ivh xfig-3.2.4-21.1.i386.rpm --aid


I got the result

error: Failed dependencies:
transfig >= 1:3.2.4-12 is needed by xfig-3.2.4-21.1.i386

But why so. It must have installed the transfig RPM automatically I gave "aid". Now I installed transfig first and then I installed xfig. Now it got installed. Man. It's not what I wanted. It's the same as in Fedora core 6.

The aid switch doesn't work in RHEL? It's very important thing. God knows what will happen to Redhat. I am specially worried after ORCALE release there own Linux which is exact copy of RHEL4 Update 4. I mean aid is what I use to use many times. I mean I taught my students during there RHCE course about this switch but now it's not functioning as it should have. Come on RedHat!!.



This is a screenshot of the GUI based Package Manager in RHEL5 Beta2.

The other problem I faced on my laptop was that the CD/DVD were not getting detected and mounted automatically when I inserted them. I had to use the mount command everytime. I guess problem is with gnome-volume-manager. Guys need to fix it.

All in all I am going to format my RHEL5. Why? I am a desktop user not a server administrator. Sometimes I do some programming with C/C++/GTK+ but I think RHEL5 is better for enterprise not for a home user. Home user requires much more user friendly desktop and application. We don't have CHM reader in RHEL5. We don't have MP3 support (patent problems). We don't have MPEG, AVI players in RHEL5. And lastly the most important issue is the software installation procedure. But that's what a average desktop user wants.

Well if you are having a laptop configuring RHEL5 for your laptop is not much of a problem now. But then also you need to configure somethings before you say it's ready for use.

I am now downloading Herd 4 of Ubuntu 7.04. The only linux distro I tried that is best for a laptop user like me. Wireless no problem. Bluetooth no problem. Resolution no problem. 3D Desktop no problem. MP3, AVI, MPEG it's way to easy to configure and use. I am eagerly waiting for the final release of 7.04 in April. Meanwhile I will try Herd 4 with a 2.6.20 kernel having EXT4 support (experimental). LOL.

In the recent months I had tried alot of distros:

a) BackTrack Beta 2.0
b) OpenSUSE 10.2
c) Gentoo 2006.1
d) RHEL5 Beta2
e) Ubuntu Edgy
f) Ubuntu Fiesty Herd 2