< Return to Video

Linux Package Managers (Linux+ Objective 1.6.1)

  • 0:00 - 0:02
    Hello, everybody. I'm Shawn Powers, and
  • 0:02 - 0:04
    today we are talking about packages.
  • 0:04 - 0:07
    Oh my God. Look at my package.
  • 0:07 - 0:09
    No. We're talking about Linux packages--
  • 0:09 - 0:12
    specifically RPM and DEB-based package
  • 0:12 - 0:15
    management as part of the Linux+
  • 0:15 - 0:17
    exam objectives. Whether or not you want
  • 0:17 - 0:21
    to take the exam, that's what we're basing this video on. So we're going to
  • 0:21 - 0:24
    look at package management using
  • 0:24 - 0:28
    multiple tools: DNF, YUM, APT, Zypper, and
  • 0:28 - 0:30
    we're going to look at the two different
  • 0:30 - 0:35
    types of packages that are specified here--RPM, and then it doesn't spell it
  • 0:35 - 0:40
    out, but DEB packages for .deb files. And that's what we're going to look at.
  • 0:40 - 0:43
    Even though there are other options out there
  • 0:43 - 0:45
    for package management, these are the
  • 0:45 - 0:46
    main ones that we're going to look at.
  • 0:46 - 0:48
    They're the most common. They're used in
  • 0:48 - 0:50
    Red Hat variants and Debian variants
  • 0:50 - 0:53
    like Ubuntu, etc. And we're going to talk
  • 0:53 - 0:57
    just briefly about these. This is an odd sort of thing they added on to the
  • 0:57 - 1:00
    objectives, but kernel updates generally
  • 1:00 - 1:02
    require a reboot--not always, but almost always.
  • 1:02 - 1:05
    They’ll require a reboot, and they'll have to rebuild a bunch of modules.
  • 1:05 - 1:08
    So this isn't necessarily done every time
  • 1:08 - 1:11
    you update your system. You can update
  • 1:11 - 1:16
    packages either--depending on your distribution--you can update all the
  • 1:16 - 1:22
    packages, or you can update only the packages that need security updates.
  • 1:22 - 1:26
    There are several different ways you can go about updating packages and
  • 1:26 - 1:28
    kernel updates. And the most important
  • 1:28 - 1:32
    thing is to make sure that you have the most recent versions if there are
  • 1:32 - 1:36
    security fixes. But we're going to look at a bunch of different tools that you
  • 1:36 - 1:41
    can use to manage packages on your system, because by default, just
  • 1:41 - 1:45
    managing individual packages is not the way to go. Like I said, we're
  • 1:45 - 1:50
    going to look at DEB files like .deb, which comes from Debian, and
  • 1:50 - 1:53
    then .rpm, which stands for Red Hat Package Manager.
  • 1:53 - 1:57
    Back in the old days, there didn’t use to be this big
  • 1:57 - 2:00
    database-driven way to install and manage things on your system.
  • 2:00 - 2:04
    You used to have to install the .rpm or .deb
  • 2:04 - 2:09
    files, and it was really a pain in the butt because an individual RPM file or
  • 2:09 - 2:13
    DEB file does not necessarily contain all the dependencies.
  • 2:13 - 2:17
    Although they do know what dependencies they require,
  • 2:17 - 2:20
    if you try to install them manually, you
  • 2:20 - 2:22
    end up with a nightmare. Let me show you
  • 2:22 - 2:24
    what I mean. First, we'll start with Rocky Linux,
  • 2:24 - 2:29
    which is the same as Red Hat. So it uses RPM. Like I said, this is Rocky
  • 2:29 - 2:33
    Linux, which is just like Red Hat Enterprise Linux version 9.
  • 2:33 - 2:38
    I think this is Rocky version 9. Anyway, in here, I have an RPM file.
  • 2:38 - 2:43
    Now, this is not normally how you would get a file
  • 2:43 - 2:47
    installed on your Linux system, but it used to be this way. And occasionally,
  • 2:47 - 2:49
    you'll have to install an RPM. But let's
  • 2:49 - 2:54
    say we had this RPM file and we wanted to install it using just the RPM tools--
  • 2:54 - 2:57
    not the package management system.
  • 2:57 - 3:02
    Well, we would do: sudo rpm -i for install
  • 3:02 - 3:04
    and then the file that we want to install.
  • 3:04 - 3:07
    And now, if there are no dependencies or all the dependencies are
  • 3:07 - 3:09
    already installed on your system, hey--no
  • 3:09 - 3:13
    problem. However--well, I’ve got to put in my password--
  • 3:13 - 3:18
    you'll see here it's not going to install because we also have to have
  • 3:18 - 3:28
    libteam and libteam.so.5, which is probably part of the libteam file.
  • 3:28 - 3:30
    Yeah. That’s actually what it's saying.
  • 3:30 - 3:32
    It needs it from the libteam file. So what
  • 3:32 - 3:34
    we would have to do is go online and
  • 3:34 - 3:42
    try to find the proper version of libteam.rpm with the exact version
  • 3:42 - 3:44
    that we're looking for on the repos.
  • 3:44 - 3:46
    We would install that. And then, if that has
  • 3:46 - 3:50
    its own dependencies, we end up in something that used to be called "RPM
  • 3:50 - 3:56
    Hell." It was kind of a play on the term "DLL Hell," which is what Windows
  • 3:56 - 4:00
    users would talk about—like, "This DLL (Dynamic Link Library) in Windows
  • 4:00 - 4:02
    interferes with that DLL, and so I can't
  • 4:02 - 4:04
    have them both installed, and I can't get
  • 4:04 - 4:06
    my package to work," etc., etc. So this used
  • 4:06 - 4:08
    to be a very frustrating way to install
  • 4:08 - 4:11
    packages. And, of course, it's not limited
  • 4:11 - 4:15
    just to RPM-based things. The same thing is true on a Debian or Ubuntu
  • 4:15 - 4:18
    system that uses DEBs. So here, I'm on an
  • 4:18 - 4:20
    Ubuntu system which uses .deb files,
  • 4:20 - 4:22
    and you'll see I've already downloaded one.
  • 4:22 - 4:28
    This is curl, like the curl we talked about in a previous video. curl is used to
  • 4:28 - 4:30
    fetch a URL or a file online.
  • 4:30 - 4:33
    The curl program, though--to install it--we
  • 4:33 - 4:38
    could use the dpkg program, which manually
  • 4:38 - 4:45
    handles .deb files. So we could do: sudo dpkg -i for install and then this
  • 4:45 - 4:47
    file, curl, blah, blah, blah, blah, blah, and
  • 4:47 - 4:50
    we'll press enter. And if there were no
  • 4:50 - 4:55
    dependencies that were unmet, it would have installed and been available on our system to use.
  • 4:55 - 4:57
    However, just like with that RPM file,
  • 4:57 - 5:03
    this says: "Well, no. This depends on libcurl4." So, in the old days, we’d
  • 5:03 - 5:09
    have to go and find libcurl with the exact version it's looking
  • 5:09 - 5:13
    for, install that .deb file. Of course, that .deb file might have some other
  • 5:13 - 5:16
    dependency--like libcurl might depend on
  • 5:16 - 5:19
    glibc or something--and we’d have to find
  • 5:19 - 5:23
    that one and go all the way back until all the dependencies were met.
  • 5:23 - 5:26
    But thankfully, there is a better way.
  • 5:26 - 5:28
    In fact, there are quite a few better ways.
  • 5:28 - 5:31
    Because in the world of RPMs--like using Red Hat
  • 5:31 - 5:35
    or Rocky Linux, or even SUSE Linux, which
  • 5:35 - 5:41
    also uses the RPM system--there are package management systems that kind of
  • 5:41 - 5:48
    wrap around RPMs or DEBs, in the case of a Debian-based system.
  • 5:48 - 5:51
    And they kind of keep a database of all the
  • 5:51 - 5:56
    available packages on a repository on the Internet. When you say, "I want to
  • 5:56 - 6:01
    install something," it says, "Okay, what other dependencies are there?"
  • 6:01 - 6:04
    Then it finds all of those dependencies,
  • 6:04 - 6:07
    downloads and installs them, so you
  • 6:07 - 6:09
    don't have to track down each individual
  • 6:09 - 6:14
    one. It has made managing Linux so much better than it used to be.
  • 6:14 - 6:19
    But there are a lot of ways to skin the same cat--which is a horrible, horrible metaphor.
  • 6:19 - 6:24
    I don't like that. There are a lot of ways to manage packages in Linux.
  • 6:24 - 6:26
    I’ll show you the various ways mentioned in the
  • 6:26 - 6:28
    objectives, but note that there are others. Like,
  • 6:28 - 6:30
    if you're using Arch Linux, there's going to be Pacman.
  • 6:30 - 6:33
    We're not covering that. We're just going to cover the ones mentioned
  • 6:33 - 6:35
    in the objectives--and they are the most common.
  • 6:35 - 6:37
    So, for example, we're back here.
  • 6:37 - 6:39
    We're on Rocky Linux, which, like I said,
  • 6:39 - 6:42
    is just like Red Hat Linux. And instead
  • 6:42 - 6:44
    of using the RPM tool, we can say: "Oh, well,
  • 6:44 - 6:47
    there are two different tools that come with Red Hat variants," which is
  • 6:47 - 6:52
    interesting. One is yum, which stands for Yellowdog Updater Modified.
  • 6:52 - 6:54
    There's another whole story there. And the other
  • 6:54 - 6:58
    one is dnf, which was written by Red Hat,
  • 6:58 - 7:03
    and it stands for Dandified Yum, which I think is a little bit silly. dnf is newer.
  • 7:03 - 7:05
    It's the one that you should be using on
  • 7:05 - 7:08
    a Red Hat-based system because it has a
  • 7:08 - 7:12
    few more features--like the ability to roll back if you want to make a change.
  • 7:12 - 7:16
    I'll show you what I mean. But first of all, to install--let’s say--this
  • 7:16 - 7:19
    teamd thing that I had downloaded, we could say:
  • 7:19 - 7:26
    sudo yum install teamd
  • 7:26 - 7:28
    And this is the difference. See, we
  • 7:28 - 7:30
    couldn't install it before because there
  • 7:30 - 7:32
    were dependencies. The dependencies were
  • 7:32 - 7:35
    libteam. And like I said, libteam might
  • 7:35 - 7:39
    have its own dependencies--and sure enough, it does. If you look,
  • 7:39 - 7:44
    libteam apparently depends on libnl3-cli.
  • 7:44 - 7:48
    But the nice thing about using a package management system like YUM is
  • 7:48 - 7:53
    that it gets all of those dependencies and installs all of them.
  • 7:53 - 7:56
    So, in order to use YUM to install this teamd
  • 7:56 - 8:01
    package that I just randomly picked, I would just say "yes," and it would download
  • 8:01 - 8:05
    all of the packages required, install the dependencies, and then install that
  • 8:05 - 8:08
    package. Now, I'm going to say "no," not
  • 8:08 - 8:09
    because this doesn't work--this would
  • 8:09 - 8:11
    work perfectly fine--but I want to show
  • 8:11 - 8:15
    you how you would do the exact same thing using DNF.
  • 8:15 - 8:20
    In fact, the command-line flags are almost identical
  • 8:20 - 8:24
    when you're using DNF or YUM. So let's say:
  • 8:24 - 8:30
    sudo dnf install teamd.
  • 8:30 - 8:32
    And by looking at it, it even looks exactly the
  • 8:32 - 8:34
    same, right? It just has some more features.
  • 8:34 - 8:38
    So it's YUM, but "dandified"--thus the name, DNF.
  • 8:38 - 8:41
    And this is going to do the exact same thing. It's going to download the
  • 8:41 - 8:42
    dependencies. We'll actually do it this
  • 8:42 - 8:47
    time, but it does the same thing whether you're using YUM or DNF.
  • 8:47 - 8:53
    It's saying that there is a GPG key. Do I want to import that?
  • 8:53 - 8:56
    I'm going to say yes. I want to import that, and boom.
  • 8:56 - 9:01
    There--it installed it, and now it's running, and it keeps like a
  • 9:01 - 9:04
    database of everything that is installed on the system. So the next time we
  • 9:04 - 9:06
    install something, if one of its
  • 9:06 - 9:11
    dependencies is this teamd or libteam or whatever it was, it'll say, "Oh,
  • 9:11 - 9:13
    that's already installed." I don't need to
  • 9:13 - 9:16
    download that. So like I said, YUM and DNF
  • 9:16 - 9:19
    are almost exactly the same when you're
  • 9:19 - 9:21
    using them on the command line. It's very
  • 9:21 - 9:25
    possible that YUM will go away in the future. Right now, it's still installed.
  • 9:25 - 9:27
    It's still a perfectly cromulent way to,
  • 9:27 - 9:30
    you know, manage the packages on your system, and you can mix or match.
  • 9:30 - 9:32
    You could use YUM, and then you could use DNF.
  • 9:32 - 9:36
    They have the same database of information that they pull from.
  • 9:36 - 9:39
    So you can use either or right now, but it would
  • 9:39 - 9:45
    not surprise me if YUM goes away in some future version of Red Hat stuff.
  • 9:45 - 9:48
    It's just been replaced by DNF, so there's no
  • 9:48 - 9:53
    reason not to use DNF. And DNF will do--like I said--it will roll back.
  • 9:53 - 9:56
    It'll allow you to take back, like, if you
  • 9:56 - 9:58
    install something on your side and you want
  • 9:58 - 10:00
    to undo that, DNF allows you to do that,
  • 10:00 - 10:02
    whereas Yum does not. And that really is
  • 10:02 - 10:04
    one of the big differences between the
  • 10:04 - 10:06
    two--DNF has more features, that being
  • 10:06 - 10:10
    a main one. But whether you're using DNF
  • 10:10 - 10:13
    or Yum, you can do things like update,
  • 10:13 - 10:16
    which will update all the packages on your system. If you say "update" and
  • 10:16 - 10:19
    a package name, it will only update that
  • 10:19 - 10:21
    one package. I'll show you really quick
  • 10:21 - 10:24
    how to do the rollback, because since we use DNF, we could rollback.
  • 10:24 - 10:27
    So we're back here on the system where we just
  • 10:27 - 10:30
    installed team d. Actually, I don't even know what team d is, but we just
  • 10:30 - 10:33
    installed that. And now if we do DNF--now,
  • 10:33 - 10:38
    we don't have to be root to do this one--but we could say dnf history,
  • 10:38 - 10:43
    and it's going to show us the stuff that it did. Now, since it shows a full
  • 10:43 - 10:48
    history, you're going to see that before the video, I actually removed team d
  • 10:48 - 10:51
    so that all this would work. But this shows
  • 10:51 - 10:55
    a history of all the things that have been done with DNF on the system.
  • 10:55 - 10:59
    And since we see that this was done--the
  • 10:59 - 11:02
    install of team d was ID number three--
  • 11:02 - 11:05
    we can say (now this does require sudo
  • 11:05 - 11:08
    because it's going to make some system-wide changes), sudo
  • 11:08 - 11:15
    dnf history undo 3, that last thing. If we do that,
  • 11:15 - 11:18
    it's going to remove the packages and
  • 11:18 - 11:19
    the dependencies that we just installed.
  • 11:19 - 11:24
    Basically, it's going to just roll back exactly what we just did.
  • 11:24 - 11:27
    So I'm going to say yes, and now we don't have team d
  • 11:27 - 11:30
    installed anymore. So that's one of the
  • 11:30 - 11:33
    advantages of DNF over Yum. When it comes
  • 11:33 - 11:38
    to upgrading packages on your system, whether you're using Yum or DNF,
  • 11:38 - 11:40
    there are two very similar-sounding and kind
  • 11:40 - 11:44
    of confusing terms. You can either do
  • 11:44 - 11:48
    Yum or DNF update, and if you do that--if
  • 11:48 - 11:50
    you specify a package--it's just going to
  • 11:50 - 11:52
    update that one package. But if you do it
  • 11:52 - 11:54
    without any other, you know, things at the
  • 11:54 - 11:56
    end--just update and press enter--it's
  • 11:56 - 11:59
    going to update all of the packages on
  • 11:59 - 12:01
    your system, which is normally what you
  • 12:01 - 12:03
    want to do. Normally, you want to update
  • 12:03 - 12:05
    all the packages to get them up to date,
  • 12:05 - 12:06
    and you can see there's a whole bunch of
  • 12:06 - 12:10
    them. It actually shows you different kinds, like it's going to install a new
  • 12:10 - 12:12
    kernel because there's a new kernel, and then it will activate that, so I have
  • 12:12 - 12:18
    to restart. It's going to upgrade all these packages, and it's going to install
  • 12:18 - 12:23
    these dependencies down here because the new updated
  • 12:23 - 12:25
    packages require updated dependencies as well. So you can do
  • 12:25 - 12:27
    update, and that's pretty safe. The other
  • 12:27 - 12:30
    thing--the other option that you have--I'm going to say no here.
  • 12:30 - 12:32
    The other option you have--and again, whether using DNF or
  • 12:32 - 12:34
    Yum, so we'll use DNF this time just
  • 12:34 - 12:38
    because--you can say upgrade instead of
  • 12:38 - 12:44
    update. And the difference here is that it's going to allow the system to get
  • 12:44 - 12:47
    rid of obsolete packages. And these are
  • 12:47 - 12:50
    packages that are obsolete, no longer,
  • 12:50 - 12:54
    like, current. However, it's possible that
  • 12:54 - 12:56
    some of those packages are things you're still using.
  • 12:56 - 12:59
    So it's a little more dangerous to do upgrade. A lot of times,
  • 12:59 - 13:06
    if you have upgraded from, like, Red Hat 8 to Red Hat 9 on your system,
  • 13:06 - 13:08
    you can do upgrade and it will get rid
  • 13:08 - 13:10
    of obsolete packages and replace them with
  • 13:10 - 13:14
    updated ones. But just know that it could break stuff if you're actually using
  • 13:14 - 13:17
    those older packages. So upgrade is
  • 13:17 - 13:19
    generally not used as much as update on
  • 13:19 - 13:21
    a Red Hat system, but it will say upgrade
  • 13:21 - 13:25
    and it's going to do the exact same thing. In this case, it's the same packages.
  • 13:25 - 13:27
    There aren't any obsolete ones that it's, you know, worrying about
  • 13:27 - 13:29
    getting rid of because, again, we're not
  • 13:29 - 13:31
    changing anything drastic on our system.
  • 13:31 - 13:35
    And so it's going to do the exact same thing, but just know that upgrade has
  • 13:35 - 13:37
    the potential to break stuff easier than
  • 13:37 - 13:43
    update does. And I hate that it's, like, such similar words, but the thing is,
  • 13:43 - 13:46
    upgrade--think of it as, like, I upgraded
  • 13:46 - 13:48
    to a new version of the Linux system as
  • 13:48 - 13:51
    opposed to just updating my current packages. Maybe that'll help.
  • 13:51 - 13:55
    Anyway, we say "y". It's going to go download all of
  • 13:55 - 13:57
    the stuff. It's going to install it.
  • 13:57 - 13:59
    Again, in this case, it's a kernel package that
  • 13:59 - 14:03
    it's updating and going to recompile all the modules that it needs to, and
  • 14:03 - 14:07
    it will tell us that we need to reboot in order to, you know, complete and
  • 14:07 - 14:11
    activate it. And so if that's the kind of thing that it's a production system,
  • 14:11 - 14:13
    you may have to time when you can upgrade
  • 14:13 - 14:16
    it, if it's going to require a reboot.
  • 14:16 - 14:18
    Now, you probably remember that I said SUSE
  • 14:18 - 14:20
    Linux also uses RPM, and that's true.
  • 14:20 - 14:24
    The underlying packages are RPM on a SUSE
  • 14:24 - 14:31
    Linux box. However, it does not use Yum or DNF to manage the packages.
  • 14:31 - 14:35
    It uses something called Zypper. And so I'll show you that.
  • 14:35 - 14:40
    Again, the underlying stuff is still RPM files, and that's how it, you
  • 14:40 - 14:45
    know, maintains its packages. But the actual system to keep track of
  • 14:45 - 14:49
    dependencies and what's installed, and where all the repositories online
  • 14:49 - 14:54
    are and stuff, that uses the Zypper program, which is completely different
  • 14:54 - 14:56
    from Red Hat or Rocky Linux. So I'm here
  • 14:56 - 15:02
    on openSUSE, and this is, again, an RPM-based system, but it uses Zypper.
  • 15:02 - 15:05
    And Zypper has slightly different commands
  • 15:05 - 15:07
    in order to do things, rather than just
  • 15:07 - 15:13
    update and upgrade. There are update or just up. It allows you to use shortcuts.
  • 15:13 - 15:18
    There is dist-upgrade, which is very rarely used, and that's the same sort
  • 15:18 - 15:23
    of thing where it can remove packages for you even if you don't want it to.
  • 15:23 - 15:26
    So we don't normally do dist-upgrade,
  • 15:26 - 15:29
    but Zypper, or openSUSE, has another
  • 15:29 - 15:31
    option that Red Hat doesn't, and that's
  • 15:31 - 15:36
    called patch. And patch basically just installs the very important things, like
  • 15:36 - 15:38
    security updates and stuff, that, you know,
  • 15:38 - 15:42
    if there's a security release that has to be installed even on a production
  • 15:42 - 15:47
    system, you can do patch and it will install those without updating all of
  • 15:47 - 15:49
    the other packages that may have updates,
  • 15:49 - 15:55
    but they're not, like, super important. They're not security-related updates.
  • 15:55 - 15:58
    So patch is something that you can use more
  • 15:58 - 16:02
    often on a production system, knowing that it's just going to update the
  • 16:02 - 16:04
    things that are a security risk on your system.
  • 16:04 - 16:11
    It's kind of cool, actually. And it works similarly: sudo zypper is
  • 16:11 - 16:13
    the program instead of DNF or Yum.
  • 16:13 - 16:16
    It's Zypper, and then you can do things. And I
  • 16:16 - 16:19
    didn't show you this with Yum and DNF, but you can search for a package too.
  • 16:19 - 16:21
    So we'll do it here. It works the same on
  • 16:21 - 16:24
    the others. I mean, you can play with it and look at the man page.
  • 16:24 - 16:29
    But we can say search for Firefox, I guess. Oh, and this
  • 16:29 - 16:32
    is something. It says "sudo password for root," but it's my local password
  • 16:32 - 16:34
    that it wants. That's just some weird openSUSE thing.
  • 16:34 - 16:38
    And it looked in its repositories, and these are the things that it found.
  • 16:38 - 16:45
    So we could install, for example, Mozilla Firefox. We can install using
  • 16:45 - 16:52
    Zypper, and it's going--let's do it. sudo zypper install or you can just do in.
  • 16:52 - 16:55
    They're real big on shortcuts, but, I mean,
  • 16:55 - 16:58
    it's confusing enough having multiple ways to install packages on multiple
  • 16:58 - 17:05
    distros. So I'm just going to type the whole thing: install MozillaFirefox.
  • 17:05 - 17:09
    Now it did the exact same thing. It found any dependencies that it might
  • 17:09 - 17:13
    need, and it did find a dependency. It said it's going to install the following
  • 17:13 - 17:19
    two packages--this package and this package--in order to get the Mozilla
  • 17:19 - 17:20
    Firefox. And it looks like it's going to
  • 17:20 - 17:24
    upgrade it. It looks like it's already installed, which is fine. So, do I want to
  • 17:24 - 17:27
    do this? "Y" is the default, but I'm going
  • 17:27 - 17:32
    to say yes. It's going to download all of those things. It's going to install it.
  • 17:32 - 17:35
    And I shouldn't have said yes--I'll just fast-forward.
  • 17:35 - 17:37
    I won't make you wait. But, oh, really quickly--look.
  • 17:37 - 17:42
    See, it's downloading RPM files. So it is using an RPM system underneath.
  • 17:42 - 17:44
    So I'm glad I hit enter so I could show you that.
  • 17:44 - 17:46
    So okay. That's installed. We could do
  • 17:46 - 17:50
    the same thing with, you know, update or dist-upgrade.
  • 17:50 - 17:56
    But the one thing that's kind of unique here: sudo zypper patch.
  • 17:56 - 18:00
    What this will do is--there's nothing to do.
  • 18:00 - 18:03
    There are no security issues currently on the
  • 18:03 - 18:06
    system that a patch would do.
  • 18:06 - 18:09
    So we can--even if, you know, there are upgrades
  • 18:09 - 18:11
    available or updates available for our
  • 18:11 - 18:13
    packages--we don't have to necessarily
  • 18:13 - 18:16
    install them on a production system because there are no security ones
  • 18:16 - 18:19
    currently available. Hopefully, that makes sense.
  • 18:19 - 18:25
    That's, again, a big deal. But we could do sudo zypper
  • 18:25 - 18:30
    update, and this will update all the packages that are available to update.
  • 18:30 - 18:35
    And you can see, if we hit "yes" here, it's going to get 232 packages to
  • 18:35 - 18:38
    upgrade, three of them new. One of them is going to change its architecture,
  • 18:38 - 18:41
    interestingly enough. But notice here it says openSUSE Tumbleweed
  • 18:41 - 18:47
    requires zypper dup. dup--again, they're all about
  • 18:47 - 18:53
    shortcuts--is short for dist-upgrade. And that's because Tumbleweed--
  • 18:53 - 18:56
    I'm getting in the weeds here with SUSE--but in the weeds.
  • 18:56 - 19:00
    I didn't even mean that. It's a rolling distribution, and
  • 19:00 - 19:05
    so that means that basically, upgrade will be more common
  • 19:05 - 19:11
    because it doesn't, like, have releases. It just is a rolling release. So to fully
  • 19:11 - 19:16
    upgrade Tumbleweed, we will do dist-upgrade or just dup, its shortcut.
  • 19:16 - 19:20
    So I'm going to say "no" just so I can show you that, and then we'll be done.
  • 19:20 - 19:25
    sudo zypper--I could do dup, but again, I don't like that.
  • 19:25 - 19:31
    dist-upgrade, and this is going to go through and now install--again,
  • 19:31 - 19:33
    it's installing the same packages. It's just
  • 19:33 - 19:36
    telling you, like, hey, when you have Tumbleweed, the rolling distribution,
  • 19:36 - 19:39
    you should use dist-upgrade. So, you know, do it that way, you will.
  • 19:39 - 19:42
    Usually, we don't use that in a production server
  • 19:42 - 19:46
    environment anyway, but nonetheless, that's the difference between the two.
  • 19:46 - 19:50
    We can press enter and it's going to upgrade all of the things. But it does
  • 19:50 - 19:53
    tell us that a system reboot is going to be required because it's installing a
  • 19:53 - 19:56
    new kernel, which is awesome information for it to tell us in advance.
  • 19:56 - 20:00
    And that leaves us with the system that I actually prefer and use the most:
  • 20:00 - 20:06
    a Debian-based system or .deb files using APT. And APT is the package
  • 20:06 - 20:12
    management system for .deb files. APT is used in Ubuntu and Debian.
  • 20:12 - 20:15
    There are some others, like apt-get, which is kind of a
  • 20:15 - 20:17
    package management system that uses the
  • 20:17 - 20:19
    APT database. And just like you can use
  • 20:19 - 20:22
    Yum and DNF at the same time, you can use
  • 20:22 - 20:24
    APT and apt-get, and it just writes to
  • 20:24 - 20:27
    the same database. So you can use either one.
  • 20:27 - 20:32
    APT alone--APT--is the most recent one, and it's the one mentioned in the objective.
  • 20:32 - 20:35
    So that's what I'm going to show you. That's what I use. And there are
  • 20:35 - 20:40
    a couple of nuances with deb-based systems versus RPM-based systems.
  • 20:40 - 20:43
    And the biggest difference--and this really is a big
  • 20:43 - 20:47
    difference--is that with Yum and DNF and
  • 20:47 - 20:52
    Zypper, when you search for a package or install a package, before it does
  • 20:52 - 20:58
    anything, those systems will go and refresh everything on the web.
  • 20:58 - 21:02
    Like, they will get an update of all of the available packages and versions.
  • 21:02 - 21:07
    But with an APT-based system, that's an extra step. You actually have
  • 21:07 - 21:14
    to refresh the "what is available" database, and to do that: sudo apt update.
  • 21:14 - 21:18
    So in this case, update means "I want to
  • 21:18 - 21:21
    update my cached information of packages
  • 21:21 - 21:24
    that are available and what versions are
  • 21:24 - 21:26
    on my repositories on the internet."
  • 21:26 - 21:28
    So it means something drastically different.
  • 21:28 - 21:32
    But it's important to do this first because if you don't update, then you
  • 21:32 - 21:34
    have old information. You don't know what
  • 21:34 - 21:39
    packages are available. So sudo apt update--oh, come on. There. Finally.
  • 21:39 - 21:44
    And it will refresh its cache of what stuff is available.
  • 21:44 - 21:46
    This goes pretty quick. As you can see, it's
  • 21:46 - 21:52
    already done, and now we can use APT to upgrade or dist-upgrade.
  • 21:52 - 21:55
    And this is similar in that, like, the different
  • 21:55 - 21:58
    degrees of upgrade--because upgrade is
  • 21:58 - 22:03
    going to do all the packages that have updates, but it's not going to allow it
  • 22:03 - 22:09
    to remove packages and, like, do big changes. This is the same sort of thing.
  • 22:09 - 22:12
    Generally, dist-upgrade in an APT system
  • 22:12 - 22:16
    is a little more dangerous--and "dangerous" isn't really a good word, but it's
  • 22:16 - 22:19
    more apt (and that's too punny for me to say).
  • 22:19 - 22:24
    It's possible that if you do dist-upgrade, it might break packages on your
  • 22:24 - 22:31
    system. But if you're going from one version to another, dist-upgrade
  • 22:31 - 22:37
    will bring all of your packages up to the current distribution numbers,
  • 22:37 - 22:42
    version by removing old stuff and installing the new versions of them if
  • 22:42 - 22:43
    they exist, that sort of thing.
  • 22:43 - 22:48
    So generally, you just do upgrade, but dist-upgrade is available
  • 22:48 - 22:50
    if you have, like, a drastic change that you've done.
  • 22:50 - 22:55
    And so we can simply do sudo apt upgrade.
  • 22:55 - 23:02
    Oh--when we used the dpkg to install curl, it screwed up the database.
  • 23:02 - 23:04
    Do you remember earlier when I tried to do it manually?
  • 23:04 - 23:09
    It actually screwed it up. And so what we can do--we could say
  • 23:09 - 23:14
    sudo apt -f install, and it will fix what I broke.
  • 23:14 - 23:18
    In fact, in this case, it's going to install curl properly by
  • 23:18 - 23:23
    getting its dependencies. So I'm going to say "yes," and that's a really
  • 23:23 - 23:26
    nice feature--that it will clean up my mess because I tried to do it manually.
  • 23:26 - 23:30
    Even though I would never do that in real life, I was showing you kind of the
  • 23:30 - 23:31
    old way that we had to do it. Anyway, so
  • 23:31 - 23:36
    it's fixed that, and now I can actually run upgrade, and it'll say, okay, there
  • 23:36 - 23:42
    are 75 upgrades, five new installs, three are not upgraded, 30 are standard
  • 23:42 - 23:49
    security updates. And so, this is how you can keep your system up to date.
  • 23:49 - 23:52
    It says that these have been held back. If we
  • 23:52 - 23:57
    were to do dist-upgrade, these would also be upgraded. But, again, it has
  • 23:57 - 24:01
    the potential to break your system, maybe.
  • 24:01 - 24:05
    Yeah. It's kind of a frustrating thing. Generally, you can avoid dist-upgrade
  • 24:05 - 24:07
    and just do upgrade and you'll be fine.
  • 24:07 - 24:10
    So that's pretty much what we would do here. I just press enter--it's
  • 24:10 - 24:11
    going to go and upgrade all the stuff.
  • 24:11 - 24:13
    So depending on your system, you have lots
  • 24:13 - 24:15
    of options for package management.
  • 24:15 - 24:20
    The big thing to remember is: on a Debian-based system, so using APT,
  • 24:20 - 24:23
    you have to do apt update and then apt upgrade.
  • 24:23 - 24:27
    In fact, you have to do apt update before you do, like, an apt install.
  • 24:27 - 24:33
    So, like, if we were to do apt install firefox, we'd have to do apt update first.
  • 24:33 - 24:37
    Otherwise, it's going to try to pull an old version that doesn't exist anymore.
  • 24:37 - 24:40
    So you always need to do apt update before you make any
  • 24:40 - 24:43
    changes to your system. It's funny that
  • 24:43 - 24:46
    Yum and DNF and Zypper all do that step
  • 24:46 - 24:49
    automatically, and APT just doesn't--but that's how it is.
  • 24:49 - 24:52
    With great power comes great responsibility, and this is one of
  • 24:52 - 24:55
    those examples. Anyway, I hope that was helpful.
  • 24:55 - 24:58
    I encourage you to play with the different tools to see what they can do,
  • 24:58 - 25:02
    and the different options, and how they work differently. Install a couple of
  • 25:02 - 25:06
    system distributions in a virtualized environment--so if you break it,
  • 25:06 - 25:10
    you know, so what? And just have fun. But as always, learn everything,
  • 25:10 - 25:14
    do what you love, and most importantly, be kind.
  • 25:14 - 25:16
    I'll see you in the next video.
Title:
Linux Package Managers (Linux+ Objective 1.6.1)
Description:

more » « less
Video Language:
English
Duration:
25:16

English subtitles

Revisions Compare revisions