10-25-2020

https://youtu.be/BaAolHcypdc

 

 

Software and package Management

RPM and YUM

 

RPM – Redhat Package manager

This is used to manage a package – add, remove, update – not efficient

Rpm base Linux – RHEL, OEL, CentOs, Fedora, SuSE

 

The package extension is .rpm

 

YUM – Yellowdog, Updater, Modifier

 

Yum is the primary tool for getting, installing, deleting, querying, and managing RPM software packages

 

RPM

 

Wuery the installed packages on the system

 

[root@zmpt01 ~]# rpm -qa | sort

 

To check detailed specific dteails of package

[root@zmpt01 ~]# rpm -qi tree

Name        : tree

Version     : 1.6.0

Release     : 10.el7

Architecture: x86_64

Install Date: Sat 10 Oct 2020 04:37:34 PM EDT

Group       : Applications/File

Size        : 89505

License     : GPLv2+

Signature   : RSA/SHA256, Fri 04 Jul 2014 01:36:46 AM EDT, Key ID 24c6a8a7f

Source RPM  : tree-1.6.0-10.el7.src.rpm

Build Date  : Mon 09 Jun 2014 03:28:53 PM EDT

Build Host  : worker1.bsys.centos.org

Relocations : (not relocatable)

Packager    : CentOS BuildSystem <http://bugs.centos.org>

Vendor      : CentOS

URL         : http://mama.indstate.edu/users/ice/tree/

Summary     : File system tree viewer

Description :

The tree utility recursively displays the contents of directories in a

tree-like format.  Tree is basically a UNIX port of the DOS tree

utility.

 

View by date

 

 

[root@zmpt01 ~]# rpm -qa -last | grep tree

tree-1.6.0-10.el7.x86_64                      Sat 10 Oct 2020 04:37:34 PM EDT

[root@zmpt01 ~]# rpm -qa –last

 

View the package Location

 

[root@zmpt01 ~]# rpm -ql tree

/usr/bin/tree

/usr/share/doc/tree-1.6.0

/usr/share/doc/tree-1.6.0/LICENSE

/usr/share/doc/tree-1.6.0/README

/usr/share/man/man1/tree.1.gz

 

View the package documentation

[root@zmpt01 ~]# rpm -qld tree

/usr/share/doc/tree-1.6.0/LICENSE

/usr/share/doc/tree-1.6.0/README

/usr/share/man/man1/tree.1.gz

 

Check the configuration files of a package

 

[root@zmpt01 ~]# rpm -qlc firewalld

/etc/dbus-1/system.d/FirewallD.conf

/etc/firewalld/firewalld.conf

/etc/firewalld/lockdown-whitelist.xml

/etc/sysconfig/firewalld

 

Check file or folder belongs to using name

 

[root@zmpt01 ~]# rpm -qf /etc/firewalld/firewalld.conf

firewalld-0.6.3-2.el7.noarch

 

Find the documentation using the file name

 

[root@zmpt01 ~]# rpm -qfd /etc/firewalld

/usr/share/doc/firewalld-0.6.3/COPYING

/usr/share/doc/firewalld-0.6.3/README

/usr/share/man/man1/firewall-cmd.1.gz

/usr/share/man/man1/firewall-offline-cmd.1.gz

/usr/share/man/man1/firewalld.1.gz

/usr/share/man/man5/firewalld.conf.5.gz

/usr/share/man/man5/firewalld.dbus.5.gz

/usr/share/man/man5/firewalld.direct.5.gz

/usr/share/man/man5/firewalld.helper.5.gz

/usr/share/man/man5/firewalld.icmptype.5.gz

/usr/share/man/man5/firewalld.ipset.5.gz

/usr/share/man/man5/firewalld.lockdown-whitelist.5.gz

/usr/share/man/man5/firewalld.richlanguage.5.gz

/usr/share/man/man5/firewalld.service.5.gz

/usr/share/man/man5/firewalld.zone.5.gz

/usr/share/man/man5/firewalld.zones.5.gz

 

Query what package provides

                                                       

[root@zmpt01 ~]# rpm -q --provides firewalld

config(firewalld) = 0.6.3-2.el7

firewalld = 0.6.3-2.el7

 

[root@zmpt01 ~]# rpm -q --provides tree

tree = 1.6.0-10.el7

tree(x86-64) = 1.6.0-10.el7

 

Package dependencies

 

[root@zmpt01 ~]# rpm -q --requires tree

libc.so.6()(64bit)

libc.so.6(GLIBC_2.14)(64bit)

libc.so.6(GLIBC_2.2.5)(64bit)

libc.so.6(GLIBC_2.3)(64bit)

