Tuesday, August 2, 2016

RPM - SOFTWARE PACKAGE MANAGER

SOFTWARE PACKAGE MANAGER

RPM ----Red Hat Package Manager, Red Had based package call RPM

Rpm is a powerful Package Manager for Red Hat, Suse and Fedora Linux. It can be used to build, install, query, verify, update, and remove/erase individual software packages. A Package consists of an archive of files, and package information, including name, version, and description:


RPM is free – GPL General Public License
Management of source files
Management of the build process
A distribution method and format for binary files, including pre- and postinstall scripts.


Where to get RPMs

http://rpmseek.com
http://rpmfind.net
http://www.redhat.com
http://freshrpms.net
http://rpm.pbone.net
http://dag.wieers.com
http://rpmforge.net

http://filewatcher.com



Common Build Procedures
Source code install - tarball (.tar, .tar.gz,.tgz, tar.bz,tar.tbz)

1) Red Had based OS – Centos, Fedora

2) Debain based OS – Ubuntu , Mini OS


xmms….rpm ----------------------for red hat os

xmms…..deb ----------------------for ubuntu
-----------------------------------------------------------------------------------------------
How to installed rpm package

# rpm   -ivh  xmms.rpm   --------------------installation command for Centos
# dpkg   -i    xmms.deb  --------------------- installation command for Ubuntu

i --------------Installed
v ------------- Verbose (Display)
h ------------- (#) hush ------------Database (data short)

By default we can’t run .exe file in Linux
If you want to run .exe file in Linux, so we can used below EMULATORS

1) WIN

2) CROSSOVER

Only small Package software used above EMULATORS
Eg. Tally, winam, IE,
-----------------------------------------------------------------------------------------------
 There are 3 ways to Installed software & 3 Package Formats
1 ) # rmp   installation   -------------------Utility
     # yum   installation  ------------------- Both are the same

2  )  Source code installation ( Build Compilation )
3 ) SRPM installation (Source RPM )
 -----------------------------------------------------------------------------------------------------------------
Remote from Linux to Windows ----To used    rdesktop
How to download Software for Linux  -  Just search software and right click on software package & copy URL and we can download from command through
[root@localhost rpm]# which rpm
/bin/rpm
-----------------------------------------------------------------------------------------------------------------
i  --------------Installed
v  ------------- verbose ( Display )
h  ------------- (#)hush  ------------Database (data short)
q   ----------------Query
l    --------------------list
p   ----------------------Packages
-qlp -----------query , list, package (used for check list file - pre-installation )
[root@tushar ~]# mkdir /opt/software
[root@tushar ~]# cd /opt/software/
wget  ( paste the URL and enter )  ---------command line download
[root@tushar software]# ls
libgssglue-0.1-11.el6.x86_64.rpm        rdesktop-1.8.0-12.1.x86_64.rpm
pcsc-lite-libs-1.5.2-15.el6.x86_64.rpm

[root@tushar software]# rpm -qlp rdesktop-1.8.0-12.1.x86_64.rpm
/usr/bin/rdesktop     --------------------------------------------output
/usr/share/doc/rdesktop-1.8.0
/usr/share/doc/rdesktop-1.8.0/AUTHORS
/usr/share/doc/rdesktop-1.8.0/COPYING
/usr/share/doc/rdesktop-1.8.0/ChangeLog
/usr/share/rdesktop/keymaps/pt
/usr/share/rdesktop/keymaps/pt-br
/usr/share/rdesktop/keymaps/ru
/usr/share/rdesktop/keymaps/sl
/usr/share/rdesktop/keymaps/sv
/usr/share/rdesktop/keymaps/th 
-----------------------------------------------------------------------------------------------------------------
Linux       – Rdesktop
Windows – MSTSC
-----------------------------------------------------------------------------------------------------------------
 [root@tushar software]# rpm -qlp rdesktop-1.8.0-12.1.x86_64.rpm
( Check package list for before installation )
Dependency packages for rdesktop -Remote Desktop service for Linux
libgssglue-0.1-11.el6.x86_64.rpm 
pcsc-lite-libs-1.5.2-15.el6.x86_64.rpm 
rdesktop-1.8.0-12.1.x86_64.rpm

[root@tushar software]# rpm -ivh libgssglue-0.1-11.el6.x86_64.rpm
[root@tushar software]# rpm -ivh pcsc-lite-libs-1.5.2-15.el6.x86_64.rpm 
[root@tushar software]# rpm -ivh rdesktop-1.8.0-12.1.x86_64.rpm

Some Query Options
$ rpm -ivh {rpm-file} Install the package
$ rpm -ivh mozilla-mail-1.7.5-17.i586.rpm
$ rpm -ivh --test mozilla-mail-1.7.5-17.i586.rpm
-----------------------------------------------------------------------------------------------------------------
#  -qlp -------------------------------------Before Installation
#  -ql ----------------------------------------After Installation
-----------------------------------------------------------------------------------------------------------------
Software Packages in Linux OS
1)     Centos 5 --------DVD/Centos……………….…..RMP (2600 rpm - packages)
2) RHEL 5 --------DVD/Server -----------------------RPM
3) RHEL 6 ---------DVD/Packages --------------------RPM
-----------------------------------------------------------------------------------------------------------------
Note: Around 700 RPM packages installed at the time of OS installation
-----------------------------------------------------------------------------------------------------------------
How to mount DVD in Linux
[root@tushar software]# mount /dev/cdrom /mnt/    ----------------mount dvd rom
-----------------------------------------------------------------------------------------------------------------
How to find installed package in Linux
[root@tushar software]# rpm –qa   -------------(Query, All) – To check all installed packages
vino-2.28.1-9.el6_4.x86_64             -----------------output
ConsoleKit-0.4.1-3.el6.x86_64
libnotify-0.5.0-1.el6.x86_64
dejavu-fonts-common-2.30-2.el6.noarch
totem-mozplugin-2.28.6-4.el6.x86_64
-----------------------------------------------------------------------------------------------------------------
Find the installed package (count) in Linux  

