yum command examples install update

The yum command, also known as Yellowdog Updater Modified, is a widely used package management utility for Red Hat, CentOS, and other Linux-based operating systems. It allows users to install, remove, update, and manage software packages, dependencies, and repositories. In this article, we will explore some common yum command examples for installing and updating software packages.

Installing Packages with Yum:

To install packages in Linux using yum, you will require root-level access to your system.

Basic syntax: yum install [package_name]

For Example:

$ sudo yum install firefox

The above command will install the Firefox web browser on your system.

You can also install multiple packages at once by separating them with spaces. For example:

$ sudo yum install firefox thunderbird

In addition, yum resolves dependencies automatically.

Updating Packages with Yum:

After installing the packages, it's essential to update them regularly to keep up with the latest features and security updates. You can update the packages you installed previously via yum.

Basic syntax: yum update [package_name]

For Example:

$ sudo yum update firefox

The above command will update the Firefox web browser to the latest version.

You can also update all installed packages by running:

$ sudo yum update

Updating the Dependencies:

Apart from updating software packages, it's also essential to update package dependencies that are not included in most update processes. Therefore, it's crucial to update the repositories to avoid dependency issues or other conflicts.

Basic syntax: yum update

For Example:

$ sudo yum update

The above command updates the system packages, including the dependencies.

Adding a Repository with Yum:

You may need to add a third-party repository to your system to install some software packages that are not supported by the default system repository.

Basic syntax: yum-config-manager –add-repo="Repository_URL"

For Example:

$ sudo yum-config-manager –add-repo="http://example.com/repo/example.repo"

The above command adds the repository to the system, and you can then install packages from this repository via yum.

Listing Installed Packages:

You can list all installed packages on your system using yum.

Basic syntax: yum list installed

For Example:

$ sudo yum list installed

The above command lists all installed packages on the system.

Removing Packages with Yum:

If you no longer need a package installed on your system, you can remove it using YUM.

Basic syntax: sudo yum remove [package_name]

For Example:

$ sudo yum remove firefox

The above command removes the Firefox web browser from the system.

Conclusion:

The yum command is a useful tool for managing software packages, dependencies, and repositories in Linux-based operating systems. This article illustrated some common yum command examples for installing, updating, removing, and managing packages on your Linux system. With this knowledge, you can take advantage of the yum command in your day-to-day system administration duties.

In addition to the previous examples, the yum command also has a few more commands that can assist you in managing your system.

Installing Packages from a Specific Repository:

If you want to install a package from a specific repository instead of the default system repository, you can do so by specifying the repository name with the yum command.

Basic syntax: sudo yum –enablerepo=[repository_name] install [package_name]

For Example:

$ sudo yum –enablerepo=epel install htop

The above command installs the htop package from the EPEL repository.

Removing Packages with Dependencies:

When you remove a package, yum automatically removes its dependencies unless required by other packages. However, sometimes, you may need to remove a package without removing its dependencies.

Basic syntax: sudo yum remove [package_name] –noautoremove

For Example:

$ sudo yum remove firefox –noautoremove

The above command removes the Firefox web browser without removing its dependencies.

Cleaning Up Yum Cache:

The yum command cache stores information about installed and available packages, which can take up disk space over time. To clean up the Yum cache, you can use the following command.

Basic syntax: sudo yum clean all

For Example:

$ sudo yum clean all

The above command removes all cached packages from the system.

Displaying Package Information:

You can retrieve information about a package, such as its version, description, dependencies, and size, using the yum info command.

Basic syntax: sudo yum info [package_name]

For Example:

$ sudo yum info firefox

The above command displays information about the Firefox web browser.

Conclusion:

The yum command is a powerful and flexible package management utility that allows you to install, update, remove, and manage software packages, dependencies, and repositories in Linux-based operating systems. With its vast feature set and easy-to-use syntax, you can manage your system with ease. You can also automate yum commands using shell scripts, cron jobs, or tools like Ansible, Puppet, or Chef, to streamline your system's management and maintenance.

Popular questions

  1. What is Yum, and what is its purpose?
    Yum is a package management utility used in Red Hat, CentOS, and other Linux-based operating systems. It allows you to install, remove, update, and manage software packages, dependencies, and repositories.

  2. How do you install a package using yum?
    You can install a package using yum by running the command: sudo yum install [package_name]. For example, "sudo yum install firefox" will install the Firefox web browser.

  3. How do you update all installed packages using yum?
    You can update all installed packages using yum by running the command: sudo yum update. This command will update all packages on your system, including the dependencies.

  4. How do you remove a package using yum?
    You can remove a package using yum by running the command: sudo yum remove [package_name]. For example, "sudo yum remove firefox" will remove the Firefox web browser from your system.

  5. How do you add a third-party repository using yum?
    You can add a third-party repository using yum by running the command: sudo yum-config-manager –add-repo=[Repository_URL]. For example, "sudo yum-config-manager –add-repo=http://example.com/repo/example.repo" will add the example repository to your system.

Tag

yum usage

I am a driven and diligent DevOps Engineer with demonstrated proficiency in automation and deployment tools, including Jenkins, Docker, Kubernetes, and Ansible. With over 2 years of experience in DevOps and Platform engineering, I specialize in Cloud computing and building infrastructures for Big-Data/Data-Analytics solutions and Cloud Migrations. I am eager to utilize my technical expertise and interpersonal skills in a demanding role and work environment. Additionally, I firmly believe that knowledge is an endless pursuit.

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top