libc.so.6(GLIBC_2.3.4)(64bit)

libc.so.6(GLIBC_2.4)(64bit)

rpmlib(CompressedFileNames) <= 3.0.4-1

rpmlib(FileDigests) <= 4.6.0-1

rpmlib(PayloadFilesHavePrefix) <= 4.0-1

rtld(GNU_HASH)

rpmlib(PayloadIsXz) <= 5.2-1

To get a list of loactions where the package will be written – when the packages in downloaded locally

 

[root@zmpt01 ~]# rpm -qlp firefox-68.12.0-1.el7.centos.x86_64.rpm

 

Man pages

 

[root@zmpt01 ~]# man rpm

 

10-25-2020

https://youtu.be/BaAolHcypdc

 

 

YUM

 

 

-          YUM uses .rpm to install packages on RPM base OS [RHEL]

-          YUM resolves dependencies automatically

-          YUM uses repositories < --- centralized location to download software from [org, universities, companies]

-          You can manitain your own local repo or use from internet

-          YUM local repos is maintained by Administrator

-          YUM also has a concept of group packages

-          YUM group packages contain multiple packages

-          Group packages can be installed and removed a group

-          Groups can contain optional packages

-          Installing group packages is easier and fast

-          YUM check preinstalled package – system will not corrupted if you accidentally install again

 

-          Location of local repo on the system

-          /etc/yum.repos.d

-          YUM gets the list of available software packages

-          YUM downloads the pakcges and isntall them using .rpm libraries

-          YUM updates RPM database lcoally afer installation

-          *** Installing using YUM is easy

 

If you want to see if the package is savilable

 

 

[root@zmpt01 ~]# yum provides firefox

 

firefox-68.12.0-1.el7.centos.x86_64 : Mozilla Firefox Web browser

Repo        : updates

 

To check the package dependencies

 

[root@zmpt01 ~]# yum deplist firefox | wc -l

Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast

551

 

Install using yum

 

[root@zmpt01 ~]# yum install firefox              < ---This will install the latest availble packaged/ software

 

Transaction Summary

=============================================================================

Install  1 Package (+83 Dependent packages)

 

Total download size: 126 M

Installed size: 324 M

Is this ok [y/d/N]:

 

Remove package

This will not remove the dependencies

 

[root@zmpt01 ~]# yum remove firefox –y

 

Remove package and Dependencies

 

[root@zmpt01 ~]# yum autoremove firefox –y

 

10-31-2020

 

 

Check obsolete packages on your system

[root@zmpt01 ~]# yum list obsoletes

 

Get the list of packages which are avaible to install from repo – and still supported

 

[root@zmpt01 ~]# yum --showduplicates list available

firefox.i686                              68.5.0-2.el7.centos            base

firefox.x86_64                            68.5.0-2.el7.centos            base

firefox.i686                              68.6.0-1.el7.centos            updates

firefox.x86_64                            68.6.0-1.el7.centos            updates

firefox.i686                              68.6.1-1.el7.centos            updates

firefox.x86_64                            68.6.1-1.el7.centos            updates

firefox.i686                              68.7.0-2.el7.centos            updates

firefox.x86_64                            68.7.0-2.el7.centos            updates

firefox.i686                              68.8.0-1.el7.centos            updates

firefox.x86_64                            68.8.0-1.el7.centos            updates

firefox.i686                              68.9.0-1.el7.centos            updates

firefox.x86_64                            68.9.0-1.el7.centos            updates

firefox.i686                              68.10.0-1.el7.centos           updates

firefox.x86_64                            68.10.0-1.el7.centos           updates

firefox.i686                              68.11.0-1.el7.centos           updates

firefox.x86_64                            68.11.0-1.el7.centos           updates

firefox.i686                              68.12.0-1.el7.centos           updates

firefox.x86_64                            68.12.0-1.el7.centos           updates   < ---if you see package underline, its installed

 

If you want to search the package using term

 

[root@zmpt01 ~]# yum search firefox

 

 

============================= N/S matched: firefox =============================

firefox.i686 : Mozilla Firefox Web browser

firefox.x86_64 : Mozilla Firefox Web browser

 

If you want to list all the packages from repo – ONLY LATEST PACKAGES

 

 

[root@zmpt01 ~]# yum list all | grep firefox

firefox.x86_64                              68.12.0-1.el7.centos       @updates

firefox.i686                                68.12.0-1.el7.centos       updates

 

Install the download only plugin

 

[root@zmpt01 ~]#  yum install yum-plugin-downloadonly

 

Download locally specifiying the directory – THIS WILL ALSO DOWNLOAD THE DEPENDENT PACKAGES

 

