ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Linux: Installing with YUM

    IT Discussion
    linux centos scottalanmiller sam linux administration yum rpm package management
    6
    18
    3.9k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • scottalanmillerS
      scottalanmiller
      last edited by scottalanmiller

      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

      1 Reply Last reply Reply Quote 2
      • DashrenderD
        Dashrender
        last edited by

        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.

        stacksofplatesS 1 Reply Last reply Reply Quote 0
        • stacksofplatesS
          stacksofplates @Dashrender
          last edited by

          @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.

          1 Reply Last reply Reply Quote 0
          • DashrenderD
            Dashrender
            last edited by

            nice - thanks - Scott should definitely add this to his YUM pages.

            scottalanmillerS 1 Reply Last reply Reply Quote 0
            • scottalanmillerS
              scottalanmiller @Dashrender
              last edited by

              @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 and apropos.

              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.

              1 Reply Last reply Reply Quote 0
              • scottalanmillerS
                scottalanmiller
                last edited by

                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.

                1 Reply Last reply Reply Quote 0
                • scottalanmillerS
                  scottalanmiller
                  last edited by

                  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.

                  ntoxicatorN travisdh1T 2 Replies Last reply Reply Quote 0
                  • ntoxicatorN
                    ntoxicator @scottalanmiller
                    last edited by

                    @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! 🙂

                    1 Reply Last reply Reply Quote 1
                    • travisdh1T
                      travisdh1 @scottalanmiller
                      last edited by

                      @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.

                      stacksofplatesS 1 Reply Last reply Reply Quote 1
                      • scottalanmillerS
                        scottalanmiller
                        last edited by

                        I can scroll with my terminal, so using more isn't really necessary.

                        1 Reply Last reply Reply Quote 2
                        • wirestyle22W
                          wirestyle22
                          last edited by wirestyle22

                          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.

                          travisdh1T 1 Reply Last reply Reply Quote 0
                          • travisdh1T
                            travisdh1 @wirestyle22
                            last edited by

                            @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.)

                            wirestyle22W scottalanmillerS 2 Replies Last reply Reply Quote 1
                            • wirestyle22W
                              wirestyle22 @travisdh1
                              last edited by wirestyle22

                              @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.

                              1 Reply Last reply Reply Quote 2
                              • scottalanmillerS
                                scottalanmiller @travisdh1
                                last edited by

                                @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.

                                1 Reply Last reply Reply Quote 2
                                • stacksofplatesS
                                  stacksofplates @travisdh1
                                  last edited by stacksofplates

                                  @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.

                                  travisdh1T scottalanmillerS 2 Replies Last reply Reply Quote 1
                                  • travisdh1T
                                    travisdh1 @stacksofplates
                                    last edited by

                                    @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.

                                    scottalanmillerS 1 Reply Last reply Reply Quote 1
                                    • scottalanmillerS
                                      scottalanmiller @stacksofplates
                                      last edited by

                                      @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.

                                      1 Reply Last reply Reply Quote 0
                                      • scottalanmillerS
                                        scottalanmiller @travisdh1
                                        last edited by

                                        @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.

                                        1 Reply Last reply Reply Quote 2
                                        • 1 / 1
                                        • First post
                                          Last post