How to compare installed rpm and latest rpm availble on repository? - linux

I would like to find difference between installed xyz-1.0.rpm & latest available xyz-1.1.rpm on repository. Also would like to find out any file change happened in new rpm. How can I do that?
please help.
Thanks

check the changelog
You can check the changelog file:
make sure that you have the package yum-plugin-changelog
and then you can use this command to print the last (most recent) changelog message for the xyz package
# yum changelog 1 xyz | less
otherwise you can use rpm:
# rpm -q --changelog -p xyz-1.0.rpm | less
# rpm -q --changelog -p http://mirror.centos.org/centos/6/os/x86_64/Packages/xyz-1.1.rpm | less
compare the files list
to List Files inside the rpm:
Download xyz-1.1.rpm and list files in xyz-1.1.txt
# rpm -qlp xyz-1.1.rpm > xyz-1.1.txt
then list file of the installed package xyz-1.0.rpm
# rpm -ql xyz > xyz-1.0.txt
and finally:
# diff xyz-1.0.txt xyz-1.1.txt
;)

yum check-update
This command allows you to determine whether any updates are available for your installed packages. yum returns a list of all package updates from all repositories if any are available.
https://www.centos.org/docs/5/html/5.1/Deployment_Guide/s1-yum-useful-commands.html

You check the latest version of the as mentioned above using yum check-update and check the version of the installed rpm: rpm -qa | grep mypackage.
Next obtain the a copy of the current rpm and new rpm using yumdownloader (you may need to use sudo as some TLS certs may only be accessible to root) e.g:
sudo yumdownloader mypackage-current.version
sudo yumdownloader mypackage-latest.version
Then install pkgdiff: sudo yum install pkgdiff and run it to generate an HTML report on the differences:
pkgdiff mypackage-current.version mypackage-latest.version

Related

Why couldn't the latest version of rsync be installed on CentOS 7.2?

