When using the Linux operating system, many of my friends may find installing the software package quite troublesome. The main reason is (RedHat/CentOS ):
1. the RPM installation method cannot effectively solve complex package dependencies in many cases.
2. The YUM installation method can effectively solve the package dependency, but needs to connect to the Internet (many users understand ).
To sum up, it is obvious that we sometimes have to discard the RPM software package installation method. If we can use YUM to install the software package without network connection, it will become simple.
By default, the yum library is directed to the Internet. When the host is not very convenient to access the Internet, we can change the yum library to point to the disc media, in this way, you can easily query and install the application software in the local yum mode.
The following describes how to install the software (Redhat 5.8 is used as an example ):
1) Use the mkdir command to create a cdrom directory in the/media directory.
[Root @ oracle ~] # Mkdir/media/cdrom
2) mount the installation disc to the optical drive, mount it to a directory, and copy all the content of the disc to the/media/cdrom directory.
[Root @ oracle ~] # Mount/dev/cdrom/mnt/iso
[Root @ oracle iso] # cp-r */media/cdrom/
3) modify the rhel-debuginfo.repo file under the/etc/yum. repos. d/directory, edit bashurl to write your own CD path
[Root @ oracle yum. repos. d] # cp rhel-debuginfo.repo rhel-debuginfo.repo.bak
[Root @ oracle yum. repos. d] # vi rhel-debuginfo.repo
R5-media
Name = Red Hat Enterprise Linux $ releasever-$ basearch-Debug
Baseurl = file: // media/cdrom/Server
Enabled = 1
Gpgcheck = 1
Gpgkey = file: // etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
4) Use this command to query and install the software package: yum -- disablerepo = \ * -- enablerepo = r5-media [command] xxxx-xxxx, where command can be info, install, groupinstall, etc.
5) if you think it is too troublesome to enter this command every time, you can replace it with an alias. It will be much easier to use it later.
Note: xxxx-xxxx indicates the software package or package name. -- disablerepo = \ * indicates that all other repo sources are prohibited, -- enablerepo = r5-media indicates to enable the disc repo source (it thinks/media/cdrom is the directory mounted to the disc), which is actually equivalent to creating a repository of YUM sources locally, each time the software is installed, it will go directly to this warehouse to find the software, automatically analyze the dependency, and help us smoothly install the software.
For example, if I want to install wireshark, a network communication packet capture software, on the host, which is not installed by default, you can
Run the command: yum -- disablerepo = \ * -- enablerepo = r5-media info wireshark, which is available in the library r5-media and can be installed.
[Root @ oracle ~] # Yum -- disablerepo = \ * -- enablerepo = r5-media info wireshark
Loaded plugins: katello, product-id, security, subscribe-manager
Updating certificate-based repositories.
Unable to read consumer identity
Available Packages
Name: wireshark
Arch: x86_64
Version: 1.0.15
Release: 1. el5_6.4
Size: 12 M
Repo: r5-media
Summary: network traffic analyzer
URL: http://www.wireshark.org/
License: GPL
Description: Wireshark is a network traffic analyzer for Unix-ish operating
: Systems.
:
: This package lays base for libpcap, a packet capture and filtering
: Library, contains command-line utilities, contains plugins and
: Documentation for wireshark. A graphical user interface is packaged
: Separately to GTK + package.
Run the command: yum -- disablerepo = \ * -- enablerepo = r5-media install wireshark, which automatically resolves the dependency issue and is ready for use directly.
[Root @ oracle ~] # Yum -- disablerepo = \ * -- enablerepo = r5-media install wireshark
Loaded plugins: katello, product-id, security, subscribe-manager
Updating certificate-based repositories.
Unable to read consumer identity
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package wireshark. x86_64. 0.15-1. el5_6.4 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
========================================================== ==========================================================
Package Arch Version Repository Size
========================================================== ==========================================================
Installing:
Wireshark x86_64 1.0.15-1. el5_6.4 r5-media 12 M
Transaction Summary
========================================================== ==========================================================
Install 1 Package (s)
Upgrade 0 Package (s)
Total download size: 12 M
Is this OK [y/N]:
The above methods are applicable to the Redhat5/6 and CentOS5/6 series, but the details are slightly different.