Download RPMs for all dependencies for package using yum - centos

I'm attempting to create a local yum repo on my system containing various packages from, chiefly, the CentOS base repos. The server which is hosting the yum repo will not necessarily have the same base packages installed by default as the servers which will be using the yum repo. For this reason, I need to ensure that my repos contain the packages that I want and every single one of their dependencies.
I'm creating my repos using the yumdownloader tool provided in the yum-utils package to try to download an RPM file for a package using yum from the standard CentOS mirrors. Helpfully it provides a command line option, --resolve, which also downloads dependencies. However, because it's built on yum itself, yumdownloader will only download dependencies for the package that are not already present on the system.
For example, I wish to download package A, which depends on Packages B, C and D. If package D is already installed on the system, yumdownloader --resolve A will only download A, B and C, but not D.
Is there a way to download the RPMs for all dependencies on a package from a yum repo?

There's this bash script, which the maintainer of rpm has kindly shared with me, and I put on github. Hope you find it useful!
You can also read the original SO question, where the issue was discussed.
The script works on Fedora 23+ as it uses dnf's download plugin. It's probably very easy to make it work on Fedora 22-, as yum surely has got a similar plugin.
Additionaly, it's valuable since repotrack does not work on fedora 23 (at least it doesn't work for me).

After a lot of frustration looking around for a solution I have written a simple script that uses repotrace and wget. I've found that yumdownloader (even with the resolve flag) does not resolve all dependencies.
if you have a long list of packages you are bound to run into duplicates, downloading just the urls first with the "repotrack -u flag" and then getting unique records resolves having to download the same rpm multiple times.
#!/bin/bash
while read i; do
repotrack -u $i >> dep_rpm_urls_02.txt
done < list_of_packages_01.txt
awk '!seen[$0]++' dep_rpm_urls_02.txt > dep_rpm_urls_clean_03.txt
while read j; do
wget $j
echo dowloaded $j
done < dep_rpm_urls_clean_03.txt
happy rpming

Related

Conda: How to install latest version of `pandoc-crossref` from Github in `conda` environment?

pandoc-crossref must match the pandoc version, and also only the 3.10.0 release works on OSX Big Sur. Thus, it is not possible to get pandoc and pandoc-crossref running in a conda environment from the official channel or from conda-forge.
I could easily download the matching binaries from https://github.com/lierdakil/pandoc-crossref/releases/tag/v0.3.10.0 and copy them e.g. to the binpath:
$ which pandoc-crossref
/usr/local/bin/pandoc-crossref
$ curl -OL https://github.com/lierdakil/pandoc-crossref/releases/download/v0.3.10.0/pandoc-crossref-macOS.tar.xz
$ tar -xzvf pandoc-crossref-macOS.tar.xz
$ mv pandoc-crossref /usr/local/bin/pandoc-crossref
But I think that is not a clean approach, because conda will not know that I updated the version for pandoc-crossref.
What is a clean approach for updating a package managed by conda from a binary available on Github?
Update Feedstock
I updated it on the Conda Forge feedstock, which is what I regard as the "cleanest" solution.
How does one do that? First, OP had posted a comment on the feedstock in the PR that they wanted merged. This was the appropriate first step and hopefully in future cases that should be sufficient to prompt maintainers to act. In this case, it was not sufficient. So, as a follow up, I chatted on the Conda Forge Gitter to point out that the feedstock had gone stale and had non-responding maintainer(s). One of the core Conda Forge members suggested I make a PR bumping the version and adding myself as maintainer, and they merged it for me. In all, this took about 10 mins of work and ~2 hours from start to having an updated package on Anaconda Cloud.
Custom Conda Build
Otherwise, there isn't really a clean solution for non-Python packages outside of building a Conda package. That is, clone the feedstock or write a new recipe, modify it to build from the GitHub reference, then install that build into your environment. It may also be worth uploading to an Anaconda Cloud user account, so there is some non-local reference for it.
Pip Install (Python Packages Only)
In the special case that it is a Python package, one could dump the environment to YAML, edit to install the package through pip, then recreate the environment.

