Archive

Posts Tagged ‘yum’

Create your own local repository and solve yum related problems

November 22, 2010 2 comments

In RHEL 5.0 onwards Red hat introduced YUM concept by which it is very easy to install some rpm without being getting worry about the dependency problem.YUM takes care of this dependency problem by selecting all dependent RPM to install from a central repository either from RED HAT or from some third party repository like oracle has or you can create your own repository if you want to use YUM offline

YUM: – Yellowdog Updater, Modified (YUM)

In first section we will discuss how to create your own local repository.

1. To create that inserts your Red hat DVD installer inside DVD ROM.

2. Mount the DVD by

[root@localhost ~]#mounts /dev/cdrom /media

3. Create a folder of your choice. In my case I have created /home/rpms

4. Copy all the RPM from /media/Server/ to /hom/rpms folder

[root@localhost ~]#mkdir /home/rpms
[root@localhost ~]#cp -rv /media/Server/*  /home/rpms

6. Now look for a folder /etc/yum.repos.d. If the directory exists then YUM package is already installed and you can skip this step. So you just need to configure. If it is not there you have to install yum and yum-utils package. Also install one RPM called createrepo.

[root@localhost rpms]# cd /media/Server/
[root@localhost Server]# rpm -ivh yum-3.0.1-5.el5.noarch.rpm
[root@localhost Server]# rpm –ivh yum-utils-1.0.4-3.el5.noarch.rpm
[root@localhost Server]# rpm -ivh createrepo-0.4.4-2.fc6.noarch.rpm

7. Once YUM packages are installed you will get the /etc/yum.repos.d folder. Go inside the folder and open the entire .repo file present inside that folder. In all .repo file search for

enabled = 1

and replace by

enabled = 0

This means you are disabling the default repository locations or else you can delete all repo files.

8. Edit the /etc/yum.conf file,change the following line:

keepcache=0 to keepcache=1

9. Now prepare the directory /rpms to act as a repository. For this we run the command

[root@localhost ~]createrepo -p /rpms 

This command will take some time to finish and once finished you can see a directory called repodata will be created inside the /rpms directory.

11.If some error comes like “Cannot delete .olddata” Then you have to remove it manually by “rm -rf /home/rpms/.olddata”

yum error 39

10. Now create a file myrepo.repo inside /etc/yum.repos.d folder

[root@localhost ~]touch /etc/yum.repos.d/myrepo.repo

11. Put the following contents inside the myrepo.repo file

[myrepo]
 name=My Local Repo
 baseurl=file:///home/rpms
 enabled=1 
gpgcheck=0

Save the file and exit.

Now your repository is ready. Before running any installation first clean the cache by

Yum clean all

Now you can install anything like

[root@localhost ~]yum install httpd

You will get a screen like below where you have to say “y” or “n”

yum installation

N:B-Here I have used file:// protocol as base url.You can use ftp:/// or http:// if you have remote repository location.

Common Errors and their solutions

1)Errno 256:Metadata file does not match checksum

Solution:

1) Edit /etc/yum.conf and add the following line

http_caching=packages

2) Run "yum clean metadata"

3) Retry the yum install

2)“TypeError: rpmdb open failed” or “TypeError: rpmdb unable to join the environment”

Solution:

# yum clean all 
#rm -f /var/lib/rpm/__db* 
#rpm –rebuilddb 
#yum update

3)ValueError: need more than 1 value to unpack

Solution:

#yum clean all

#yum clean metadata

#yum clean dbcache

 

and then execute

#yum makecache

4)thread.error: can’t start new thread

Solution:

#rm /usr/lib/yum-plugins/ threading.py

#yum update

5)[Errno -3] Error performing checksum

Solution:

#createrepo -v -s sha1 <repository location>

#yum clean all

6)TypeError: unsubscriptable object

Solution:

#yum clean metadata

#yum update missing dependency error

Solution:

#yum clean all

#yum update

7)Yum install GPG error