[root@zmpt01 ~]# yum install --downloadonly --downloaddir=. Firefox

 

TO CHECK the files and directories updated by the package

 

[root@zmpt01 ~]# rpm -qlp firefox-68.12.0-1.el7.centos.x86_64.rpm

 

Reinstall the package – good when package is corrupted or configuration file is missing

 

[root@zmpt01 ~]# yum reinstall firefox –y                                       < ---from repo

 

[root@zmpt01 ~]# yum reinstall firefox-68.12.0-1.el7.centos.x86_64.rpm –y   < --- from local download

 

 

Yum detects installed files and only install corrupted files, missing and files and folder

 

[root@zmpt01 lib64]# rm -rf firefox

 

[root@zmpt01 lib64]# yum reinstall firefox-68.12.0-1.el7.centos.x86_64.rpm -y

 

skip package which are causing issue

--skip-broken

              Resolve  depsolve problems by removing packages that are causing

              problems from the transaction.

 

 

[root@zmpt01 ~]# yum install --skip-broken firefox-68.12.0-1.el7.centos.x86_64.rpm -y

 

10-31-2020

https://youtu.be/Ds7UJ_lLG7s

 

 

 

 

System wide update

 

 

To see the installed packages

 

[root@zmpt01 ~]# yum list installed

 

Bold

Upate in repo avaiable

Bold and Underline

Current installed Kernel

Red

Package is installed but its not in repo -

Yellow

New package is available in repo

 

 

Check for updates

 

[root@zmpt01 ~]# yum check-updates

 

This will provide the current listed packes that will updated

 

kernel.x86_64               3.10.0-1127.19.1.el7   updates      < ---Careful with the kernel update – this will system upgrade

 

 

7.1 kernel 3.10.0-229

7.1.1503/

7.2 kernel 3.10.0-327

7.2.1511/

7.3 kernel 3.10.0-514

7.3.1611/

7.4 kernel kernel 3.10.0-693

7.4.1708/

7.5 kernel 3.10.0-862

7.5.1804/

7.6 kernel 3.10.0-957

7.6.1810/

7.7 kernel 3.10.0-1062                         < ---current Kernel Version

7.7.1908/

7.8 kernel 3.10.0-1127                        < ---update version              < ---this will be considered upgrade

 

7.8.2003/

 

 

 

 

 

7.9 kernel 3.10.0-1160

 

           

Kernel: Linux 3.10.0-1062.el7.x86_64

 

Major Version

Major Release

Patch

Rehat Version

Linux Verion

64 bit Arch

3

10

0

1062

el7

x86_64

3

10

0

1127

el7

X86_64

 

 

You can use this to look at any package information

 

 

[root@zmpt01 ~]# yum update –y   < ---System Update

 

 

Install    2 Packages

Upgrade  141 Packages

 

Total download size: 258 M

 

Complete!

 

 

 

NOTE:  you can see new kernel as well as old kernel

 

If you want you can use old kernel if there is issue after the kernel UPDATE

 

Kernel update is considered as security update –

 

Unix / Linux - Getting Started - Tutorialspoint

 

 

Kernel is central component of an operating system that manages operations of computer and hardware. It basically manages operations of memory and CPU time. It is core component of an operating system

 

           

Kernel: Linux 3.10.0-1062.el7.x86_64

 

Major Version

Major Release

Patch

Rehat Version

Linux Verion

64 bit Arch

3

10

0

1062

el7

x86_64

 

 

You can use this to look at any package information

 

 

Kernel ONLY UPGrade

 

 

 

If only kernel update is required – Kernel update is considered Security Update

Check for available kernel

 

[root@zmpt01 ~]# yum list available kernel

 

kernel.x86_64                    3.10.0-1127.19.1.el7                    updates

 

Current version

 

[root@zmpt01 ~]# uname -r

3.10.0-1062.el7.x86_64

 

Update kernel now

 

 

 

================================================================================

 Package       Arch          Version                       Repository      Size

================================================================================

Installing:

 kernel        x86_64        3.10.0-1127.19.1.el7          updates         50 M

 

Transaction Summary

================================================================================

Install  1 Package

 

Total download size: 50 M

Installed size: 64 M

Is this ok [y/d/N]: y

 

Reboot

 

[root@zmpt01 ~]# init 6

 

The new kernel will be set as default Kernel

 

 

 

[root@zmpt01 ~]# uname -r

3.10.0-1127.19.1.el7.x86_64

 

Kernal physical location on Hard disk

 

[root@zmpt01 boot]# pwd

/boot

[root@zmpt01 boot]# ls -ltrh | grep vm

