35
Installing Software using RPM and YUM in RPM and YUM in RedHat Enterprise, Fedora, Suse and Centos Heng Sovannarith [email protected]

Installing Software using RPM and YUM - Heng Sovannarith · PDF fileInstalling Software using RPM and YUM in RPM and YUM in RedHat Enterprise, Fedora, Suse and Centos Heng Sovannarith

  • Upload
    buidan

  • View
    237

  • Download
    2

Embed Size (px)

Citation preview

Page 1: Installing Software using RPM and YUM - Heng Sovannarith · PDF fileInstalling Software using RPM and YUM in RPM and YUM in RedHat Enterprise, Fedora, Suse and Centos Heng Sovannarith

Installing Software using RPM and YUM in RPM and YUM in RedHat

Enterprise, Fedora, Suse and Centos

Heng Sovannarith

[email protected]

Page 2: Installing Software using RPM and YUM - Heng Sovannarith · PDF fileInstalling Software using RPM and YUM in RPM and YUM in RedHat Enterprise, Fedora, Suse and Centos Heng Sovannarith

Introduction

• We can install the software in CentOS in 5 ways.

– Using YUM with Internet Connection

– Using YUM with DVD repository (No Internet Connection)

– Using RPM

– Using GUI

– Using tar.gz file

Page 3: Installing Software using RPM and YUM - Heng Sovannarith · PDF fileInstalling Software using RPM and YUM in RPM and YUM in RedHat Enterprise, Fedora, Suse and Centos Heng Sovannarith

YUM

• YUM (Yellowdog Updater Modified) is an open source command-line as well as graphical based package management tool for RPM (RedHat Package Manager) based Linux systems.

• It allows users and system administrator to easily install, update, remove or search software packages on a systems.

• YUM uses numerous third party repositories to install packages automatically by resolving their dependencies issues.

Page 4: Installing Software using RPM and YUM - Heng Sovannarith · PDF fileInstalling Software using RPM and YUM in RPM and YUM in RedHat Enterprise, Fedora, Suse and Centos Heng Sovannarith

YUM (cont.)

• Install a Package with YUM

– To install a package called Firefox 14, just run the below command it will automatically find and install all required dependencies for Firefox.

Page 5: Installing Software using RPM and YUM - Heng Sovannarith · PDF fileInstalling Software using RPM and YUM in RPM and YUM in RedHat Enterprise, Fedora, Suse and Centos Heng Sovannarith

YUM (cont.)

Page 6: Installing Software using RPM and YUM - Heng Sovannarith · PDF fileInstalling Software using RPM and YUM in RPM and YUM in RedHat Enterprise, Fedora, Suse and Centos Heng Sovannarith

YUM (cont.)

• Removing a Package with YUM – To remove a package completely with their all

dependencies, just run the following command as shown below.

– Same way the above command will ask confirmation before removing a package. To disable confirmation prompt just add option -y as shown in below.

Page 7: Installing Software using RPM and YUM - Heng Sovannarith · PDF fileInstalling Software using RPM and YUM in RPM and YUM in RedHat Enterprise, Fedora, Suse and Centos Heng Sovannarith

YUM (cont.)

• Updating a Package using YUM – Let’s say you have outdated version of MySQL package and

you want to update it to the latest stable version. Just run the following command it will automatically resolves all dependencies issues and install them.

Page 8: Installing Software using RPM and YUM - Heng Sovannarith · PDF fileInstalling Software using RPM and YUM in RPM and YUM in RedHat Enterprise, Fedora, Suse and Centos Heng Sovannarith

YUM (cont.)

• List a Package using YUM

– Use the list function to search for the specific package with name. For example to search for a package called openssh, use the command.

Page 9: Installing Software using RPM and YUM - Heng Sovannarith · PDF fileInstalling Software using RPM and YUM in RPM and YUM in RedHat Enterprise, Fedora, Suse and Centos Heng Sovannarith

YUM (cont.)

• Search for a Package using YUM – If you don’t remember the exact name of the package,

then use search function to search all the available packages to match the name of the package you specified.

– For example, to search all the packages that matches the word .

Page 10: Installing Software using RPM and YUM - Heng Sovannarith · PDF fileInstalling Software using RPM and YUM in RPM and YUM in RedHat Enterprise, Fedora, Suse and Centos Heng Sovannarith

YUM (cont.)

• Get Information of a Package using YUM

– Say you would like to know information of a package before installing it. To get information of a package just issue the below command.

Page 11: Installing Software using RPM and YUM - Heng Sovannarith · PDF fileInstalling Software using RPM and YUM in RPM and YUM in RedHat Enterprise, Fedora, Suse and Centos Heng Sovannarith

