Wednesday 27 January 2016

Installing and Updating Software/Package after Configure yum in RHEL 7

RPM (Redhat Package Manager) package files  are  named using a  combination of the package name-version -release . architecture

[root@rhel7 Packages]# ls -lrt httpd*
-r--r--r--.  75 root root 1211944 Apr  1  2014 httpd-2.4.6-17.el7.x86_64.rpm

•  NAME is one or more words describing the contents (httpd). 
•  VERSION is the version number of the original software (2.4.6). 
•  RELEASE  is  the re lease number of  the package based on that version, and  is  set by the 
packager, who might not be the original software developer (17.e l7). 
•  ARCH  is the processor architecture the package was  compiled  to run on.  "noarch" indicates 
that  this package's contents are  not architecture-specific (x86_64). 

yum is a  powerful command-line tool that can be used to more  flexibly manage (install, update, remove,  and query) software packages. Official  Red Hat packages  are  normally  downloaded from Red Hat's content distribution network. Registering a  system to the subscription management service automatically configures access  to software repositories based on the attached subscriptions. 

Step 1: Create a directory to collect the packages into that directory

[root@rhel7 Packages]# mkdir /yum
[root@rhel7 Packages]# cd /run/media/root/RHEL-7.0 Server.x86_64/Packages   [go to DVD]
[root@rhel7 Packages]# cp -r * /yum            [copy all packages including sub directory to /yum ]

Step 2: Create a repository 

[root@rhel7 Packages]# createrepo /yum

Step 3: Add a .repo file into /etc/yum.repos.d directory

To make this repository known to yum you need to add a .repo file to your yum configuration. On the systems where you want to use this repo you need to make a new file in /etc/yum.repos.d/. The file can be named anything but the extension on the file has to be .repo. Let's call this one 'sirat.repo'.

[root@rhel7 yum.repos.d]# vim sirat.repo
[sbl]
name=Standard Bank Limited
baseurl=file:///yum
gpgchek=0
enabled=1

Note: there are 3 slashes (/) following the file:, not 2. That is correct.
If you access the file via an http or https server you would use something like:
baseurl = http://servername/my/repo

Step 4: Now check that yum repository configured or not ??

[root@rhel7 yum.repos.d]# yum repolist
Loaded plugins: langpacks, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
sbl                                                                                                                  | 2.9 kB  00:00:00
sbl/primary_db                                                                                              | 3.4 MB  00:00:01
repo id                                   repo name                                                                   status
sbl                                         Standard Bank Limited                                               4,305
repolist: 4,305
[root@rhel7 yum.repos.d]#

Step 5: Install new packages

[root@rhel7 yum.repos.d]# yum install httpd
Loaded plugins: langpacks, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-17.el7 will be installed
--> Processing Dependency: httpd-tools = 2.4.6-17.el7 for package: httpd-2.4.6-17.el7.x86_64
--> Running transaction check
---> Package httpd-tools.x86_64 0:2.4.6-17.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved
.
.
.
.

Now check the package installed or not??

[root@rhel7 yum.repos.d]# yum search httpd
Loaded plugins: langpacks, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
========================================================================== N/S matched: httpd ==========================================================================
httpd.x86_64 : Apache HTTP Server
httpd-devel.x86_64 : Development interfaces for the Apache HTTP server
httpd-manual.noarch : Documentation for the Apache HTTP server
httpd-tools.x86_64 : Tools for use with the Apache HTTP Server
libmicrohttpd.i686 : Lightweight library for embedding a webserver in applications
libmicrohttpd.x86_64 : Lightweight library for embedding a webserver in applications
mod_dav_svn.x86_64 : Apache httpd module for Subversion server

  Name and summary matches only, use "search all" for everything.
[root@rhel7 yum.repos.d]#

Remove Installed Package

[root@rhel7 yum.repos.d]# yum remove httpd



Displays  installed  and available packages. 

[root@rhel7 Packages]# yum list '*http*'
Loaded plugins: langpacks, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
libmicrohttpd.x86_64                            0.9.33-2.el7                                                           @anaconda/7.0
perl-HTTP-Cookies.noarch                    6.01-5.el7                                                             @anaconda/7.0
perl-HTTP-Daemon.noarch                    6.01-5.el7                                                             @anaconda/7.0
perl-HTTP-Date.noarch                         6.02-8.el7                                                             @anaconda/7.0
perl-HTTP-Message.noarch                   6.06-6.el7                                                             @anaconda/7.0
perl-HTTP-Negotiate.noarch                  6.01-5.el7                                                             @anaconda/7.0
perl-HTTP-Tiny.noarch                          0.033-3.el7                                                            @anaconda/7.0
perl-Net-HTTP.noarch                           6.06-2.el7                                                             @anaconda/7.0




No comments:

Post a Comment