Red Hat commands and tips (Part2) - RPM and YUM
RPM stands for "Red Hat Package Management" and it is used to manage the install, removal and updae of packages on most Red Hat based systems.
I am going to show you some rpm commands which I use frequently and I think those are the ones you will need the most.
How to display all packages installed
[root@centos63 log]# rpm -qa
Note: This will display all packages installed, depending on your system, the list could contain thousands of packages or just few hundred. The list will be long.
How to find if specific package is installed
[root@centos63 log]# rpm -qa | grep openssh-server
openssh-server-5.3p1-81.el6.x86_64
Note: If no result gets displayed, that could mean a)you got the package name wrongly b) package is not installed
How to dump the list of packages installed to a file
[root@centos63 log]# rpm -qa > /tmp/all_packages
How to install a RPM package
[root@centos63 ~]# rpm -i samba4-4.0.0-55.el6.rc4.x86_64.rpm
How to install/update an RPM package
[root@centos63 ~]# rpm -Uvh samba4-4.0.0-55.el6.rc4.x86_64.rpm
How to find which package a file belongs to
[root@centos63 ~]# rpm -qf /etc/inittab
initscripts-9.03.31-2.el6.centos.1.x86_64
How to test an RPM package without installing it
[root@centos63 ~]# rpm -i --test samba4-4.0.0-55.el6.rc4.x86_64.rpm
How to debug and estract INFO from an RPM package
[root@centos63 ~]# rpm -ivv samba4-4.0.0-55.el6.rc4.x86_64.rpm
How to install a package if it is already installed
[root@centos63 ~]# rpm -iv --replacepkgs samba4-4.0.0-55.el6.rc4.x86_64.rpm
YUM stands for "Yellowdog Updater Modified" and it is an interactive, rpm based, package manager. It can automatically perform system updates, including dependency analysis and obsolete processing based on "repository" metadata.
I'll show you how to manage your server with the yum command and keep it up-to-date and easily search and install packages.
How to search for a package
[root@centos63 ~]# yum search samba4
==================================================================== N/S Matched: samba4 ====================================================================
samba4.x86_64 : The Samba4 CIFS and AD client and server suite
samba4-client.x86_64 : Samba client programs
samba4-common.x86_64 : Files used by both Samba servers and clients
How to install a package
[root@centos63 ~]# yum install samba4.x86_64
Note: the good thing about yum is it will try abd work out the dependencies for you.
How to update the system
[root@centos63 ~]# yum update
Note: if you get an error message similar to the one below:
Error: samba4 conflicts with samba
Error: samba4-common conflicts with samba-common
Run the command below:
[root@centos63 ~]# yum update --skip-broken
Install 8 Package(s)
Upgrade 126 Package(s)
Total download size: 155 M
Is this ok [y/N]:
Note: This should take care of most problems and and broken past installations.
How to download an RPM package with yum.
First you will need to download a program called "yumdownloader" part of a package called "yum-utils.noarch"
1. Search for the package
[root@centos63 ~]#yum search yumdownloader
yum-utils.noarch : Utilities based around the yum package manager
2. Installing the package "yum-utils.noarch"
[root@centos63 ~]# yum install yum-utils.noarch
3. How to download packages with yumdoanloder
[root@centos63 ~]# yumdownloader samba
I hoipe this will be useful to you and help you in learning or manage your Srvers well.
Many thanks
by Renato de Oliveira
No comments:
Post a Comment