YUM (cont.)

• List all Available Packages using YUM

– To list all the available packages in the Yum database, use the below command.

• List all Installed Packages using YUM

– To list all the installed packages on a system, just issue below command, it will display all the installed packages.

Page 12: Installing Software using RPM and YUM - Heng Sovannarith · PDF fileInstalling Software using RPM and YUM in RPM and YUM in RedHat Enterprise, Fedora, Suse and Centos Heng Sovannarith

YUM (cont.)

• Yum Provides Function – Yum provides function is used to find which package a specific file

belongs to. For example, if you would like to know the name of the package that has the/etc/httpd/conf/httpd.conf.

Page 13: Installing Software using RPM and YUM - Heng Sovannarith · PDF fileInstalling Software using RPM and YUM in RPM and YUM in RedHat Enterprise, Fedora, Suse and Centos Heng Sovannarith

YUM (cont.)

• Check for Available Updates using Yum

– To find how many of installed packages on your system have updates available, to check use the following command.

– To keep your system up-to-date with all security and binary package updates, run the following command. It will install all latest patches and security updates to your system.

Page 14: Installing Software using RPM and YUM - Heng Sovannarith · PDF fileInstalling Software using RPM and YUM in RPM and YUM in RedHat Enterprise, Fedora, Suse and Centos Heng Sovannarith

YUM (cont.)

• List all available Group Packages – In Linux, number of packages are bundled to particular group. Instead

of installing individual packages with yum, you can install particular group that will install all the related packages that belongs to the group. For example to list all the available groups, just issue following command.

Page 15: Installing Software using RPM and YUM - Heng Sovannarith · PDF fileInstalling Software using RPM and YUM in RPM and YUM in RedHat Enterprise, Fedora, Suse and Centos Heng Sovannarith

YUM (cont.)

• Install a Group Packages

– To install a particular package group, we use option as groupinstall. Fore example, to install “MySQL Database“, just execute the below command.

Page 16: Installing Software using RPM and YUM - Heng Sovannarith · PDF fileInstalling Software using RPM and YUM in RPM and YUM in RedHat Enterprise, Fedora, Suse and Centos Heng Sovannarith

YUM (cont.)

• Update a Group Packages

– To update any existing installed group packages, just run the following command as shown below.

Page 17: Installing Software using RPM and YUM - Heng Sovannarith · PDF fileInstalling Software using RPM and YUM in RPM and YUM in RedHat Enterprise, Fedora, Suse and Centos Heng Sovannarith

YUM (cont.)

• Remove a Group Packages

– To delete or remove any existing installed group from the system, just use below command.

Page 18: Installing Software using RPM and YUM - Heng Sovannarith · PDF fileInstalling Software using RPM and YUM in RPM and YUM in RedHat Enterprise, Fedora, Suse and Centos Heng Sovannarith

YUM (cont.)

• List Enabled Yum Repositories

– To list all enabled Yum repositories in your system, use following option.

Page 19: Installing Software using RPM and YUM - Heng Sovannarith · PDF fileInstalling Software using RPM and YUM in RPM and YUM in RedHat Enterprise, Fedora, Suse and Centos Heng Sovannarith

YUM (cont.)

• Install a Package from Specific Repository

– To install a particular package from a specific enabled or disabled repository, you must use –enablerepo option in your yum command. For example to Install PhpMyAdmin 3.5.2 package, just execute the command.

Page 20: Installing Software using RPM and YUM - Heng Sovannarith · PDF fileInstalling Software using RPM and YUM in RPM and YUM in RedHat Enterprise, Fedora, Suse and Centos Heng Sovannarith

YUM (cont.)

• Interactive Yum Shell

– Yum utility provides a custom shell where you can execute multiple commands.

Page 21: Installing Software using RPM and YUM - Heng Sovannarith · PDF fileInstalling Software using RPM and YUM in RPM and YUM in RedHat Enterprise, Fedora, Suse and Centos Heng Sovannarith

YUM (cont.)

• Clean Yum Cache – By default yum keeps all the repository enabled package

data in /var/cache/yum/ with each sub-directory, to clean all cached files from enabled repository, you need to run the following command regularly to clean up all the cache and make sure that there is nothing unnecessary space is using. We don’t want to give the output of the below command, because we like to keep cached data as it is.

Page 22: Installing Software using RPM and YUM - Heng Sovannarith · PDF fileInstalling Software using RPM and YUM in RPM and YUM in RedHat Enterprise, Fedora, Suse and Centos Heng Sovannarith

YUM (cont.)

• View History of Yum

– To view all the past transactions of yum command, just use the following command.