[root@tushar software]# rpm -qa | wc –l --------------------To check installed package count
882 ----------------------------------------------------------Total Package Count
-----------------------------------------------------------------------------------------------------------------
[root@tushar software]# rpm -qa | grep -i rdesktop----To check specific package after
 installation ( its installed or not)
rdesktop-1.8.0-12.1.x86_64   ----------------------------package name
[root@tushar software]# rpm -qa | grep rdesktop
rdesktop-1.8.0-12.1.x86_64
[root@tushar software]# rpm -qa | grep -l rdesktop
(standard input)
-----------------------------------------------------------------------------------------------------------------
 Uninstalled –To removing (Delete written files)

-e -----------------------Removing (uninstalled package)

How to Uninstalled or Removing Packages

[root@tushar software]# rpm –e rdesktop-1.8.0-12.1.x86_64  
-----------------------------------------------------------------------------------------------------------------
[root@tushar software]# rpm -ql rdesktop  -----To check specific software installed list for delete manual   ( this command used for after insttaltion )
[root@tushar software]# rm –rf /usr/share/rdesktop/keymaps/pt
[root@tushar software]# rm –rf /usr/share/rdesktop/keymaps/pt-br
[root@tushar software]# rm –rf /usr/share/rdesktop/keymaps/ru
[root@tushar software]# rm –rf /usr/share/rdesktop/keymaps/sl
[root@tushar software]# rm –rf /usr/share/rdesktop/keymaps/sv
[root@tushar software]# rm –rf /usr/share/rdesktop/keymaps/th
[root@tushar software]# rm –rf /usr/share/rdesktop/keymaps/tr
-----------------------------------------------------------------------------------------------------------------
RPM Package Installed force fully - We can installed and uninstall package force fully

[root@tushar software]# rpm -ivh --force rdesktop-1.8.0-12.1.x86_64.rpm
 -----------------------------------------------------------------------------------------------------------------
How to upgrade package or software - Download Upgraded Package
[root@tushar software]# rpm -qa | grep –i firefox   ----------------check version
firefox-17.0.10-1.el6.centos.x86_64   --------------------------version 17.0.10.1
                                ---------------------@@@@@--------------------------
[root@tushar software]# wget ftp://ftp.muug.mb.ca/mirror/centos/6.7/updates/x86_64/Packages/firefox-38.3.0-2.el6.centos.x86_64.rpm    -------------------------------download upgrade package

[root@tushar software]# ls
firefox-38.3.0-2.el6.centos.x86_64.rpm  ----download upgraded package of Firefox
pcsc-lite-libs-1.5.2-15.el6.x86_64.rpm 
xmms-debug-1.2.11-2mdv2009.0.x86_64.rpm
libgssglue-0.1-11.el6.x86_64.rpm       
rdesktop-1.8.0-12.1.x86_64.rpm

