background
yum (all called Yellow dog Updater, Modified) is a Shell front-end package manager in Fedora, Red Hat and SUSE. Based on RPM package management, RPM packages can be downloaded and installed automatically from designated servers, dependency relationships can be handled automatically, and all dependent software packages can be installed at one time without tedious downloading and installation.
Prepare beforehand:
OS files exist locally or can be loaded into the machine through related software such as vSphere Client.
Take loading OS files as an example
- The OS is first mounted on the machine through software, and then mounted on / mnt. Seeing RHEL-6.9 shows that OS resources have been mounted.
[root@rhel69x64zs Packages]# mount
/dev/sda1 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
none on /sys/kernel/config type configfs (rw)
gvfs-fuse-daemon on /root/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev)
/dev/sr0 on /media/RHEL-6.9 Server.x86_64 type iso9660 (ro,nosuid,nodev,uhelper=udisks,uid=0,gid=0,iocharset=utf8,mode=0400,dmode=0500)
/dev/sr0 on /mnt type iso9660 (ro,loop=/dev/loop0)
2. Write yum configuration file
Note: The following environment is rhel6 series, if rhel5 series needs to be modified to baseurl
baseurl=file:///mnt/Server
[root@rhel69x64zs Packages]# cd /etc/yum.repos.d/
[root@rhel69x64zs yum.repos.d]# ls -l
total 12
-r--r--r--. 1 root root 114 Mar 9 2017 packagekit-media.repo
-rw-r--r--. 1 root root 358 Sep 15 21:04 redhat.repo
-rw-r--r--. 1 root root 529 Feb 27 2017 rhel-source.repo
[root@rhel69x64zs yum.repos.d]# vi zs.repo
[root@rhel69x64zs yum.repos.d]# cat zs.repo
[zs]------------------- Used to distinguish between different repository
name=zs------------------Used for repository Description
baseurl=file:/// mnt - - - Used to specify the source location for obtaining rpm packages.
//Supports three protocols: http://, ftp://, file:///.
gpgcheck=0---------------Is the definition correct? rpm Package execution GPG Calibration.
enabled=1---------------Used to define whether this software repository is available.
0: Not available.1: available
[root@rhel69x64zs yum.repos.d]# yum clean all - - - - - - refresh
Loaded plugins: product-id, refresh-packagekit, search-disabled-repos, security, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Cleaning repos: InstallMedia zs
Cleaning up Everything
[root@rhel69x64zs yum.repos.d]# yum list | grep httpd
----lookup httpd software package
httpd.x86_64 2.2.15-59.el6 @anaconda-RedHatEnterpriseLinux-201703082046.x86_64/6.9
httpd-tools.x86_64 2.2.15-59.el6 @anaconda-RedHatEnterpriseLinux-201703082046.x86_64/6.9
httpd-devel.i686 2.2.15-59.el6 zs
httpd-devel.x86_64 2.2.15-59.el6 zs
httpd-manual.noarch 2.2.15-59.el6 zs
libmicrohttpd.i686 0.9.33-4.el6 zs
libmicrohttpd.x86_64 0.9.33-4.el6 zs
3. After configuration, you can use yum to install the software. For example, install expect.
[root@rhel69x64zs yum.repos.d]# /usr/bin/expect
-bash: /usr/bin/expect: No such file or directory
[root@rhel69x64zs yum.repos.d]# cd
[root@rhel69x64zs ~]# yum install expect
Loaded plugins: product-id, refresh-packagekit, search-disabled-repos, security, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package expect.x86_64 0:5.44.1.15-5.el6_4 will be installed
--> Processing Dependency: libtcl8.5.so()(64bit) for package: expect-5.44.1.15-5.el6_4.x86_64
--> Running transaction check
---> Package tcl.x86_64 1:8.5.7-6.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=====================================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================================
Installing:
expect x86_64 5.44.1.15-5.el6_4 zs 256 k
Installing for dependencies:
tcl x86_64 1:8.5.7-6.el6 zs 1.9 M
Transaction Summary
=====================================================================================================================================
Install 2 Package(s)
Total download size: 2.2 M
Installed size: 4.9 M
Is this ok [y/N]: y
Downloading Packages:
-------------------------------------------------------------------------------------------------------------------------------------
Total 117 kB/s | 2.2 MB 00:18
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
Installing : 1:tcl-8.5.7-6.el6.x86_64 1/2
Installing : expect-5.44.1.15-5.el6_4.x86_64 2/2
zs/productid | 1.6 kB 00:00 ...
Verifying : expect-5.44.1.15-5.el6_4.x86_64 1/2
Verifying : 1:tcl-8.5.7-6.el6.x86_64 2/2
Installed:
expect.x86_64 0:5.44.1.15-5.el6_4
Dependency Installed:
tcl.x86_64 1:8.5.7-6.el6
Complete!
[root@rhel69x64zs ~]#
4. When installation is not possible through direct installation, the following methods are needed for installation. For example, when this bag is missing
xxxx:error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
You can go directly to the / mnt/Package directory
Search ls-l | grep libstdc++ like this
Then execute the yum install libstdc++ command to install.
5. Here are some common commands
yum install package1 installs the specified package package1
Yum group Insall group 1 installer group group1
yum update package1 updates the specified package package1
yum check-update checks for updatable programs
yum upgrade package1 upgrade specified package package1
Yum group update group 1 upgrade group 1
Yum info package 1 displays installation package information package 1
yum list shows all installed and installable packages
yum list package1 shows the specified package installation package1
Yum remove package1 delete package package1
Yum group remove group 1 delete program group group 1