0% found this document useful (0 votes)
38 views5 pages

Package Management-4

The document provides instructions for installing and managing software packages using RPM, including commands for installing, upgrading, and querying packages. It also details the process of creating a local YUM repository, enabling it, and testing the repository for package installations. Additionally, it includes steps for removing the repository and cleaning up installed packages.

Uploaded by

mithun
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views5 pages

Package Management-4

The document provides instructions for installing and managing software packages using RPM, including commands for installing, upgrading, and querying packages. It also details the process of creating a local YUM repository, enabling it, and testing the repository for package installations. Additionally, it includes steps for removing the repository and cleaning up installed packages.

Uploaded by

mithun
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

====================Installing the packages by using RPM=======

Installing and Removing Software

Primary RPM options:


Install: rpm -i, --install
Upgrade: rpm -U, --upgrade
Freshen: rpm -F, --freshen
Erase: rpm -e, --erase
Output Options: -v, -h ( v=verbose, h= hashing....)

URL support: ftp:// (with globbing), http://


Many other install-options are available to address special cases.

rpm Queries
Syntax:

rpm -q what_packages what_information

Installed Package Options:

rpm -qa lists installed packages

rpm -qf filename shows owning package

rpm -qi package_name general information

rpm -ql package_name lists files in package


rpm -qc package_name lists configuration file in package
rpm -qd package_name lists documentation files in Package

Uninstalled Package Options:

rpm -qip package_file.i386.rpm

rpm -qlp package_file.i686.rpm

======LAB==== Intall the package called tree.