[root@tushar software]# rpm -Uvh firefox-38.3.0-2.el6.centos.x86_64.rpm
Preparing...                ########################################### [100%]
   1:firefox                ########################################### [100%]
                                  ---------------------@@@@@--------------------------
[root@tushar software]# rpm -qa | grep firefox   ---after upgrade Firefox
firefox-38.3.0-2.el6.centos.x86_64---------------------------- version 38.3.0.2

Some Query Options
$ rpm -Uvh {rpm-file} download Upgrade package
$ rpm -Uvh mozilla-mail-1.7.6-12.i586.rpm
$ rpm -Uvh --test mozilla-mail-1.7.6-12.i586.rpm

Note : You can uninstalled old version and installed upgraded vision
-----------------------------------------------------------------------------------------------------------------
 RPM maintains its own Database, eg…myql, orcal, sql, ibmdb.
[root@tushar rpm]# cd /var/lib/rpm/ ----RPM  DATABASE  LOCATION
[root@tushar rpm]# ls
Basenames     __db.004   Name                   Pubkeys           Triggername
Conflictname  Dirnames Obsoletename      Requirename
__db.001      Filedigests  Packages              Requireversion
__db.002      Group         Providename        Sha1header
__db.003      Installtid     Provideversion     Sigmd5

[root@tushar rpm]# ls /var/lib/rpm/Packages-------------------RPM  DATABASE  FILE
Packages

Incase Database is corrupt or deleted – we will rebuild / restore the rpm database
[root@tushar rpm]# rpm –rebuilddb   ------rebuild command
[root@tushar rpm]# echo $?   -----------------To check command run successful or not
0      …………………………………0 means successful
-----------------------------------------------------------------------------------------------------------------
1)  All files are extracting Sync (Written) in to HDD
2)  Information is updated to  RPM  DATABASE.
-----------------------------------------------------------------------------------------------------------------
Task
Installed xmms….rpm & rdesktop

Download xmms-1.2.10-1.i386.rpm & try to install

$ rpm –ivh xmms-1.2.10-1.i386.rpm

Will ask for dependency, Download dep from the given sites above & install the same.

Download dependency
glib-1.2.10-627.i586.rpm
gtk-1.2.10-926.i586.rpm
gtk-32bit-1.2.10-926.x86_64.rpm
-----------------------------------------------------------------------------------------------------------------
[root@tushar software]# rpm -e xmms-debug-1.2.11-2mdv2009.0.x86_64 –Remove Package
[root@tushar software]# rpm -ivh --nodeps xmms-debug-1.2.11-2mdv2009.0.x86_64.rpm
[root@tushar software]# rpm -e firefox  ---------------------Remove firefox
[root@tushar software]# rpm -qa | grep firefox   ----------------To check
[root@tushar software]# rpm -ihv firefox-38.3.0-2.el6.centos.x86_64.rpm  --- install from rpm
warning: firefox-38.3.0-2.el6.centos.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: N                                                                       OKEY
error: Failed dependencies:
        nspr >= 4.10.8 is needed by firefox-38.3.0-2.el6.centos.x86_64
        nss >= 3.18.0 is needed by firefox-38.3.0-2.el6.centos.x86_64
        libvpx >= 1.3.0 is needed by firefox-38.3.0-2.el6.centos.x86_64
        gtk2 >= 2.24 is needed by firefox-38.3.0-2.el6.centos.x86_64
        libvpx.so.1()(64bit) is needed by firefox-38.3.0-2.el6.centos.x86_64
[root@tushar software]# yum install -y firefox*  -------------installed from yum command
-----------------------------------------------------------------------------------------------------------------

[root@tushar software]# rpm -ivh --nodeps xmms-1.2.10-4.i386.rpm
Preparing...                ########################################### [100%]
   1:xmms                   ########################################### [100%]
Remember to install appropriate xmms-input-* packages for files you want to play.
[root@tushar software]# rpm -qa | grep xmms
xmms-1.2.10-4.i386
Package installed but software not open because of all package not installed
-nodeps   ------------------No Dependency ( installing package without dependency )
-----------------------------------------------------------------------------------------------------------------
[root@tushar software]# rpm -qi rdesktop  -------installed Package information
Name        : rdesktop                     Relocations: (not relocatable)
Version     : 1.8.0                             Vendor: obs://build.opensuse.org/home:aevseev
Release     : 12.1                          Build Date: Thu 15 Aug 2013 08:36:33 PM PDT
Install Date: Mon 28 Dec 2015 10:22:56 PM PST      Build Host: build21
Group       : Productivity/Networking/Remote Desktop   Source RPM: rdesktop-1.8.0-
Size        : 457499                           License: GPL-3.0
-----------------------------------------------------------------------------------------------------------------
$ rpm -Fvh upgrades to a later version
$ rpm -ev {package} Erase/remove/ an installed package
$ rpm -ev mozilla-mail
$ rpm -ev --nodeps {package} Erase/remove/ an installed package  
       without checking for dependencies