Page 23: Installing Software using RPM and YUM - Heng Sovannarith · PDF fileInstalling Software using RPM and YUM in RPM and YUM in RedHat Enterprise, Fedora, Suse and Centos Heng Sovannarith

YUM without Internet

• yum is setup to work off of Internet "repositories" on the Internet. Files containing these locations are listed in

/etc/yum.repos.d/*.repo

• You can add your own *.repo file directories in the same format and import gpg keys using the rpm –import command to insure integrity of the site. Internet is usually required for how to configure the latest repositories. Remember just as in Windows, make sure you can trust the .rpm source site.

Page 24: Installing Software using RPM and YUM - Heng Sovannarith · PDF fileInstalling Software using RPM and YUM in RPM and YUM in RedHat Enterprise, Fedora, Suse and Centos Heng Sovannarith

YUM without Internet

• Create a new myrep.repo file

• Enter the following lines:

Page 25: Installing Software using RPM and YUM - Heng Sovannarith · PDF fileInstalling Software using RPM and YUM in RPM and YUM in RedHat Enterprise, Fedora, Suse and Centos Heng Sovannarith

YUM without Internet

• List the enabled yum repository

Page 26: Installing Software using RPM and YUM - Heng Sovannarith · PDF fileInstalling Software using RPM and YUM in RPM and YUM in RedHat Enterprise, Fedora, Suse and Centos Heng Sovannarith

RPM

• rpm command installs "packages" from *.rpm files at any source location.

• Basic commands:

rpm –i somefile.rpm (install)

rpm –e somefile (remove)

rpm –U somefile (upgrade, remove old)

rpm –F somefile (update, keep old)

rpm –qa | grep "somefile" (query installed packages)

rpm -qa --last (query installed packages in installed sequence)

• rpmbuild is used to build rpms from source directories, used for kernel compilation.

• RPMs are digitally signed with a GPG key by the vendor to ensure trustworthiness.

Page 27: Installing Software using RPM and YUM - Heng Sovannarith · PDF fileInstalling Software using RPM and YUM in RPM and YUM in RedHat Enterprise, Fedora, Suse and Centos Heng Sovannarith

Yum and rpm files

• See /etc/rpm directory

• See /etc/yum directory

• See /etc/yum.conf

• See /var/cache/yum

Page 28: Installing Software using RPM and YUM - Heng Sovannarith · PDF fileInstalling Software using RPM and YUM in RPM and YUM in RedHat Enterprise, Fedora, Suse and Centos Heng Sovannarith

Using GUI

• Check System/Administration/Software

Sources, Software Update

Page 29: Installing Software using RPM and YUM - Heng Sovannarith · PDF fileInstalling Software using RPM and YUM in RPM and YUM in RedHat Enterprise, Fedora, Suse and Centos Heng Sovannarith

Using GUI (cont.)

Page 30: Installing Software using RPM and YUM - Heng Sovannarith · PDF fileInstalling Software using RPM and YUM in RPM and YUM in RedHat Enterprise, Fedora, Suse and Centos Heng Sovannarith

Using GUI (cont.)

Page 31: Installing Software using RPM and YUM - Heng Sovannarith · PDF fileInstalling Software using RPM and YUM in RPM and YUM in RedHat Enterprise, Fedora, Suse and Centos Heng Sovannarith

Using GUI (cont.)

Page 32: Installing Software using RPM and YUM - Heng Sovannarith · PDF fileInstalling Software using RPM and YUM in RPM and YUM in RedHat Enterprise, Fedora, Suse and Centos Heng Sovannarith

Using tar.gz file

• tar.gz also known as tarball, an archive format for electronic data and software.

• Most Linux tarball contains a source code for software.

• If you are new to Linux I recommend using apt-get, rpm and yum command to install all binary packages.

• Tarballs are a group of files in one file. Tarball files have the extension .tar.gz, .tgz or .tar.bz2. Most open source software use tarballs to distribute programs/source codes.

Page 33: Installing Software using RPM and YUM - Heng Sovannarith · PDF fileInstalling Software using RPM and YUM in RPM and YUM in RedHat Enterprise, Fedora, Suse and Centos Heng Sovannarith

Using tar.gz file (cont.)

Page 34: Installing Software using RPM and YUM - Heng Sovannarith · PDF fileInstalling Software using RPM and YUM in RPM and YUM in RedHat Enterprise, Fedora, Suse and Centos Heng Sovannarith

Using tar.gz file (cont.)

Page 35: Installing Software using RPM and YUM - Heng Sovannarith · PDF fileInstalling Software using RPM and YUM in RPM and YUM in RedHat Enterprise, Fedora, Suse and Centos Heng Sovannarith

Using tar.gz file (cont.)