Yum installation and frequently encountered problem solving

Source: Internet
Author: User
Tags gpg sqlite

Yum installation and frequently encountered problem solving

Red Hat Enterprise Linux as Release 4 (Nahant Update 4) is referred to as AS4.

Linux common installation and upgrade tools are mainly Yum and apt, where yum can better solve the problem of RPM dependencies, recommended the use of Yum.

On the standard Redhat Enterprise Linux, Yum is not installed by default and needs to be downloaded and installed separately.

The following steps are to install Yum:

1, first installs the Yum and the related RPM package.

Note: This installation package is only available to the AS4 system

Http://www.swsoft.com.cn/downloads/Prima/Tools/yum_forAS4.tar.gz or
http://www.haoxm.net/tools/yum_forAS4.tar.gz download yum_forAS4.tar.gz.

2, decompression and installation.

[root@dev-191 aio]# tar zxvf yum_forAS4.tar.gz
yum_foras4/
Yum_foras4/centos-base.repo
yum_foras4/python-elementtree-1.2.6-7.el4.rf.i386.rpm
yum_foras4/python-urlgrabber-2.9.7-1.2.el4.rf.noarch.rpm
yum_foras4/yum-2.4.2-0.4.el4.rf.noarch.rpm
yum_foras4/sqlite-2.8.16-1.2.el4.rf.i386.rpm
yum_foras4/python-sqlite-1.0.1-1.2.el4.rf.i386.rpm

[root@dev-191 aio]# CD Yum_foras4

[root@dev-191 yum_foras4]# RPM-IVH *.rpm
Warning: Python-elementtree-1.2.6-7.el4.rf.i386.rpm:v3 DSA chapter: Nokey, Key ID 6b8d79e6
?? ########################################### [100%]
1:sqlite ########################################### [20%]
2:python-sqlite ########################################### [40%]
3:python-urlgrabber ########################################### [60%]
4:python-elementtree ########################################### [80%]
5:yum ########################################### [100%]

3. Copy the extracted Centos-base.repo to the/etc/yum.repos.d/directory.

Note: This Centos-base.repo file is only available to the AS4 system

[root@dev-191 yum_foras4]# CP centos-base.repo/etc/yum.repos.d/


4. Perform the following command to import GPG Key.


[root@dev-191 yum_foras4]# rpm--import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-4

Or

[root@dev-191 yum_foras4]# rpm--import http://www.haoxm.net/tools/RPM-GPG-KEY-CentOS-4


Yum installation completed, you can use. The main parameters of Yum include Search/install/upgrade/remove

[root@dev-191 yum_foras4]# Yum
Need to give some command
Usage:yum [options] < update | Install | info | Remove | List |
Clean | provides | Search | Check-update | Groupinstall |
Groupupdate | Grouplist | GroupInfo | Groupremove |
Makecache | Localinstall | Erase | Upgrade | Whatprovides |
Localupdate | RESOLVEDEP | Shell | Deplist >
Options
-H,--help show this Help and exit
-T,--tolerant be tolerant of errors
-C run entirely from cache, don ' t update cache
-c [config file] Config file location
-R [minutes] maximum command wait time
-d [Debug level] debugging output level
-e [ERROR level] Error output level
-Y answer Yes to all questions
--version Show Yum version and exit
--installroot=[path] Set Install root
--enablerepo=[repo] enable one or more repositories (wildcards allowed)
--disablerepo=[repo] Disable one or more repositories (wildcards allowed)
--exclude=[package] Exclude package (s) by name or Glob
--obsoletes enable obsoletes processing during updates
--noplugins Disable Yum Plugins

Frequently encountered problems:

1.

The following error occurred while running Yum in 64-bit Linux:

There was a problem importing one of the Python modules
Required to run Yum. The error leading to this problem is:

/usr/lib/python2.3/site-packages/celementtree.so:cannot open Shared object file:no such file or directory

Please install a package which provides this module, or
Verify that's the module is installed correctly.