$ rpm -ev --nodeps mozilla-mail
$ rpm -qa Display list all installed packages rpm -qa
$ rpm -qa | less
$ rpm -qi {package} Display installed information along with package version and short description
$ rpm -qi mozilla-mail
$ rpm -qf {/path/to/file} Find out what package a file belongs to i.e. find what package owns the file
$ rpm -qf /etc/passwd
$ rpm -qf /bin/bash
$ rpm -qc {pacakge-name} Display list of configuration file(s) for a package
$ rpm -qc httpd
$ rpm -qcf {/path/to/file} Display list of configuration files for a command
$ rpm -qcf /usr/X11R6/bin/xeyes
$ rpm -qa --last Display list of all recently installed RPMs
$ rpm -qa --last
$ rpm -qa --last | less
$ rpm -qpR {.rpm-file}
$ rpm -qR {package} Find out what dependencies a rpm file has
$ rpm -qpR mediawiki-1.4rc1-4.i586.rpm
$ rpm -qR bash
$ rpm -qlp foo.rpm Which files are installed with foo.rpm?
$ rpm -ivh --nodeps pants.rpm Installing package Ignoring  Dependencies
$ rpm -e foo ('e' for erase)
$ rpm -i --prefix /new/directory package.rpm The --prefix and --relocate
options should make the rpm command relocate a package to a new
location.
$ rpm -k <.rpm> we could verify the MD5 is OK
$ rpm --rebuilddb

Source Code Installation (Build Compilation of RPM)
How to build rpm packages

Source Code for Windows

$ route ['add'/'del'] [-net|-host] 'addr' {gw 'IP'} {netmask 'mask'}
'interface'
$ route ['add'/'del'] [-net|-host] 'addr' {gw 'IP'} {netmask 'mask'}
'interface'




Compile with help of gcc tool
 ( Build )
After compile source code we get multiple files,

We Create winnam.ini file and give path

/c/proram/rdesktop  
/c/system32 /…rdesktop
/c/windows//resdep
/c/windows/etc/
/.dll

Create package from Windows installer tool and to get .exe file



Source Code for Linux

$ route ['add'/'del'] [-net|-host] 'addr' {gw 'IP'} {netmask 'mask'}
'interface'
$ route ['add'/'del'] [-net|-host] 'addr' {gw 'IP'} {netmask 'mask'}
'interface'




Compile with help of gcc tool
 ( Build )
After compile source code we get multiple files,

We Create xmms.ini file and give path

/user/bin/rdesktop   --( posix-unix file
                                        system used )
/user/shaed/odc/…rdesktop
/etc/dev/resdep
/etc….
/dev/lslaa
 
Create package from rpmbuild tool and to get rpm package

Source code complied with help fog cc tool à after complied source code à rpm build tool à create .rpm file
POSIX Standard – UNIX file system standard
Posix means   -   / ,  /etc/,  /bin/ , /user/
-----------------------------------------------------------------------------------------------------------------
TO Find the OS Version or Architecture
[root@tushar software]# arch  /  uname -m---------------To check OS version or Architecture
x86_64  ……………………………………..OUTPUT

[root@tushar software]# uname –a  
Linux tushar 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

i386 ----------------files versions
i586 ----------------files versions
i686 ----------------files versions
All the above version is 32 bits versions


[root@tushar software]# cat /proc/cpuinfo   --To check CPU Information
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model name    : Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz
cpu MHz       : 3292.629

“no arch” –   file installed both OS 32bis and 64 bits
[root@tushar software]# cat /proc/cpuinfo | less
[root@tushar software]# top     ------To check core cpu ( find core from to and type 1)
top - 02:07:29 up 4 days, 22:48,  4 users,  load average: 0.00, 0.02, 0.00
Tasks: 133 total,   1 running, 132 sleeping,   0 stopped,   0 zombie
Cpu0  :  0.0%us,  0.3%sy,  0.0%ni, 99.7%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   1016320k total,   787396k used,   228924k free,    25424k buffers
Swap:  2064376k total,      440k used,   2063936k free,   452336k cached
-------------------------------------------------------------------------------------------------------------
Source Code Installation
-----------------------------------------------------------------------------------------------------------------
Source code installation –-1) Compilation 2) Build a Package 3)Tar Ball Installation
-----------------------------------------------------------------------------------------------------------------
Task
How to installed source code file in Linux -------------Download httpd Source Code file.