Solution:

#rpm --import /etc/pki/rpm-gpg/RPM*

8)Error: Cannot retrieve repository metadata (repomd.xml)

Solution:

This is a network issue.Please check DNS,Proxy etc. settings for the same.

Advertisements
Categories: Linux Tags: , , , ,

Install GNOME or KDE desktop environment from the CLI mode

September 21, 2010 2 comments

Install GNOME or KDE desktop environment from the CLI mode

Yesterday I got a request from my user that they need graphical interface to be installed in the server as they require this for their project work. I knew that this is very simple to install using yum groupinstall but the problem I faced was terrific. As this was our internal server it was not connected the internet and it was a VM on VMware. Hence no physical optical drive was present. I am giving below the steps how I got that thing to work.

  1. Mount the ISO image of CD/DVD to your system. If you have a physical system you can insert the CD/DVD and mount or else you have to virtually mount this.

    mount /dev/cdrom /mnt
  2. Create one directory and put all the contents of the Server directory into it.

    mkdir /repository

    cp  -rvf  /mnt/Server/*  /repository/
  3. Unmount the CD/DVD drive.        
    umount /mnt

    If you face any problem in unmounting you can use the command        

    umount   -l /mnt

  4. Go inside the /repositories folder and install all the createrepo packages.

    rpm –ivh createrepo*
  5. Now go inside the folder/etc/yum.repos.d/ and create a file called myrepo and put the following contents to the file
      [base]
           name=Red Hat Enterprise Linux $releasever - $basearch - Debug
           baseurl=file:///repository/
           enabled=1
           gpgcheck=0
    
  6. Now Go inside /repository folder and check for a specific package yum-utils is present there or not.
          cd /repository
            ls –l| grep yum-utils

    This package is responsible for making group of packages.

  7. If it is not there you have to download this, keep inside this folder (/repository) and install it. You can download it from http://rpm.pbone.net/ .This website has the option of advanced search where you can download packages specific to particular OS version.
  8. Use createrepo command to create your repository
    createrepo   /repository/
    
  9. Now after creation of repository and installation of the package yum-utils you can try the command

    yum grouplist

    The output will list you some groups like given below

     Loading "rhnplugin" plugin
     Loading "installonlyn" plugin
     Setting up Group Process
     Setting up repositories
     rhel-debuginfo            100% |=========================| 1.1 kB    00:00
     Installed Groups:
               MySQL Database
               Editors
               System Tools
               FTP Server
               Network Servers
               Printing Support
               Mail Server
               Server Configuration Tools
     Available Groups:
               Administration Tools
               GNOME Software Development
               X Software Development
               GNOME Desktop Environment
               Authoring and Publishing
               Games and Entertainment
               X Window System
               KDE Software Development
               KDE (K Desktop Environment)
               Sound and Video
               Graphical Internet
               Done
  10. If you are not able to see output like given above then you need one xml file called comp.xml to create your own group.Below.If you don’t know how to create the xml file you can use the following link to create the comp.xml file.
  11. http://cooker.wbitt.com/index.php/Example_comps.xml_file

  12. After placing the comp.xml file inside /repository directories you have to recreate the repository.createrepo /repository
  13. Now run the command yum grouplist and you will see the output as below
    yum grouplist

    Sample output:

     Setting up Group Process
     Setting up repositories
     rhel-debuginfo            100% |=========================| 1.1 kB    00:00
     Installed Groups:
              Printing Support
     Available Groups:
              GNOME Desktop Environment
              X Window System
              Graphical Internet
     Done
    
  14. Now you can install the groups listed above. To install GNOME desktop Environment you can use the simple command
yum groupinstall "GNOME Desktop Environment"

Now you can use startx to see your graphical GNOME desktop screen.

Simillarly you can install KDE desktop environment.Just you need to change the xml file and give the command

yum groupinstall "KDE (K Desktop Environment)"

Categories: Linux Tags: , , , , ,