Linux: Installing with YUM
-
Probably the most common task with YUM is installing new applications. YUM makes software installation incredibly simple. Assuming that the package that we want is already in a YUM Repo that we have set up, all we need to know is the name of the package that we want.
For this example we will install the wget package. wget is very commonly desired but not included in a minimal install of CentOS 7. wget is the easiest way to download a file from the command line from a web page.
yum install wget
It is that easy. The command will ask us to confirm the download, but that is all. Everything is handled for us.
If you are sure you know that you want to proceed or are scripting the command, you can add the -y flag for "yes" to force it to continue without asking you if you are sure.
yum -y install wget
YUM does all of the heavy lifting for us here. It goes out and searches our approved repositories to look for the package(s) that we want. It finds the most up to date version from the different repositories. It learns where to find the package and downloads it. If configured it checks the GPG key to ensure that the package downloaded has not been altered from the one authorized by the repo. This is an important security check to prevent package tampering. If there are dependencies needed for the package, and there often are, YUM will look them up and repeat the process for each of them - automatically finding, downloading, verifying and installing them so that the package(s) that we want can be installed.
YUM package package installation very fast and very easy. If we wanted to install multiple packages, we could do so like this:
yum -y install wget sysstat epel-release
That command will install the wget, the sysstat and the epel-release packages. Very handy and very easy to add to scripts.
Part of a series on Linux Systems Administration by Scott Alan Miller
-
What kinds of options to search for things you want to install?
For example, someone new to Linux would have no clue that wget is used to download from an HTTP site.
-
@Dashrender said:
What kinds of options to search for things you want to install?
For example, someone new to Linux would have no clue that wget is used to download from an HTTP site.
yum search
yum info
If I type
yum search http download
wget shows up. The short description is "A utility for retrieving files using the HTTP or FTP protocols.Long description from
yum info wget
is "GNU Wget is a file retrieval utility which can use either the HTTP or
FTP protocols. Wget features include the ability to work in the
background while you are logged out, recursive retrieval of
directories, file name wildcard matching, remote file timestamp
storage and comparison, use of Rest with FTP servers and Range with
HTTP servers to retrieve files over slow or unstable connections,
support for Proxy servers, and configurability. -
nice - thanks - Scott should definitely add this to his YUM pages.
-
@Dashrender said:
nice - thanks - Scott should definitely add this to his YUM pages.
It's also covered in the RPM pages already, which YUM is part of.
There is also
yum provides
,man -k
andapropos
.However, admins rarely go around searching for something to install. They know the tools that they need. Desktop users will search using graphical tools on the desktop.
-
Of course, there is always that situation where you know that you need some functionality but have no idea how to get it. This is extremely rare, but it does happen. In the real world, you just don't have very much call for installing something that you don't know what it is, even from the official repos.
So in an extreme case you need to download a file over HTTP and actually don't know that cURL and wget are the main tools for that. You could do any number of searches inside of Linux to teach yourself what tool is appropriate. But more likely you would go to Google to not find out what there "is" but to find out "how most people do it and how to use it."
If you did that, you'd find cURL was already there (and you just didn't know how to use the system as it was) and that wget is available for a less powerful, but easier experience for downloads. You'd find quickly enough data to know how to use the tools for your needs, not just acquire them.
Once you did that once, you'd know the two tools and never really need that again. Because of the repos you know that they will be there, available, all the time even if the master site moves, they will be signed, etc.
-
Now, what you will likely look up often, is exactly file names. For example, it is common to find that Python 2 packages are called python and Python 3 are called python3.
This is where
yum list | grep python
is awesome because it will list everything called python regardless and let you see what the options are. -
@scottalanmiller said:
Now, what you will likely look up often, is exactly file names. For example, it is common to find that Python 2 packages are called python and Python 3 are called python3.
This is where
yum list | grep python
is awesome because it will list everything called python regardless and let you see what the options are.This!
-
@scottalanmiller said:
Now, what you will likely look up often, is exactly file names. For example, it is common to find that Python 2 packages are called python and Python 3 are called python3.
This is where
yum list | grep python
is awesome because it will list everything called python regardless and let you see what the options are.Am I the only one that uses
yum search python | more
I mean, I know 'yum list | grep python' works, I find more often it turns into
yum list | grep python | more
nothing really wrong with either, just the way I tend to work.
-
I can scroll with my terminal, so using more isn't really necessary.
-
As a side note: The -y modifier assumes a yes for any interactive questions. I looked that up a little while ago and it was actually kind of hard to find. I've noticed that sometimes it doesn't actually ignore the interactive questions though. I assume this has to do with the package and what is required.
-
@wirestyle22 said:
The -y modifier assumes a yes for any interactive questions too. I looked that up a little while ago and it was actually kind of hard to find
It's right in the man page. Man is your friend, learn to love it! (uh, that might have come out wrong.)
-
@travisdh1 said:
@wirestyle22 said:
The -y modifier assumes a yes for any interactive questions too. I looked that up a little while ago and it was actually kind of hard to find
It's right in the man page. Man is your friend, learn to love it! (uh, that might have come out wrong.)
The reason I had trouble is because I was searching Yum commands not Yum modifiers Windows ruined any potential I had.
-
@travisdh1 said:
@wirestyle22 said:
The -y modifier assumes a yes for any interactive questions too. I looked that up a little while ago and it was actually kind of hard to find
It's right in the man page. Man is your friend, learn to love it! (uh, that might have come out wrong.)
It's illegal to use the man pages in Mississippi now.
-
@travisdh1 said:
@scottalanmiller said:
Now, what you will likely look up often, is exactly file names. For example, it is common to find that Python 2 packages are called python and Python 3 are called python3.
This is where
yum list | grep python
is awesome because it will list everything called python regardless and let you see what the options are.Am I the only one that uses
yum search python | more
I mean, I know 'yum list | grep python' works, I find more often it turns into
yum list | grep python | more
nothing really wrong with either, just the way I tend to work.
I do it also. After about he third time you search something while in a tmux session and you can't scroll up you learn to do that lol.
Except I've always used less, idk why I defaulted to that over more.
-
@johnhooks The difference is 6 compared to a half dozen (at least in this case.)
I used to know a reason why you would use less or more in certain cases, but it's been so long that I no longer remember what caused a difference.
-
@johnhooks said:
@travisdh1 said:
@scottalanmiller said:
Now, what you will likely look up often, is exactly file names. For example, it is common to find that Python 2 packages are called python and Python 3 are called python3.
This is where
yum list | grep python
is awesome because it will list everything called python regardless and let you see what the options are.Am I the only one that uses
yum search python | more
I mean, I know 'yum list | grep python' works, I find more often it turns into
yum list | grep python | more
nothing really wrong with either, just the way I tend to work.
I do it also. After about he third time you search something while in a tmux session and you can't scroll up you learn to do that lol.
Except I've always used less, idk why I defaulted to that over more.
That's why I don't use tmux often.
-
@travisdh1 said:
@johnhooks The difference is 6 compared to a half dozen (at least in this case.)
I used to know a reason why you would use less or more in certain cases, but it's been so long that I no longer remember what caused a difference.
I know of no case where you use more. I always used it because I learned it first, but less is the only one you would actually want to use.