Source code file extensions – 1) httpd.2.2.23.tar.gz,  2) httpd..src.tar.gz

Search from net – httpd download + archive ------------source code package search.

[root@tushar software]# wget https://archive.apache.org/dist/httpd/httpd-2.2.23.tar.gz

[root@tushar software]# ls    -----to check
httpd-2.2.23.tar.gz     -------------------------------Package Downloaded from net
                                                              we can compile or customize package.
HTTPD ----Appachi
[root@tushar software]# tar -zxvf httpd-2.2.23.tar.gz    ------ extract tar command

IF any command not working properly or system will hung ---just installed strace

[root@tushar software]# yum install strace

[root@tushar software]# strace tar -zxvf httpd-2.2.23.tar.gz  ------To check error

After extract file we get httpd folder in software DIR.

[root@tushar software]# ls   -----To check folder

 httpd-2.2.23.tar. ---package   httpd-2.2.23  ----create folder
[root@tushar software]# cd httpd-2.2.23
 [root@tushar httpd-2.2.23]# ls
ABOUT_APACHE       BuildAll.dsp          config.layout        emacs-style                 httpd.spec      LAYOUT                      LICENSE               NOTICE              README.platforms   srclib
acinclude.m4                 BuildBin.dsp          configure         Makefile.in
          
Before compile package or run 3 files we need to installed gcc tool

[root@tushar software]# rpm -qa | grep –i  gcc ----To check package installed or not
gcc-4.4.7-4.el6.x86_64   -----its means gcc already installed in system

[root@tushar software]# yum install -y gcc    --- if it’s not installed then installed gcc from yum

1) ./Configure                              }
2)  MAKE                                    }   3 commands called
3)  MAKE Install                        Autoconway,  Compile , Build Source

After 3 commands run we in httpd DIR & get compilation package its call httpd.rpm
-----------------------------------------------------------------------------------------------------------------
[root@tushar software]# echo $?   ----To check last command run successfully or fails
0  ---(Value will be “0” It’s means last command run successful & 1,more number is means fails
# echo $?    ----------------------is called exit status
[root@tushar httpd-2.2.23]# echo $?
1 ---------------------------------command not run successful
-----------------------------------------------------------------------------------------------------------------
1 How to installed source code package - (3 commands to installed source code package and only source code folder )
1) ./Configure  - Check dependencies in your system & reconstruct Makefile.in  to Makefile           

[root@tushar httpd-2.2.23]# ls
Configure      Makefile     Makefile.in   Makefile.win

2)  make ----This command refers makefile & compiles all the code /madule with the help of gcc tool ( Actual compilation process ) compilation process start (imp command is make)

100, 1000, 5000 - Multiple files store (binary files ) in Memory store

3)  MAKE Install –(This cmd will Sync/Write all the compiled modules from Memory to HDD
Make install -----similar as ( rpm –ivh)
-----------------------------------------------------------------------------------------------------------------
How to uninstalled source code packages
1)…Stop process

2) rm –rf /usr/local/apachi1   ----just the delete folder
-----------------------------------------------------------------------------------------------------------------
./comfigure    --help   --------to check parameter’s 
-----------------------------------------------------------------------------------------------------------------

Httpd.rpm   (Dis-advantage) -------we cannot customize the package
                    (Advantage)      ------- Database Maintain easy and manage

Httpd.tar.gz  (Advantage)     -------we can customize the package
                     (Dis-advantage) ------- No Database Maintain
-----------------------------------------------------------------------------------------------------------------
Customize source code
#./configure  --enable=php   --enable=java  --disable=auth
To Allow PHP & JAVA & Disable Authentication
Before start installation ( ./comfigure, make, make install ) to check readme and install.inf file
 [root@Tusharjahdav ~]# cd /opt/software/
[root@Tusharjahdav software]# wget https://archive.apache.org/dist/httpd/binaries/rpm/SRPMS/httpd-2.0.50-1.src.rpm   ----download package from internet

-----------------------------------------------------------------------------------------------------------------

No comments:

Post a Comment