mount the iso/dvd We need to insert/attach dvd/iso ( open vmware
client-> select the vm-> right click on vm-> settings/edit settings-
>select the cd/dvd->use iso image file-> browse and attache the
iso( select connected and connect at power on radio buttons.)
Syn: mount options devicename localmountpoint
# mount /dev/cdrom /mnt
# cd /mnt/Packages (Note: rhel6: cd /mnt/Server)

#pwd
#rpm -ivh tree-1.6.0-10.el7.x86_64.rpm
#rpm -q tree
#rpm -e tree
#rpm -q tree
#rpm -ivh tree-1.6.0-10.el7.x86_64.rpm
# rpm -qi tree
# rpm -qip tree-1.6.0-10.el7.x86_64.rpm
#rpm -qlp tree-1.6.0-10.el7.x86_64.rpm

===================lab output==================
[root@server1 Packages]# rpm -ivh tree-1.6.0-10.el7.x86_64.rpm
Preparing... #################################
[100%]
package tree-1.6.0-10.el7.x86_64 is already installed
[root@server1 Packages]# rpm -evh tree
Preparing... #################################
[100%]
Cleaning up / removing...
1:tree-1.6.0-10.el7 #################################
[100%]
[root@server1 Packages]# rpm -ivh tree-1.6.0-10.el7.x86_64.rpm
Preparing... #################################
[100%]
Updating / installing...
1:tree-1.6.0-10.el7 #################################
[100%]
[root@server1 Packages]# rpm -e tree-1.6.0-10.el7.x86_64.rpm
error: package tree-1.6.0-10.el7.x86_64.rpm is not installed
[root@server1 Packages]# rpm -e tree
[root@server1 Packages]# rpm -Uvh tree-1.6.0-10.el7.x86_64.rpm
Preparing... #################################
[100%]
Updating / installing...
1:tree-1.6.0-10.el7 #################################
[100%]
[root@server1 Packages]# rpm -e tree
[root@server1 Packages]# rpm -Fvh tree-1.6.0-10.el7.x86_64.rpm
====================================================================
[root@server1 Packages]# rpm -q tree

where: -i install, -q querry, -h= hashing progress, -c=


configuration files, -d= documentation, U=upgrade,F=freshen
========================veryfiying the package==================

[root@rhel7 Packages]# cp /mnt/Packages/tree-1.6.0-10.el7.x86_64.rpm /tmp

[root@rhel7 Packages]# cd /tmp/


[root@rhel7 tmp]# date
Tue May 25 21:28:44 PDT 2021
[root@rhel7 tmp]# date >> tree-1.6.0-10.el7.x86_64.rpm
[root@rhel7 tmp]# rpm -K tree-1.6.0-10.el7.x86_64.rpm
tree-1.6.0-10.el7.x86_64.rpm: RSA sha1 (MD5) PGP MD5 NOT OK
[root@rhel7 tmp]# rpm -K /mnt/Packages/tree-1.6.0-10.el7.x86_64.rpm
/mnt/Packages/tree-1.6.0-10.el7.x86_64.rpm: RSA sha1 ((MD5) PGP) md5 NOT
OK (MISSING KEYS: (MD5) PGP#fd431d51)
[root@rhel7 tmp]# rpm --import /mnt/RPM-GPG-KEY-redhat-release
[root@rhel7 tmp]# rpm -K /mnt/Packages/tree-1.6.0-10.el7.x86_64.rpm
/mnt/Packages/treecxx-1.6.0-10.el7.x86_64.rpm: rsa sha1 (md5) pgp md5 OK
[root@rhel7 tmp]# rpm -K tree-1.6.0-10.el7.x86_64.rpm
tree-1.6.0-10.el7.x86_64.rpm: rsa sha1 (MD5) PGP MD5 NOT OK
[root@rhel7 tmp]#

============================================history======================
=================
which date
# which mount
# rpm -qf /usr/bin/mount
# cp /usr/bin/date /usr/bin/mount
# mount
# date
# pwd
# which mount
# ls -l
# alias
# rpm -qf /usr/bin/mount
# rpm -ivh util-linux-2.23.2-65.el7.
# rpm -ivh util-linux-2.23.2-65.el7.x86_64.rpm
# mount
# rpm -ivh util-linux-2.23.2-65.el7.x86_64.rpm --force
# mount
# clear
# rpm -ivh tree-1.6.0-10.el7.x86_64.rpm
# rpm -e tree
# rpm -i tree-1.6.0-10.el7.x86_64.rpm
# rpm -e tree
#rpm -ivh tree-1.6.0-10.el7.x86_64.rpm
# rpm -e tree
# rpm -Uvh tree-1.6.0-10.el7.x86_64.rpm
# rpm -e tree
# rpm -Fvh tree-1.6.0-10.el7.x86_64.rpm
# rpm -ivh tomcat-7.0.76-15.el7.noarch.rpm
# rpm -ivh apache-commons-collections-3.2.1-22.el7_2.noarch.rpm
# df -hT
========================================================================

Creating private/local repository or YUM server.

1. mount the iso/dvd ( open vmware client-> select the vm-> right click
on vm-> settings/edit settings->select the cd/dvd->use iso image file->
browse and attache the iso( select connected and connect at power on)
# mount /dev/cdrom /mnt
or
# mount /dev/cdrom1 /mnt
# df -hT --> check the dvd/iso is mounted or not.

2. copy the rpms to local server


# mkdir -p /var/ftp/pub/rhel7.9
# cp -vrf /mnt/* /var/ftp/pub/rhel7.9
3. install the required packages for creating the repository and create
repo
#cd /mnt/Packages
syn: rpm -ivh createrepo-<presstab> deltarpm-(press tab> python-
deltarpm-<presstab>

#rpm -ivh createrepo-0.9.9-28.el7.noarch.rpm deltarpm-3.6-


3.el7.x86_64.rpm python-deltarpm-3.6-3.el7.x86_64.rpm
# rpm -qa | grep -E "delta|create"
python-deltarpm-3.6-3.el7.x86_64
deltarpm-3.6-3.el7.x86_64
createrepo-0.9.9-28.el7.noarch

# createrepo -v /var/ftp/pub/rhel7.9
4. enable the repository.
# vi /etc/yum.repos.d/rhel7.9.repo
[rhel7.9]
name="rhel 7.9 default os packages"
baseurl=file:///var/ftp/pub/rhel7.9
enabled=1
gpgcheck=1

5. test the repository and intall the packages.


# yum clean all
# yum repolist
#rpm --import /mnt/RPM-GPG-KEY-redhat-release
# yum install tomcat
# yum tree
# yum install java
# yum list installed
# yum list available
#yum check-update
# yum list vim-common
# yum updateinfo list all
# yum updateinfo list --security
# yum update --security
# yum --security update-minimal
# yum update --exclude=kernel
# yum localinstall packagename -y
#yum whatprovides /usr/bin/mount
# yum history
# yum history info <serviceid> example: yum history info 26
# yum history undo 26

[root@ip-172-31-86-104 ~]# yum grouplist


Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Installed Groups:
Development Tools
Available Groups:
AWS Tools
buildsys-build
Done

[root@ip-172-31-86-104 ~]# yum group install "Development Tools" -y

========================removing repository===============
1. remove the repo
# cd /etc/yum.repos.d
# ls -ltr
# rm rhel7.9.repo
2. check and remove the packages if it installed.
# rpm -qa | grep -E "delta|create"
# rpm -e createrepo deltarpm python-detlarpm
#rpm -evh createrepo python-deltarpm deltarpm --nodeps : if asks to
remove the dependencies.
3. remove the packages dir
# rm -rf /var/ftp/pub/rhel7.9
4. umount the dvd/iso imagent
# umount /mnt
or
# umount /dev/cdrom

You might also like