How to avoid centos-release rpm installing yum repo files via spacewalk

We have a Spacewalk server we use to distribute updates to our CentOS 6 and 7 client systems. None of the client systems have internet access. Only the spacewalk server has restricted access to complete repo sync updates.
We have an issue when it comes time to push out the centos-release rpms. this rpm installs repo config files like /etc/yum.repo.d/CentOS-Base.repo. Since the client system can't get out to the internet, any subsequent yum command displays an error about not enough mirrors.
Does any one know of a way to have either Spacewalk or yum exclude the /etc/yum.repos.d/ directory on install of the centos-release package.
It has to be an automated or configurable method as I currently run a manual command on each of the affected systems when I know that rpm is being pushed out. (/bin/rm /etc/yum.repo.d/CentOS-*.repo). I considered a cron job, but that just didn't seem like the best option.
Thanks in advance.
You can tell yum not to use a certain repository:
yum install --disablerepo=centos-base
or you can tell him to only use your repository by disabling all others:
yum install --disablerepo=* --enablerepo=myrepo
The solution I have seen in the past is to configure yum to not use the default location, but instead a different one. For example, /etc/yum.internal.repos.d/. Then anything that happens in the default location doesn't matter.

Completely uninstall Eclipse 4.7 version in RHEL 7.4 Maipo

I'm trying to uninstall the current version of Eclipse IDE in my RHEL machine by simply deleting all the files like:
sudo rm -rf ~/.eclipse
sudo rm -rf ~/eclipse-workspace
I also tried
sudo yum remove 'eclipse*'
However, these didn't seem to solve the purpose.
Any help will be appreciated, thanks!
Applications on Linux systems are most often installed using so-called packages, which are managed by a package management system. In the case of RHEL, packages use the RPM format, and the package manager of choice is a tool called yum.
Both installation and removal of software (packages) should be done using yum, so as to allow the package management system keep track of all installed files and current status. Therefore, you shouldn't try to remove software by simply deleting files from the file system. Instead, use the yum command. See the RHEL System Admin Guide for a detailed explanation of how to use yum to search, install, upgrade, and remove packages: Working with Packages.
You have tried the correct command (yum remove <package-name>), but you need to use the correct package name. On RHEL 7.4, the latest version of Eclipse is available as a part of the DevTools channel, and the package name is rh-eclipse47 (see Enabling the Red Hat Developer Tools Repositories). Note that you may have also installed an older version, which would be, for example, rh-eclipse46.
To find out what is the name of the package you have installed, you can run, for example, the following command:
yum list installed | grep eclipse
There is also the possibility that you installed the software not from an RPM package but manually, e.g. from a .tar.gz file distrubuted from eclipse.org. If that's the case, you will need to use the uninstaller program supplied with that distribution of the software.
Write command as:
rpm -qa|grep eclipse
This will give a list of installed packages. Remove all the packages by giving below command:
rpm -e *package-name*
Done!!!

How Can I Install Redis perl library Manually i.e offline.And From Where Can I Get All The Dependencies To Install