I am using CentOS 7.2.
I would like to install the latest version of rsync - rsync-3.1.2,
rsync-3.0.9 is on system, installed when installing mariadb with yum,
# rpm -qa |grep rsync
rsync-3.0.9-17.el7.x86_64
removing rsync-3.0.9 first,
# yum remove rsync
rsync and mariadb were removed together,
then,
installing rsync-3.1.2 from source code,
# wget https://download.samba.org/pub/rsync/src/rsync-3.1.2.tar.gz
# tar -zxvf rsync-3.1.2.tar.gz
# cd rsync-3.1.2
# ./configure
# make
# make install
then,
installing mariadb with yum again,
but rsync-3.0.9 will still be installed.
How can I solve the problem?
You can install rsync 3.1.2 from the Fedora 24 .rpm package:
wget http://dl.fedoraproject.org/pub/fedora/linux/releases/24/Everything/x86_64/os/Packages/r/rsync-3.1.2-2.fc24.x86_64.rpm
rpm -Uvh rsync-3.1.2-2.fc24.x86_64.rpm
(but that question doesn't really belong to stackoverflow)
You can install rsync 3.1.2 from the gf-plus repo. Just follow the steps below:
Install the gf-release package.
sudo rpm -Uvh http://mirror.ghettoforge.org/distributions/gf/el/7/gf/x86_64/gf-release-7-10.gf.el7.noarch.rpm
Upgrade rsync package from the gf-plus repo.
sudo yum install -y --enablerepo=gf-plus rsync
Check rsync version.
hash -r; rsync --version | awk 'NR==1 {print $3}'
If it prints 3.1.2, rsync is upgraded.
By default, only the gf repo is enabled, which claims that it "won't overwrite core distro packages". You can disable it:
sudo yum-config-manager --disable gf
(For command not found error, run sudo yum install -y yum-utils and try again.)
Or simply remove all the gf* repos by removing the gf-release package:
sudo yum remove -y gf-release
You either need to install all of your software using packages, or install all of your software from source. Trying to mix and match is going to lead to exactly the sort of problem you are experiencing here: the mariadb package has a dependency on rsync, but the package manager doesn't know anything about the files you have installed from source.
The correct way to solve this problem is to build your own rsync package that can then be installed with yum. You can start with the source package for your distribution and then modify it for 3.1.2. You may be able to utilize a more recent package (e.g., from Fedora) and rebuild it for your system.
You can find the source RPM for rsync-3.0.9 here, and there is some documentation that will hopefully help you get started here.

How do I install PDFTK on VPS for cPanel or CentOS?

I tried using the following commands. However when I reach the last step to install pdftk the console is giving me the error below. I am using a hostgator VPS server. any possible suggestions would be great.
NB: I tried installing libgcj.so.7rh()(64bit) but it already exists. maybe I am doing something wrong.
**Error:** Package: pdftk-1.44-2.el5.rf.x86_64 (rpmforge)
Requires: libgcj.so.7rh()(64bit)
You could try using --skip-broken to work around the problem
** Found 1 pre-existing rpmdb problem(s), 'yum check' output follows:
sendmail-cf-8.14.4-8.el6.noarch has missing requires of sendmail = ('0', '8.14.4', '8.el6')
These are the steps that I followed.
# Log in as root
cd /usr/local/src
# Type
uname -i
#To see which package you need
#Pick one of the below vdepending on the output of uname -i
i386<br>
wegt packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm
x86_64 <br>
wget packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
#Then type
rpm --import apt.sw.be/RPM-GPG-KEY.dag.txt
Verify the downloaded package
rpm -K rpmforge-release-0.5.2-2.el5.rf.*.rpm
#Install RPM
rpm -i rpmforge-release-0.5.2-2.el5.rf.*.rpm
#Then
yum install pdftk
Note: I had to remove the http:// from the links in the commands above before posting.
It seems like you might have a 32-bit OS installed? If you ran through each of those commands in order, you would be trying to use the 64-bit rpmforge repository, which is incorrect for a 32-bit OS.
If that is an accurate supposition, do this..
cd /etc/yum.repos.d/
ls -al
rm <each-rpmforge-file>
Then...
cd /usr/local/src
yum clean
wget packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm
rpm -i rpmforge-release-0.5.2-2.el5.rf.*.rpm
yum update
yum install pdftk

How to make rpm auto install dependencies

I have built two RPM packages
proj1-1.0-1.x86_64.rpm
libtest1-1.0-1.x86_64.rpm
proj1 depends on the file libtest1.so being present and it is reflected correctly in the RPM packages as seen here:
user#my-pc:~$ rpm -qp --requires proj1-1.0-1.x86_64.rpm
libtest1.so()(64bit)
user#my-pc:~$ rpm -qp --provides libtest1-1.0-1.x86_64.rpm
libtest1.so()(64bit)
The installation of proj1 fails due to a missing dependency.
user#my-pc:~$ rpm -ivh proj1-1.0-1.x86_64.rpm
error: Failed dependencies:
libtest1.so()(64bit) is needed by proj1-1.0-1.x86_64.rpm
How do I ensure that libtest1-1.0-1.x86_64.rpm is installed automatically during
the installation of proj1-1.0-1.x86_64.rpm?
I did try the --aid option with rpm -i as described here but it didn't work for me.
Is there any other way?
Thanks for any help.
The link #gertvdijk provided shows a quick way to achieve the desired results without configuring a local repository:
$ yum --nogpgcheck localinstall packagename.arch.rpm
Just change packagename.arch.rpm to the RPM filename you want to install.
Edit Just a clarification, this will automatically install all dependencies that are already available via system YUM repositories.
If you have dependencies satisfied by other RPMs that are not in the system's repositories, then this method will not work unless each RPM is also specified along with packagename.arch.rpm on the command line.
Create a (local) repository and use yum to have it resolve the dependencies for you.
The CentOS wiki has a nice page providing a how-to on this. CentOS wiki HowTos/CreateLocalRepos.
Summarized and further minimized (not ideal, but quickest):
Create a directory for you local repository, e.g. /home/user/repo.
Move the RPMs into that directory.
Fix some ownership and filesystem permissions:
# chown -R root.root /home/user/repo
Install the createrepo package if not installed yet, and run
# createrepo /home/user/repo
# chmod -R o-w+r /home/user/repo
Create a repository configuration file, e.g. /etc/yum.repos.d/myrepo.repo containing
[local]
name=My Awesome Repo
baseurl=file:///home/user/repo
enabled=1
gpgcheck=0
Install your package using
# yum install packagename
For dnf users just use dnf install *.rpm, localinstall is no longer needed.
For me worked just with
# yum install ffmpeg-2.6.4-1.fc22.x86_64.rpm
And automatically asked authorization to dowload the depedencies.
Below the example, i am using fedora 22
[root#localhost lukas]# yum install ffmpeg-2.6.4-1.fc22.x86_64.rpm
Yum command has been deprecated, redirecting to '/usr/bin/dnf install ffmpeg-2.6.4-1.fc22.x86_64.rpm'.
See 'man dnf' and 'man yum2dnf' for more information.
To transfer transaction metadata from yum to DNF, run:
'dnf install python-dnf-plugins-extras-migrate && dnf-2 migrate'
Last metadata expiration check performed 0:28:24 ago on Fri Sep 25 12:43:44 2015.
Dependencies resolved.
====================================================================================================================
Package Arch Version Repository Size
====================================================================================================================
Installing:
SDL x86_64 1.2.15-17.fc22 fedora 214 k
ffmpeg x86_64 2.6.4-1.fc22 #commandline 1.5 M
ffmpeg-libs x86_64 2.6.4-1.fc22 rpmfusion-free-updates 5.0 M
fribidi x86_64 0.19.6-3.fc22 fedora 69 k
lame-libs x86_64 3.99.5-5.fc22 rpmfusion-free 345 k
libass x86_64 0.12.1-1.fc22 updates 85 k
libavdevice x86_64 2.6.4-1.fc22 rpmfusion-free-updates 75 k
libdc1394 x86_64 2.2.2-3.fc22 fedora 124 k
libva x86_64 1.5.1-1.fc22 fedora 79 k
openal-soft x86_64 1.16.0-5.fc22 fedora 292 k
opencv-core x86_64 2.4.11-5.fc22 updates 1.9 M
openjpeg-libs x86_64 1.5.1-14.fc22 fedora 89 k
schroedinger x86_64 1.0.11-7.fc22 fedora 315 k
soxr x86_64 0.1.2-1.fc22 updates 83 k
x264-libs x86_64 0.142-12.20141221git6a301b6.fc22 rpmfusion-free 587 k
x265-libs x86_64 1.6-1.fc22 rpmfusion-free 486 k
xvidcore x86_64 1.3.2-6.fc22 rpmfusion-free 264 k
Transaction Summary
====================================================================================================================
Install 17 Packages
Total size: 11 M
Total download size: 9.9 M
Installed size: 35 M
Is this ok [y/N]: y
I found a simpler solution. If you have all the RPMs in the same directory, all you need to do is,
$ sudo rpm -i *.rpm
rpm seems to figure out the correct order to install these and installs the RPMs.
Matthew's answer awoke many emotions, because of the fact that it still lacks a minor detail.
The general command would be:
# yum --nogpgcheck localinstall <package1_file_name> ... <packageN_file_name>
The package_file_name above can include local absolute or relative path, or be a URL (possibly even an URI).
Yum would search for dependencies among all package files given on the command line AND IF IT FAILS to find the dependencies there, it will also use any configured and enabled yum repositories.
Neither the current working directory, nor the paths of any of package_file_name will be searched, except when any of these directories has been previously configured as an enabled yum repository.
So in the OP's case the yum command:
# cd <path with pkg files>; yum --nogpgcheck localinstall ./proj1-1.0-1.x86_64.rpm ./libtest1-1.0-1.x86_64.rpm
would do, as would do the rpm:
# cd <path with pkg files>; rpm -i proj1-1.0-1.x86_64.rpm libtest1-1.0-1.x86_64.rpm
The differencve between these yum and rpm invocations would only be visible if one of the packages listed to be installed had further dependencies on packages NOT listed on the command line.
In such a case rpm will just refuse to continue, while yum would use any configured and enabled yum repositories to search for dependencies, and may possibly succeed.
The current working directory will NOT be searched in any case, except when it has been previously configured as an enabled yum repository.
Copy all your RPMs in a directory, then install as follows:
yum install -y --cacheonly --disablerepo=* /var/rpm_dir/*.rpm
For specific packages you can use yumdownloader, example in this other thread: https://stackoverflow.com/a/66927190/5078874
I ran into this and what worked for me was to run yum localinstall enterPkgNameHere.rpm from inside the directory where the .rpm file is located.
Note: replace the enterPkgNameHere.rpm with the name of your .rpm file.
In the case of openSUSE Leap 15, I'm receiving similar error:
> sudo rpm -i opera-stable_53.0.2907.68_amd64.rpm
[sudo] password for root:
warning: opera-stable_53.0.2907.68_amd64.rpm: Header V4 RSA/SHA512 Signature, key ID a5c7ff72: NOKEY
error: Failed dependencies:
at is needed by opera-stable-53.0.2907.68-0.x86_64
I run this command to figure out what are the dependencies:
> sudo zypper install opera-stable_53.0.2907.68_amd64.rpm
Loading repository data...
Reading installed packages...
Resolving package dependencies...
The following 4 NEW packages are going to be installed:
at libfl2 libHX28 opera-stable
4 new packages to install.
Overall download size: 50.3 MiB. Already cached: 0 B. After the operation, additional 176.9 MiB will be used.
Continue? [y/n/...? shows all options] (y): n
Then I run this command to install dependencies:
> sudo zypper in at
Loading repository data...
Reading installed packages...
Resolving package dependencies...
The following 3 NEW packages are going to be installed:
at libfl2 libHX28
3 new packages to install.
Overall download size: 208.6 KiB. Already cached: 0 B. After the operation, additional 600.4 KiB will be used.
Continue? [y/n/...? shows all options] (y): y
Then I run this to install the rpm file:
> sudo rpm -i opera-stable_53.0.2907.68_amd64.rpm
I'm not sure if it is the best practice, however it solved my issue.
Step1: copy all the rpm pkg in given locations
Step2: if createrepo is not already installed, as it will not be by default, install it.
[root#pavangildamysql1 8.0.11_rhel7]# yum install createrepo
Step3: create repository metedata and give below permission
[root#pavangildamysql1 8.0.11_rhel7]# chown -R root.root /scratch/PVN/8.0.11_rhel7
[root#pavangildamysql1 8.0.11_rhel7]# createrepo /scratch/PVN/8.0.11_rhel7
Spawning worker 0 with 3 pkgs
Spawning worker 1 with 3 pkgs
Spawning worker 2 with 3 pkgs
Spawning worker 3 with 2 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
[root#pavangildamysql1 8.0.11_rhel7]# chmod -R o-w+r /scratch/PVN/8.0.11_rhel7
Step4: Create repository file with following contents at /etc/yum.repos.d/mysql.repo
[local]
name=My Awesome Repo
baseurl=file:///scratch/PVN/8.0.11_rhel7
enabled=1
gpgcheck=0
Step5 Run this command to install
[root#pavangildamysql1 local]# yum --nogpgcheck localinstall mysql-commercial-server-8.0.11-1.1.el7.x86_64.rpm
Simple just run the following command.
sudo dnf install *package.rpm
Enter your password and you are done.
Process of generating RPM from source file:
1) download source file with.gz extention.
2) install rpm-build and rpmdevtools from yum install. (rpmbuild folder will be generated...SPECS,SOURCES,RPMS.. folders will should be generated inside the rpmbuild folder).
3) copy the source code.gz to SOURCES folder.(rpmbuild/SOURCES)
4)Untar the tar ball by using the following command.
go to SOURCES folder :rpmbuild/SOURCES where tar file is present.
command: e.g tar -xvzf httpd-2.22.tar.gz
httpd-2.22 folder will be generated in the same path. Check if apr and apr-util and there in httpd-2.22/srclib folder. If apr and apr-util doesnt exist download latest version from apache site ,untar it and put it inside httpd-2.22/srclib folder. Also make sure you have pcre install in your system .
5)go to extracted folder and then type below command:
./configure --prefix=/usr/local/apache2 --with-included-apr --enable-proxy --enable-proxy-balancer --with-mpm=worker --enable-mods-static=all
6)run below command once the configure is successful:
make
7)after successfull execution od make command run:
checkinstall
in tha same folder. (if you dont have checkinstall software please download latest version from site)
Also checkinstall software has bug which can be solved by following way:::::
locate checkinstallrc and then replace TRANSLATE = 1 to TRANSLATE=0 using vim command.
Also check for exclude package: EXCLUDE="/selinux"
8)checkinstall will ask for option (type R if you want tp build rpm for source file)
9)Done .rpm file will be built in RPMS folder inside rpmbuild/RPMS file...
ALL the BEST ....
Regards,
Prerana

Installing RPM Dependencies

I am trying to install dbus-1.1.2-12.el5.i386 but I get the error
" dbus-libs = 1.1.2-12.el5 is needed by dbus-1.1.2-12.el5.i386" :-(
So I downloaded "dbus-libs-1.1.2-12.el5.i386.rpm" in the same directory and ran the
command rpm -ivh dbus-1.1.2-12.el5.i386 again, but I still got the same error. On searching on Forums I found that RPM takes care of dependecies if they are present in the same Directory. but it does not work with -ivh option ??
Steve B is correct:
yum install dbus-libs
yum install dbus
yum will also allow you to do "whatprovides" for a package:
yum whatprovides dbus-libs
This will show you if you have another version of dbus-libs "installed" on your system, it spools out what repos provide the package and is any are provided (installed) locally.
Also helpful is:
rpm -q dbus
which will show any packages that are locally install as will:
rpm -q dbus-libs
or
rpm -qa | grep 'dbus'
You may find that you already have an eariler version of dbus installed, which case:
yum -y update dbus
Hope this helps.
http://www.of-networks.co.uk
You need to install the dependant RPMs before installing dbus. You should also know that this is the hard way, these days RPM-based distributions usually have a dependancy managment system so that you don't need to do this by hand. e.g. on Redhat/Fedora/Centos you can just type "yum install mypackagename".

How to list the contents of a package using YUM?

I know how to use rpm to list the contents of a package (rpm -qpil package.rpm). However, this requires knowing the location of the .rpm file on the filesystem. A more elegant solution would be to use the package manager, which in my case is YUM. How can YUM be used to achieve this?
There is a package called yum-utils that builds on YUM and contains a tool called repoquery that can do this.
$ repoquery --help | grep -E "list\ files"
-l, --list list files in this package/group
Combined into one example:
$ repoquery -l time
/usr/bin/time
/usr/share/doc/time-1.7
/usr/share/doc/time-1.7/COPYING
/usr/share/doc/time-1.7/NEWS
/usr/share/doc/time-1.7/README
/usr/share/info/time.info.gz
On at least one RH system, with rpm v4.8.0, yum v3.2.29, and repoquery v0.0.11, repoquery -l rpm prints nothing.
If you are having this issue, try adding the --installed flag: repoquery --installed -l rpm.
DNF Update:
To use dnf instead of yum-utils, use the following command:
$ dnf repoquery -l time
/usr/bin/time
/usr/share/doc/time-1.7
/usr/share/doc/time-1.7/COPYING
/usr/share/doc/time-1.7/NEWS
/usr/share/doc/time-1.7/README
/usr/share/info/time.info.gz
rpm -ql [packageName]
Example
# rpm -ql php-fpm
/etc/php-fpm.conf
/etc/php-fpm.d
/etc/php-fpm.d/www.conf
/etc/sysconfig/php-fpm
...
/run/php-fpm
/usr/lib/systemd/system/php-fpm.service
/usr/sbin/php-fpm
/usr/share/doc/php-fpm-5.6.0
/usr/share/man/man8/php-fpm.8.gz
...
/var/lib/php/sessions
/var/log/php-fpm
No need to install yum-utils, or to know the location of the rpm file.
$ yum install -y yum-utils
$ repoquery -l packagename
I don't think you can list the contents of a package using yum, but if you have the .rpm file on your local system (as will most likely be the case for all installed packages), you can use the rpm command to list the contents of that package like so:
rpm -qlp /path/to/fileToList.rpm
If you don't have the package file (.rpm), but you have the package installed, try this:
rpm -ql packageName
There are several good answers here, so let me provide a terrible one:
: you can type in anything below, doesnt have to match anything
yum whatprovides "me with a life"
: result of the above (some liberties taken with spacing):
Loaded plugins: fastestmirror
base | 3.6 kB 00:00
extras | 3.4 kB 00:00
updates | 3.4 kB 00:00
(1/4): extras/7/x86_64/primary_db | 166 kB 00:00
(2/4): base/7/x86_64/group_gz | 155 kB 00:00
(3/4): updates/7/x86_64/primary_db | 9.1 MB 00:04
(4/4): base/7/x86_64/primary_db | 5.3 MB 00:05
Determining fastest mirrors
* base: mirrors.xmission.com
* extras: mirrors.xmission.com
* updates: mirrors.xmission.com
base/7/x86_64/filelists_db | 6.2 MB 00:02
extras/7/x86_64/filelists_db | 468 kB 00:00
updates/7/x86_64/filelists_db | 5.3 MB 00:01
No matches found
: the key result above is that "primary_db" files were downloaded
: filelists are downloaded EVEN IF you have keepcache=0 in your yum.conf
: note you can limit this to "primary_db.sqlite" if you really want
find /var/cache/yum -name '*.sqlite'
: if you download/install a new repo, run the exact same command again
: to get the databases for the new repo
: if you know sqlite you can stop reading here
: if not heres a sample command to dump the contents
echo 'SELECT packages.name, GROUP_CONCAT(files.name, ", ") AS files FROM files JOIN packages ON (files.pkgKey = packages.pkgKey) GROUP BY packages.name LIMIT 10;' | sqlite3 -line /var/cache/yum/x86_64/7/base/gen/primary_db.sqlite
: remove "LIMIT 10" above for the whole list
: format chosen for proof-of-concept purposes, probably can be improved a lot
currently reopquery is integrated into dnf and yum, so typing:
dnf repoquery -l <pkg-name>
will list package contents from a remote repository (even for the packages that are not installed yet)
meaning installing a separate dnf-utils or yum-utils package is no longer required for the functionality as it is now being supported natively.
for listing installed or local (*.rpm files) packages' contents there is rpm -ql
i don't think it is possible with yum org dnf (not repoquery subcommand)
please correct me if i am wrong
Yum doesn't have it's own package type. Yum operates and helps manage RPMs. So, you can use yum to list the available RPMs and then run the rpm -qlp command to see the contents of that package.

Resources