Friday, 1 June 2012

Adding a local Yum repository to Red Hat Enterprise Linux 6.2

I'm indebted to this blog post: -

Creating A Local and HTTP RedHat Yum Repository

for much of my own post, as it helped me work out how I could set up Yellowdog Update Modified (YUM) on my own newly minted Red Hat Enterprise Linux 6.2 environment.

Having installed the 64-bit RHEL 6.2 VM this morning ( I'm running Oracle VirtualBox 4.1.2 on Ubuntu 12.04 ), I've been testing the automated deployment of IBM HTTP Server 7 ( that's another post for another day ).

During the installation of IHS, I hit a problem that I've seen before: -

(01-Jun-2012 13:00:35), Process, com.ibm.ws.install.ihs.ismp.actions.ExecWizardActionFromDirectory, err, java.io.IOException: Cannot run program "/opt/IBM/HTTPServer/bin/htpasswd" (in directory "/opt/IBM/HTTPServer"): java.io.IOException: error=2, No such file or directory
STACK_TRACE: 14
java.io.IOException: Cannot run program "/opt/IBM/HTTPServer/bin/htpasswd" (in directory "/opt/IBM/HTTPServer"): java.io.IOException: error=2, No such file or directory
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:470)
        at java.lang.Runtime.exec(Runtime.java:604)
        at com.ibm.ws.install.ihs.ismp.actions.ExecWizardActionFromDirectory.executeProcess(ExecWizardActionFromDirectory.java:202)
        at com.ibm.ws.install.ihs.ismp.actions.ExecWizardActionFromDirectory.execute(ExecWizardActionFromDirectory.java:307)
        at com.installshield.wizard.StandardWizardListener.execute(StandardWizardListener.java:123)
        at com.installshield.wizard.StandardWizardListener.currentBeanChanged(StandardWizardListener.java:106)
        at com.installshield.wizard.Wizard$RunThread.run(Wizard.java:1569)
Caused by: java.io.IOException: java.io.IOException: error=2, No such file or directory
        at java.lang.UNIXProcess.<init>(UNIXProcess.java:197)
        at java.lang.ProcessImpl.start(ProcessImpl.java:101)
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:463)
        ... 6 more


Last time out, I was running IHS on CentOS 6.2, so it was an easy solution; to install the ld-linux.so.2 library as follows: -

$ yum install ld-linux.so.2

which pulled the missing code straight off the 'net.

At the time, I blogged the problem and solution here.

This time around it was a little more complex, as I'm using RHEL for which one has to pay for access to the online repositories etc.

Whilst my company do have an internal Red Hat Network mirror, my PC wasn't hooked back in to the office network.

Given that I had the RHEL 6.2 DVD ( as an ISO image ), I wanted to see if/how I could install the missing library, plus any dependencies.

After some trial and a lot of error, I managed it, again thanks to the blog post mentioned previously.

*UPDATE* Before you can run step (c), it's necessary to install the createrepo RPM from the RHEL 6.2 DVD ( which I have mounted to /mnt ): -

$ rpm -ivh /mnt/Packages/deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
$ rpm -ivh /mnt/Packages/python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
$ rpm -ivh /mnt/Packages/createrepo-0.9.8-4.el6.noarch.rpm

Here's the shortened version: -

(a) Create a directory into which I'm going to copy the RHEL DVD: -

$ mkdir /var/repo
$ mkdir /var/repo/rhel6

(b) Copy the DVD contents ( where the ISO is mounted to /mnt ): -

$ cd /mnt
cp -r * /var/repo/rhel6/

(c) Create the YUM repository metadata ( this is created one level up from the DVD contents ): -

$ cd /var/repo
$ createrepo .

(d) Create the YUM repository pointing back at the newly created repository metadata

$ cd /etc/yum.repos.d/
vi server.repo

[server]
gpgcheck=1
name=Red Hat Enterprise Linux 6.2
baseurl=file:///var/repo


(e) Update YUM to have it pick up the new repository

$ yum clean

(f) Test by listing the available packages

$ yum list

Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Updating certificate-based repositories.
Installed Packages
ConsoleKit.x86_64                       0.4.1-3.el6                      @anaconda-RedHatEnterpriseLinux-201111171049.x86_64/6.2
ConsoleKit-libs.x86_64                  0.4.1-3.el6                      @anaconda-RedHatEnterpriseLinux-201111171049.x86_64/6.2
ConsoleKit-x11.x86_64                   0.4.1-3.el6                      @anaconda-RedHatEnterpriseLinux-201111171049.x86_64/6.2
DeviceKit-power.x86_64                  014-3.el6                        @anaconda-RedHatEnterpriseLinux-201111171049.x86_64/6.2
GConf2.x86_64                           2.28.0-6.el6                     @anaconda-RedHatEnterpriseLinux-201111171049.x86_64/6.2
GConf2-devel.x86_64                     2.28.0-6.el6                     @anaconda-RedHatEnterpriseLinux-201111171049.x86_64/6.2

...
                                             
yum-plugin-aliases.noarch                                                                      1.1.30-10.el6                                                                 server                                                
yum-plugin-changelog.noarch                                                                    1.1.30-10.el6                                                                 server                                                
yum-plugin-downloadonly.noarch                                                                 1.1.30-10.el6                                                                 server                                                
yum-plugin-tmprepo.noarch                                                                      1.1.30-10.el6                                                                 server                                                
yum-plugin-verify.noarch                                                                       1.1.30-10.el6                                                                 server                                                
yum-plugin-versionlock.noarch                                                                  1.1.30-10.el6                                                                 server                                                
yum-presto.noarch                                                                              0.6.2-1.el6                                                                   server                                                
zlib-devel.i686                                                                                1.2.3-27.el6                                                                  server                                                
zsh.x86_64                                                                                     4.3.10-4.1.el6                                                                server


(g) Install my package: -

$ yum install gtk2.i686

( this installs about 45 MB of code, including the missing ld-linux.so.2 )

(h) Test IHS

$ /opt/IBM/HTTPServer/bin/htpasswd

Usage:
        htpasswd [-cmdpsD] passwordfile username
        htpasswd -b[cmdpsD] passwordfile username password

        htpasswd -n[mdps] username
        htpasswd -nb[mdps] username password
 -c  Create a new file.
 -n  Don't update file; display results on stdout.
 -m  Force MD5 encryption of the password.
 -d  Force CRYPT encryption of the password (default).
 -p  Do not encrypt the password (plaintext).
 -s  Force SHA encryption of the password.
 -b  Use the password from the command line rather than prompting for it.
 -D  Delete the specified user.
On Windows, NetWare and TPF systems the '-m' flag is used by default.
On all other systems, the '-p' flag will probably not work.


The job, as they say, is a good 'un.

Thanks, Rus, you're a star :-)

5 comments:

Chinmaya said...

Awesome post this...solved all my issues...saved lot of days for me for sure !

Great going...Many Thanks!

-Chinmaya

Chinmaya said...

Awesome post this...solved all my issues...saved lot of days for me for sure !

Great going...Many Thanks

Dave Hay said...

@Chinmaya - no problems, glad to be of assistance, regards, Dave

Marco Antonio said...

Thanks a lot Dave.
For my case it was necesary also import the GPG Keys
rpm --import RPM-GPG-KEY-redhat-beta
rpm --import RPM-GPG-KEY-redhat-release

Marco

Dave Hay said...

@Marco - thanks for sharing, useful tip

Reminder - installing podman and skopeo on Ubuntu 22.04

This follows on from: - Lest I forget - how to install pip on Ubuntu I had reason to install podman  and skopeo  on an Ubuntu box: - lsb_rel...