I am trying to install check_redis plugin and for that i need redis perl library but i don't have access to CPAN and internet.So Is there any way to install by downloading zip file and all the dependencies.I am using nagios core.Here is the plugin i am trying to install
Because I had a similar problem at work I happened to write my personal Q&A on this topic. Here it is:
Q: How to install CPAN modules without Internet access?
A: 1. Install CPAN::Mini on the internet machine:
$ cpan CPAN::Mini
2. Find a CPAN mirror here: http://mirrors.cpan.org/#de
e.g. http://ftp.hosteurope.de/pub/CPAN/
3. on the internet machine:
$ minicpan -l /path/to/local/cpan/mirror -r http://ftp.hosteurope.de/pub/CPAN/
4. Copy /path/to/local/cpan/mirror to the non-internet machine (or mount it)
5. On the non-internet machine add the directory to CPAN's search path:
$ cpan
cpan shell -- CPAN exploration and modules installation (v1.xxxx)
cpan> o conf urllist unshift file:///path/to/local/cpan/mirror
cpan> o conf commit
commit: wrote /home/user/.cpan/CPAN/MyConfig.pm
6. Install as usual on the non-internet machine.
To update your CPAN mirror go to your internet machine and repeat steps 3 and 4.
References:
http://www.perlmonks.org/?node_id=590386
http://www.cpan.org/misc/how-to-mirror.html
http://search.cpan.org/~rjbs/CPAN-Mini-1.111016/lib/CPAN/Mini.pm
http://search.cpan.org/~rjbs/CPAN-Mini-1.111016/bin/minicpan
Some notes
Although CPAN says the initial mirror will only occupy around 1 GB it will need around 3.5 GB. I think their documentation is outdated in this regard.
The mirror will initially contain the latest versions of all modules on CPAN. Every time you update your mirror the then-latest versions will be downloaded (leaving the old versions on your disk), so the mirror will grow with each update as new versions arrive.
I updated my mirror three or four times and it now has 3.9 GB.
You can install thing manually, of course, but it will be painful.
You can download the Redis distribution tarball from CPAN. But it might well require other modules that you don't have installed. You can see its list of requirements in its META.yml file. So you can download the distribution tarballs for each of those modules too. But, of course, each of those modules is likely to require other modules that you don't have. So you can look at all of their META.yml files. And so it goes on...
Honestly, it might be easier to work out how hard it would be to get the machine connected to the internet temporarily :-)
You could fatpack all the dependencies you cannot install into the check_nagios.pl using App::FatPacker. I'll outline how to do that.
First, let's make sure that the Nagios plugin has a licence that allows us to do this.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Ok, that's great. We're allowed to alter the source. Now let's clone it so we have the whole thing.
$ git clone git#github.com:willixix/WL-NagiosPlugins.git
$ cd WL-NagiosPlugins
Now we need to install App::FatPacker to our local Perl. We need to do this on a machine were installing stuff from the internet is not a problem. You can do it on the machine you used to write your question.
$ cpanm App::FatPacker
Afterwards, we need to also install all the dependencies. We know this needs Redis, so
$ cpanm Redis
Now typically all you need to do is run the fatpack pack command, but that would pack everything. And we don't really need that. We do have core modules on the target system after all. So we will do this step by step.
First, we need to tell fatpack to find all the dependencies.
$ fatpack trace check_redis.pl
This will create a fatpacker.trace file.
$ cat fatpacker.trace
IO/Handle.pm
Data/Dumper.pm
IO.pm
bytes.pm
Socket.pm
overload.pm
vars.pm
Redis/Sentinel.pm
lib.pm
Symbol.pm
Redis.pm
IO/Select.pm
PerlIO/via/Timeout.pm
base.pm
Scalar/Util.pm
fields.pm
IO/Socket/UNIX.pm
DynaLoader.pm
constant.pm
overloading.pm
Errno.pm
Getopt/Long.pm
warnings/register.pm
Carp.pm
IO/Socket.pm
SelectSaver.pm
Exporter/Heavy.pm
IO/Socket/Timeout.pm
List/Util.pm
Sub/Util.pm
Fcntl.pm
Time/HiRes.pm
IO/Socket/INET.pm
Try/Tiny.pm
Config.pm
Text/ParseWords.pm
I would suggest removing everything that looks like a core module. You turn the file names back into module names by replacing / with :: and removing the .pm, and then pass that into the corelist utility that ships with Perl on the target machine. All the pragmata (the ones that start with small letters) can be ignored, they are part of the core.
Here is the list after I cut it down to what I think makes sense to include. This might not be complete, or incorrect, but I can't try on your machine. The file now looks like this.
$ cat fatpacker.trace
Redis/Sentinel.pm
Redis.pm
Try/Tiny.pm
Now we follow the manual in RECIPES in the fatpack documentation.
$ fatpack packlists-for `cat fatpacker.trace` >packlists
The packlists file contains a couple of paths for where to find the packlists for those modules. This is specific to your Perl installation.
$ fatpack tree `cat packlists`
This will create a directory fatlib that contains all the stuff we want to bundle.
$ tree fatlib/
fatlib/
├── Redis
│   ├── Hash.pm
│   ├── List.pm
│   └── Sentinel.pm
├── Redis.pm
└── Try
└── Tiny.pm
2 directories, 5 files
Last, we need to run the actual packing command.
$ fatpack file check_redis.pl >check_redis.packed.pl
And now we have a file called check_redis.packed.pl that. If you open that and look at it, you'll see a BEGIN block that loads a bunch of stuff. That stuff is the dependencies that you could not install. They are now bundled into the script.
Move that script to the machine with your Nagios, and use it instead of the check_nagios.pl. It should now just work.
Please note that I have not actually tried if it works because I neither have a Redis nor a Nagios to try it. But it should work.
This worked for me in centOs 7.
step 1: Download dependencies in a centOs7 that is connected to internet by these commands:
yumdownloader --destdir=/etc/LinuxRepos/Redis epel-release
yumdownloader --destdir=/etc/LinuxRepos/Redis jemalloc
yumdownloader --destdir=/etc/LinuxRepos/Redis epel-release
step 2: copy downloaded files from /etc/LinuxRepos/Redis and copy them to destination centOS 7.
step 3: Install packages by
yum localinstal epel-release-7-11.noarch.rpm
yum localinstall jemalloc-3.6.0-1.el7.x86_64.rpm
yum localinstall epel-release-7-11.noarch.rpm
NOTICE: The name of files in step 3 may be changed due to current last
version.

