sjvn01

Old-School Linux Software Updating Techniques

by sjvn01 ‎05-06-2012 09:40 AM - edited ‎05-06-2012 09:40 AM

When I patch one of my Linux systems or add new software, 99 times out of 100 I use a modern program like the Ubuntu's Software Center or Linux Mint's Software Manager. But there are times, especially when I'm working with a system that needs automated updates using cron or with a remote system via ssh or telnet, that I need to use a good, old-fashioned command line tool—and you will too. So, for times like those, it helps to keep the shell commands in mind.

Software Manager.png

Software Manager: Software management programs like Mint's Software Manager look great, but they're not too practical on servers, local or remote, or if you want to put update commands in your cron file.

Most Linux distributions have similar tools... but there are key differences.

Debian/Ubuntu Linux family

The Advanced Packaging Tool (apt) is the fundamental software installation and patch tool for the Debian/Ubuntu Linux family. It works above dpkg, this family's main program package management program. It’s built into most Linux installations.

Typically, you won't use apt by itself. Instead, you use the apt-get utility for day-to-day work. As its name suggests, this command lets you “get” patches and new programs.

aptitude.png

Aptitude: On Debian and Ubuntu-based systems you don't need a GUI for a menu-based software management and update program, thanks to the aptitude program.

Some popular uses for the apt-get utility include:

Install a Package: Installation of packages using the apt-get tool is quite simple. For example, to install my favorite e-mail program, Evolution, I'd type the following into my shell:

sudo apt-get install evolution

Remove a Package: If I no longer want that program, say I want to turn a former desktop system into a server, I'd remove Evolution by typing in the following:

sudo apt-get remove evolution

Let's say I know I'm never going to run evolution on that system again. In that case I'd add the --purge options to the apt-get remove command to delete the package configuration files as well.

Update the Package Index: Programs are constantly being updated in Linux. To keep your system up to date, you first should update the apt package index, a listing of available packages from the software repositories you've defined in the /etc/apt/sources.list file. To update this local package index with the latest repositories changes, use the following command:

sudo apt-get update

Upgrade Packages: Then to update your system's installed software, you run the following program. Everything in your systems will be updated with the following command:

sudo apt-get upgrade

Notice that in all the above examples you need to use the sudo command. This command is most commonly used to give trusted ordinary users the power to run a single command as if they were the “superuser,” a.k.a. the root user or system administrator.

By default, Ubuntu and its descendants, like Mint, don't have a root account. Debian, however, does. Thus, to run any top level management jobs in Ubuntu you must use sudo. You could run apt-get in Debian-based distributions as root, but it's never a great idea to run common jobs as root since the system administrator has so much power in Linux (and in other operating systems too, of course).

Let's say though that you want a more interactive way to update your Debian or Ubuntu based system, but you still don't have access to a GUI. In that case what you want to use is aptitude. This program uses the ncurses programming library to create a character-user interface for terminals.

Personally, I almost never use aptitude these days, but there are still times that having an easy-to-use package management interface is darn handy so I always keep it on my Debian-based systems.

Red Hat Family

Like the Debian family, Red Hat Enterprise Linux (RHEL) and its relatives, such as Fedora, CentOS, and Scientific Linux, have a command line option for updates. While older versions of the RHEL family used up2date, the current program is the rather oddly named yum.

yum.jpg

Yum: Red Hat's answer to apt-update makes installing programs from the shell easy.

Yum, which comes from Duke University, is an acronym for Yellowdog Updater Modified. Yellow Dog was, and still is, a Red Hat Linux-based variant for POWER-based computers. Today, yum, along with Red Hat's RPM Package Manager (RPM) (Yes, it's a recursive acronym; welcome to Linux!), is the equivalent of apt-get.

In Red Hat's case, RPM refers both to the package format and to the software used to manage it at a low level. Like dkpg you can use it by itself to update and install programs but that's not a great idea. You see, RPM installs just the program you ask for; it doesn't bother with such details, such as as any libraries your program of choice might need. That's why yum plays the role of apt-get in Red Hat circles.

One difference is that typically in Red Hat you run all the rpm and yum commands as root.

Install a Package: Installation of packages using the yum is also quite simple. For Evolution, I'd use the following shell command:

yum install evolution

Remove a Package: To delete Evolution you'd type:

yum remove evolution

Upgrade Packages: Again, like apt-get, you can easily update your system's installed software with a single command: 

yum update

SUSE Family

SUSE Linux, and its relatives like openSUSE, also use RPM, but instead of yum, these Linux distributions use the command zypper. Over the years, SUSE has experimented with many software update tools, so I'm glad they finally settled on this one.

Zypper's basic syntax should look very familiar by now.

Install a Package: Picking on Evolution once more, in SUSE land, the command is:

zypper install evolution

Remove a Package: To delete Evolution you'd use the following command:

zypper remove evolution

Upgrade Packages: And, again it's easy to update your system's installed software:

zypper update

Updates from 20,000 feet

Don't let these surface resemblances fool you. Once you go beyond the basics, each distribution’s command line software management programs act in very different ways. So, before jumping from one distribution to another, never mind from one Linux family to another, always check how your distribution's specific commands work.

If you don't... Well the least that can happen is that the commands won't work. At worst, there's no telling what kind of junk you could put on your system.

See also:

Comments
by Caitlyn Martin(anon) on ‎06-06-2012 07:29 AM

For the most part this is a good Package Management 101 tutorial.   I do have a few quibbles:
<blockquote>By default, Ubuntu and its descendants, like Mint, don't have a root account.</blockquote>
This is simply untrue.  Remote login and graphical login as root is disabled but the root account is there and can be accessed using su.

<blockquote>]One difference is that typically in Red Hat you run all the rpm and yum commands as root.</quote>
When you use sudo, as in your Debian/Ubuntu example, you are running as root.  sudo is the preferred method for doing that with Red Hat as well since you don't have to hand out the root password to all the admins of a given box.  Also...

by asdf(anon) on ‎06-06-2012 11:02 AM

i wouldn't call that old school.  i'd call that now school.

 

old school is this:

./configure

.make

make install

 

by execat(anon) on ‎06-06-2012 11:29 AM

Yet another time Archlinux and Gentoo get ignored.

by WorBlux(anon) on ‎06-06-2012 08:51 PM

Gentoo

 

install

emerge evolution

 

remove

emerge -C evolution

 

update

emerge --sync

emerge -avDNu world

dispatch-conf

revdep-rebuild

emerge --depclean

by abarbarian(anon) on ‎07-06-2012 07:15 AM

https://wiki.archlinux.org/index.php/Pacman_Rosettahttp://

"This page pulls heavily from openSUSE's Software Management Command Line Comparison. It has been simplified and has added Arch to the comparison, as well as modified the order in which each distribution exists for the benefit of Arch users."

Just about every package management  command for almost every GNU/Linux os.

Post a Comment
Be sure to enter a unique name. You can't reuse a name that's already in use.
Be sure to enter a unique email address. You can't reuse an email address that's already in use.
Type the characters you see in the picture above.Type the words you hear.

The HP Input Output site is sponsored by HP and features articles and content from HP and third-party contributors. Third-party articles and content, while paid for by HP, do not necessarily represent the views and opinions of HP. HP does not endorse this content and is not responsible for its accuracy, availability and quality.

Follow Us
Spotlight
"It's Not My Job" - Handling the Vendor Finger-Pointing Trap Is Teamwork Dead? A Post-Agile Prognosis Improving Your Personal Brand with Social Networking 5 Types of Meetings Every Business Must Explore
┼ Based on energy, paper and toner savings from regular printer usage. Results may vary.