[No audio]
System updates and repos. repos stands
for repositories. This is a very
important lesson for installing new
packages to your systems. So there are
two major commands that are used in
system updates and repos installation is
the first one is yum. yum command is
mostly used in CentOS or in Redhat
environment. Whereas apt-get is another
similar command that is used in other
Linux distribution servers. yum command
installs a package from the repositories
that are defined in your Linux system,
those repositories, those configuration
files, has the URL link for
repositories. So when you run yum, it's
telling the system go online with this
URL and get the package that I'm asking
you to install. So in other words, yum
does need an Internet access to go
online and install a package to your system.
[No audio]
Then the next command we have is
rpm. rpm stands for Red Hat Package
Manager. Now rpm, of course was first
developed by Red Hat and is still in use
by Red Hat. But nowadays many other
Linux distributions have carried over
the same command rpm they never changed.
Now what's the purpose of rpm? Before I
tell you about rpm, let me tell you a
difference between rpm and yum. This way
it will be much easier for you to
understand what rpm is. rpm is used when
you already have package downloaded in
your system. And then you could install
it locally by running the command rpm.
Now whereas yum, yum does all the things
for you. In downloads the package,
installs the package as well. So rpm is
mostly used in an environment where they
don't have internet access. So let's get
into our Linux machine I'll try both
of these commands. Okay, I am logged
into my Linux machine as root. Which
directory I'm in? I'm in root directory,
and there are different commands and of
course what is my hostname? My hostname
is MyFirstLinuxOS.
Of course now we know we are not in the
wrong system. When you are installing
packages, please also make sure, run a
hostname so you don't install packages
to a wrong system. Okay, so now the next
the first command that we will learn is
yum. If I wanted to install a package,
let's say ntp, all I have to do is type
yum ntp, sorry yum install ntp. It
will go outside to the mirrors or
wherever the URL has been specified, and
it will look for our NTP package. Now
before it goes outside, it looks for
within itself within its own
system, and see whether the NTP package
has been installed already or not. In
this case, I try to install NTP package
and what happened. It says NTP package
has already been installed with the
latest version, so nothing to do. Okay,
perfect. So I don't have to install it.
I don't have to update it. Now what
about if I wanted to install Apache and
Apache package name is http. It will do
again the same thing, and if I have the
system, if I have the package installed,
it will give me the same message that it gave me before.
[No audio]
It says, No package http
available, I believe it is httpd. Okay,
yes, same message, https, centos already
installed and with the latest version.
Okay, so now before we go ahead and try
a third package to install, I wanted to
check if that package has already been
installed in my system or not. And to
check that I have to run the command rpm
minus which has the option q for query,
query all the packages that I have
installed in my system with minus
with a option. When you hit Enter, it
went into my list of packages that are
installed. It's giving me every single
packages. Of course, there's so many of
them. What if I wanted to know how many
packages I have installed? I will do
simply wc -l. This will give me the
total number of packages that are
installed. Of course, wc -l in this
case is not actually counting the
packages, it's actually count counting
the lines, the output of rpm -qa,
is telling me there are 1350 packages
installed. Now I want to see, I want to
install a package for DNS. Now before I
install a package for DNS, I wanted to
check if that package is installed. So
I'll do rpm -qa | grep, and the
package that needs to install
associated with the DNS
it's called bind. I'll do rpm minus qa
and grep for bind only. And you will see
here it has the bind-libs-lite, keybinder,
bind-libs, bind-license,
rpcbind, and bind-utils. So there
is no package with just bind. So it
means I don't have DNS installed. So
what I will do is, I will install by
running the command yum install bind.
When I hit Enter, now it's doing the
same thing. It's going outside on the
internet to all the repositories that
are defined in my configuration files.
And it's coming back with the package
saying, Hey, I found this package called
bind. And its architecture version that
I find which matches to your system is
64 bit, the version that you will be
installing of bind is this, repositories,
update the repository and the
size is 1.8 megabyte, the transaction
summary is right here, install one
package, total download size is going to
be 1.8 Meg. So I'll go ahead and it will
say is it okay? I'll say yes, go ahead
and install the package. And if you see
the progress, depending on the speed of
your computer, how fast it is connected
to the internet, that's what matters in
doing the download and install. So right
now, if you see that the yum is doing
two things for us. One, it's downloading
the package. Once it's completed
downloading, then right here, it's
installing the package, it's installed.
Once it's installed, it verified it, and
it has confirmed that it has installed
the package. Now how do I verify again
manually by running the command rpm -qa,
grep for bind.
[No audio]
Okay, and now this time you will see right here, yes,
the third, fourth line, this one is just
simply bind without any libs, license, or
any other extra packages that needed for
bind. So, yum also installed any
dependencies, meaning if there is any
other packages that is required with
this package, it does it for sure,,
whereas rpm, if you have one rpm
package, when you run the command,
it will tell you, hey, I don't have that
dependency, so you have to install that
package as well. So to again, to go back
to our rpm command, to install a
package, you have to use the command rpm
minus ihv, or you could change that to
hiv, vih whichever the way you want,
space, the location of your rpm. So if
you have downloaded your rpm, in let's
say tmp, then you will specify slash
tmp slash package, whatever the name of
the package is, and usually the package
ends with dot rpm. Then when you run
this command, it will install that
package for you. Now, you could also do
rpm minus e to remove a package. So let's
say if I wanted to remove this package,
bind, the one we just installed. So I
will have to type here now bind,
[No audio]
our package is not, sorry. I did some kind
of mistake, so rpm minus e, let me see if I
could copy and paste, should be able to do that.
[No audio]
Yes, copy and paste.
[No audio]
It's gone. Now
can, I verify it rpm -qa, grep for bind.
[No audio]
Okay, you see it's not there. So
what do we do now if I want to install
it back, I will do yum install bind.
[No audio]
Click yes to install it, yes it is
downloading again, same process and it's
downloading. Now you probably would
thinking hey, didn't it download when we
when we did the same command before?
Yes, it did download, but yum is very
smart tool. What it does, it downloads, it
installs, it verifies, and it also cleans
up your downloads, so your space,
this space is used more efficiently, so
it doesn't keep the old downloads on
your system. Okay, so now the download
is completed, let's check again if we have the package.
[No audio]
Yes, we do have the
package, and package is right here the
first one. Now we use the rpm -e
command to remove that package. Now we
could also do yum remove bind, and it
will do the same thing as if I would do
rpm -e. So it says, Remove one
package, yes, go ahead and remove it.
[No audio]
There you go, so it's gone. So anyway guys, I hope
you know now that how rpm and yum command
works. You will be working a lot with
this these two commands if you're going
to be in a system administration capacity.
[No audio]