take long time installing and updating packages by wget on arch linux

I don't know why, when im downloding or installing or updating package, download speed is very slow?
and take very long time!!!!
when im working in windows my download speed is 1M but in arch is changable ,is between 50k to 100k?
im using wget in pacman.conf
I use reflector but it had nothing changed and my package download speed is to slow.
can i create list from pacman update package and then download those from windows and again install all packages in Arch?
Please consider reading the documentation about pacman performance here.
You can manually force pacman to refresh the package lists (mirror list) with:
pacman -Syyu
To answer your question about downloading out of arch, the first part of the following will be with laverna which is a software I maintain on AUR, and the second part will be with a package in official repository.
AUR
Download
We have 2 solutions:
Use git
Download snapshot
Using Git
Clone in the current folder the repository with
git clone https://aur.archlinux.org/packages/laverna/ .
Using Snapshot
Just wget the snapshot or download directly with the browser.
wget https://aur.archlinux.org/cgit/aur.git/snapshot/laverna.tar.gz
Official Repositories
You can easily get a download link the package web page.
For example with sqlite-doc the web page link is here and the download link (from a mirror) is here.
Back to Arch
Then back to arch, we have to build and install packages. To do so we navigate to the folder where you cloned/downloaded the package (cf. cd) then execute the following to build.
(Only if packageName-version.pkg.tar.xz doesn't exist)
makepkg
Finally, after makepkg you obtain a file in the current directory which is in our AUR example laverna-0.7.4-RC1-linux-x64.pkg.tar.xz.
To install the packageName-version.pkg.tar.xz file we just have to execute the following and answer the questions as usually.
sudo pacman -U laverna-0.7.4-RC1-linux-x64.pkg.tar.xz
Check out your network settings,ip dns route... sometimes this will solve download speed problem.
Find the fastest mirror.
$ cd /etc/pacman.d/
$ cp mirrorlist mirrorlist.bak
$ rankmirrors -n 6 mirrorlist.bak > mirrorlist
Check mirrors status https://www.archlinux.org/mirrors/status/.
You can see more from Archwiki Mirrors.
Hope this helps.