-rwxr-xr-x. 1 root root 6.5M Aug  7  2019 vmlinuz-3.10.0-1062.el7.x86_64                        < ---Old Kernel

-rwxr-xr-x. 1 root root 6.5M Aug 25 13:27 vmlinuz-3.10.0-1127.19.1.el7.x86_64              < ---New Kernel

-rwxr-xr-x. 1 root root 6.5M Oct  4 15:49 vmlinuz-0-rescue-47384aabe2f84a189b94eba36b48046c  < ---Rescue Kernel

 

List of installed kernels using awk command

 

[root@zmpt01 ~]# awk -F\' '$1=="menuentry "{print $2}' /etc/grub2.cfg

CentOS Linux (3.10.0-1127.19.1.el7.x86_64) 7 (Core)                                       < ---This is position 0

CentOS Linux (3.10.0-1062.el7.x86_64) 7 (Core)                                                < ---This is position 1

CentOS Linux (0-rescue-47384aabe2f84a189b94eba36b48046c) 7 (Core)

 

 

Default kernel is set in following file

 

[root@zmpt01 ~]# grub2-set-default 1           

 

 

Old version is now default

 

[root@zmpt01 ~]# uname -r

3.10.0-1062.el7.x86_64

 

Change it to new version

 

[root@zmpt01 ~]# grub2-set-default 0

 

If you want to set BIOS based or UEFI base GRUB

 

BIOS based system

 

Grub2.mkconfig /boot/grub2/grub.cfg                  < ----if you see this file in this folder then it’s a BIOS based OS

 

----------------------------------------------------------------------------------------

 

UEFI based system

 

Grub2.mkconfig –o /boot/efi/EFI/centos/grub.cfg  < ---if you see this file in this folder then it’s a UEFI based OS

 

10-31-2020

https://youtu.be/Ds7UJ_lLG7s

 

 

GUI Install

 

 

[root@zmpt01 ~]# uname -r

3.10.0-1062.el7.x86_64

 

[root@zmpt01 ~]# df -h

Filesystem               Size  Used Avail Use% Mounted on

devtmpfs                 484M     0  484M   0% /dev

tmpfs                    496M     0  496M   0% /dev/shm

tmpfs                    496M  6.8M  489M   2% /run

tmpfs                    496M     0  496M   0% /sys/fs/cgroup

/dev/mapper/centos-root   14G  1.8G   12G  14% /             < ---Size is just about 2GB, at this point its full functioning OS

/dev/sda1               1014M  136M  879M  14% /boot

tmpfs                    100M     0  100M   0% /run/user/0

 

GUI Installation is a major upgrade

 

[root@zmpt01 ~]# yum group install gnome-desktop x11 fonts –y

 

Install  286 Packages (+740 Dependent packages)

Upgrade               (  21 Dependent packages)

 

Total download size: 720 M

Complete

 

11-01-2020

https://www.youtube.com/watch?v=UxK_uzWrc10

 

Reboot

 

 

[root@zmpt01 ~]# uname -r

3.10.0-1127.19.1.el7.x86_64                                    < ---Kernel is updated

 

[root@zmpt01 ~]# df -h

Filesystem               Size  Used Avail Use% Mounted on

devtmpfs                 479M     0  479M   0% /dev

tmpfs                    496M     0  496M   0% /dev/shm

tmpfs                    496M  7.2M  489M   2% /run

tmpfs                    496M     0  496M   0% /sys/fs/cgroup

/dev/mapper/centos-root   14G  4.2G  9.3G  32% /                        < ---Size of the OS disk increased

/dev/sda1               1014M  185M  830M  19% /boot

tmpfs                    100M     0  100M   0% /run/user/0

 

 

Security updates

 

[root@zmpt01 ~]# yum update --security

 

[root@zmpt01 ~]# yum update-minimal –security

 

Group packages

List of packages which are groouped together, usually similar packages

 

[root@zmpt01 ~]# yum group list

 

You will ge al list of group packges

 

Example: Security Tools, Development Tools

 

List of packages in the group package

 

 

[root@zmpt01 ~]# yum group info "Development Tools"

 

Prefix

Description

-

Pacakage was not installed and won’t be installed as par tof group

+

Package was not installed but will be installed when you install as group

=

Package was installed as part of group

Blank Space

Package was installed but not as part of the group

 

 

If you want to install a group package

 

[root@zmpt01 ~]# yum group install "Development Tools"

 

If you want to update the group package

 

[root@zmpt01 ~]# yum group update "Development Tools"

 

If you want to remvoe the group package

 

[root@zmpt01 ~]# yum group remove "Development Tools"

 

NOTE: There is no autoremove available for group uninstall