It ' s possible that the above module doesn ' t match the
Current version of Python, which is:
2.3.4 (#1, Feb 18 2008, 17:16:53)
[GCC 3.4.6 20060404 (Red Hat 3.4.6-9)]

If you are cannot solve this problem yourself
The Yum FAQ at:
Http://wiki.linux.duke.edu/YumFaq

The reason: python-elementtree-1.2.6-7.el4.rf.i386.rpm is for 32-bit systems.

Workaround: Download the 64-bit python-elementtree-1.2.6-7.el4.rf.x86_64.rpm reinstall.

64-bit python-elementtree-1.2.6-7.el4.rf.x86_64.rpm download address: http://rpm.pbone.net/index.php3/stat/4/idpl/9514719/dir/ Redhat_el_4/com/python-elementtree-1.2.6-7.el4.rf.x86_64.rpm.html

2. Frequently encountered Yum cannot be used because of Python versions and Yum mismatches. Verify that the current version supports Yum

python2.5 does not support Yum, such as the following,

[Root@alu bin]#/usr/local/gemini/gtf/bin/python
Python 2.5 stackless 3.1b3 060516 (Release25-maint, Mar 9 2008, 08:38:34)
[GCC 3.2.3 20030502 (Red Hat Linux 3.2.3-47)] on linux2
Type ' help ', ' copyright ', ' credits ' or ' license ' for the more information.
>>> Import Yum
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
Importerror:no module named Yum
>>>


The default python2.3 support Yum, as follows,

[Root@sherrytest build]#/usr/bin/python
Python 2.3.4 (#1, Feb 18 2008, 17:16:53)
[GCC 3.4.6 20060404 (Red Hat 3.4.6-9)] on linux2
Type ' help ', ' copyright ', ' credits ' or ' license ' for the more information.
>>> Import Yum
>>>


3. Modify the python found in the Yum to solve, sometimes your system has a number of Python installed, we need to let Yum find the python that it needs, open/usr/bin/yum file, the default is to find/usr/bin/ Python. If our support Yum Python is not this path, modify the file's Pthon lookup path.

[Root@sherrytest build]# Vi/usr/bin/yum
#!/usr/bin/python
Import Sys

3rd Floor Computer Learning Station information release date: 2011-05-06 21:35:13

Repair methods that are not available to the Yum service due to the upgrade of Python
February 6, 2009 Read comments Comment comments because Yum package management is written in Python, if you upgrade to Python alone, it may cause the Yum service to be unusable.

The main reason for this is that the newly installed Python does not have the packages that the Yum service relies on.

You can try to execute the import Yum statement in Python, and if Python throws an exception at this point, it means Yum is not working correctly.

The general problem is: No module named RPM, if there is no Rpm-python installation package, then you need to build a, this package is included in the RPM code, So first to the rpm.org Web site download the corresponding RPM version of the source code package, and then decompression, execution./configure, go into the Python subdirectory and execute make install. After the installation is complete, exit the Python subdirectory, execute Python, import yum again, see if no module named RPM is no longer present, and check the configuration of the installation path if it still appears. Note that: 1. There is no need to install the entire RPM, only part of the Python subdirectory is installed; 2. Before performing the import yum, be sure to exit the Python subdirectory, otherwise Python will use the RPM directory in the current directory as the directory location for the RPM package. Instead of referencing the RPM in the Site-packages directory, a no module named _RPM exception is created.

RPM Download Address Http://rpm.org/wiki/Download

In addition to Rpm-python, some of the other needed package:

Urlgrabber http://linux.duke.edu/projects/urlgrabber/download/
Iniparse http://code.google.com/p/iniparse/
Yum-metadata-parser http://yum.baseurl.org/download/yum-metadata-parser/

After decompression, perform the Python setup.py install to install.

Finally, the import yum is executed in Python again, and if the exception is not thrown it means the fix is successful. Then the yum can be used normally.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.