Linux+: Applications 05 – Yum Install, Update and Remove

J

Jarret W. Buse

Guest
Linux+: Applications 05 – Yum Install, Update and Remove

The main uses of “yum” is to install, update or remove packages. With most Operating Systems (OS), installing and removing programs is done more often than other procedures using “yum”. Updating applications is also a highly performed procedure.

NOTE: A Linux package is a compressed archive of files and data. The files are those needed for a specific program. The data contains the information needed to properly install the files and lists the required dependencies. Dependencies are the files needed for a program to run which are contained within other packages.

The main point to keep in mind is that to install, update or remove a package, you need to have root privileges.

Installation of files is somewhat simple and has the following syntax:

yum install [package-name]

Once you know the package name, enter the package name and be sure the spelling is correct. Be aware that the package name is case-sensitive.

NOTE: Package name can be found by performing a “yum” query (Linux+: Applications 05 – Yum Query).

If multiple packages have similar names, then an asterisk (*) can be used to stand for extra characters of varying types. For example, if there were three packages with the names of “program1”, “program1-dependancies” and “program1-libraries”, the “install” subcommand could be “yum install program1*”. The command should install all three packages, but if other packages start with “program1” they would be installed as well.

When performing the “install” subcommand, all dependancies will also be included during the download and install process.

There may be cases when multiple packages need to be installed with such varying names that an asterisk would not work. To accomplish this, the “install” syntax would be:

yum install [package-1] [package-2] …

The list of package names can be numerous as long as they are separated by a space. Each package name should not include any spaces.

When an application is installed and a newer version becomes available, the package can be updated.

The basic syntax to update a package with “yum” is:

yum update [package-name]

NOTE: Keep in mind that any dependencies which need an update will also be updated as well as the main package.

If multiple packages need to be updated at once, then multiple packages are listed:

yum update [package-1] [package-2] …

The list of package names can be numerous as long as they are separated by a space. Each package name should not include any spaces.

All packages on the system can be updated at once by performing an update without a package name as follows:

yum update

The last main subcommand is “remove”. When a package and its dependencies needs to be erased, the two possible syntax uses are:

yum remove [package-name]
yum erase [package-name]


As stated with the install and update subcommand, multiple packages can be removed by separating each package name with a space.

There are other subcommands in the category of updating, removing and installing. These commands are:

  • localinstall
  • reinstall
  • groupinstall
  • update-to
  • upgrade
  • downgrade
  • swap
  • autoremove

The “localinstall” subcommand is used to install a package which is located locally on the system. The syntax is:

yum localinstall [package-path/]package-name]

The path is specified to the location of the file. If the file is not local, but is on the Internet, the URL path can be used. For example, “yum localinstall http://servername.com/package1.rpm” could be used to download and install “package1.rpm”.

If a package seems to not work correctly, reinstalling the program can sometimes help (this includes the dependancies as well). The command is:

yum reinstall [package-name]

Many packages are grouped together as related packages. Instead of installing multiple single packages, you can install the whole group. For instance, a group called “Backup Client” contains all the packages necessary for a client system to perform backups. To install the group, use the syntax:

yum groupinstall [group-name]

The “update-to” subcommand is used to install a specific version of a package. The specified version does not have to be the latest released version. For example, if I listed the available “apper” versions with the command “sudo yum list apper” I may get the following versions:

  • 0.8.2-1.fc20
  • 0.8.2-3.fc20

If for some reason, such as program errors (only an example and not a true case) existed in the newer version and I wanted to install the older one, I would use the command:

yum update-to apper 0.8.2-1.fc20

The “upgrade” command is used the same as “update”, but the “upgrade” subcommand will remove obsolete packages. If any dependancy is considered obsolete, the “upgrade” subcommand will remove them. Sometimes, this may cause problems except when upgrading between major versions.

The “downgrade” subcommand is used to downgrade a package to an earlier version. For example, if “package-1” version 4 is installed and has bugs then it could be downgraded to version 3 by the syntax:

yum downgrade [package-name]

The “downgrade” does not manage the dependancies and you will need to downgrade the dependancies as well. When a downgrade is performed, a list of dependancies will be listed which you will have to note and downgrade them as well.

Sometimes you may need to remove one package and install another. For instance, you may have installed “package-1” and found that it did not have all the functions you required. After looking on the Internet, you find “package-2” has everything you need, you now need to “swap” the two packages. The “swap” subcommand will perform this action with the syntax:

yum swap [package-to-remove] [package-to-install]

So in the previous example, the command would be “yum swap package-1 package-2”.

The final subcommand is “autoremove” which removes the specified package and all unneeded dependancies on the system. The syntax is:

yum autoremove [package-name]

Keep in mind that any dependancies not being used by any package will be removed by the command.

These are the main basics of installing, updating and removing packages on a Red Hat system.
 

Attachments

  • slide.jpg
    slide.jpg
    32.9 KB · Views: 250,574



Members online


Top