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

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.

Related

yum doesn't have enough cached data to continue. At this point the only\n safe thing yum can do is fail

We use custom yum repos at our company. Something is causing them to fail the yum makecache command.
I'm on CentOS Linux release 7.7.1908 (Core).
Here's the error that we get when we run yum makecache:
One of the configured repositories failed (Unknown),
and yum doesn't have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work "fix" this
The repos look like this and I need to use both of them.
Epel repo:
[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
[epel-debuginfo]
name=Extra Packages for Enterprise Linux 7 - $basearch - Debug
#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch/debug
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1
[epel-source]
name=Extra Packages for Enterprise Linux 7 - $basearch - Source
#baseurl=http://download.fedoraproject.org/pub/epel/7/SRPMS
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-source-7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1
Our company repo:
[mmp]
name=MMP
baseurl=http://10.245.19.168/mmp_repo/
gpgcheck=0
enabled=1
I'm not sure what the problem is. How can I make this error go away?
This question is solved here. So, first, some background: When yum installs a package, it unpacks and moves all of the files to the proper directory (i.e. opt, bin, etc etcetera). When a network connection is interrupted, a drive-write is stopped, what have you, during the install process, some files might not be written, while the program still returns that it was installed successfully.
To fix this:
On the host where the installation is failing, check if the repos are correct.
Especially the baseurl
# grep 'baseurl' /etc/yum.repos.d/* | grep HDP
Just append "/repodata/repomd.xml" in the URL and then test if it is accessible.
Example: if baseurl is http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.6.3.0 then try accessing it as following to verify the access. Please check all the URLs
# curl -v http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.6.3.0/repodata/repomd.xml
If the URLs are accessible then in that case try cleaning the yum cache by running the command.
# yum clean all
After yum clean try running the following command again to verify if the issue persist.
# yum -y install ranger_2_6_3_0_235-admin
This seems to be a problem with the EPEL repository. Try yum with
--disablerepo=epel\*
until they get this fixed.
if you don't have an immediate need to get packages from EPEL, use yum with
--disablerepo=epel
until your local mirror syncs. yum clean all may or may not help, depending on which mirror you hit.
My general suggestion is still valid, though -- unless you have an immediate need to get EPEL packages, I would suggest using
--disablerepo=epel
until your local mirror gets the fixed repodata. If you do have an immediate need for EPEL packages and
yum clean all
does not help, you will need to adjust your config to point to some specific mirror that has the fixed content, like by adding baseurl=http://ftp.funet.fi/pub/mirrors/fedora.redhat.com/pub/epel/7/
$basearch to epel.repo. Most mirrors should be updated by now, though.
Alternatives >>>
I happened to be on Freenode channel #epel when someone complained about this issue, but if this had happened to me, I could have enabled one repository at a time (with --disablerepo=* and --enablerepo=somerepo) to find which repo caused the trouble.
skip_if_unavailable=1 for non-critical repos sounds like a good idea.
Many people need only a few packages from EPEL. One option would be to import the EPEL packages you need to some locally controlled repository and use that instead. createrepo is related to this.
Top
Check your network connectivity. If you can't see your system ip address, then you should check & make network connectivity properly.
I faced this issue. I used CentOS 7 in VM ware. If I execute "ifconfig" command, it will show one IP address only. But generally in VM ware it should show two ip addresses. So if you can see only one IP address, then shutdown your linux system. Then change your Network Settings (Network Adapter) in VM ware.
Try this, it will work...!

Unable to run yum update

I tried to run yum update to start working with yum tool, when I tried to run
yum update
and got an error
After I saw few forums advises I already disable ipv6, firewalld and set dns server to 8.8.8.8 and 8.8.4.4.
Output of yum update:
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#7 - "Failed connect to mirrorlist.centos.org:80; Operation now in progress"
One of the configured repositories failed (Unknown),
and yum doesn't have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work "fix" this:
1. Contact the upstream for the repository and get them to fix the problem.
2. Reconfigure the baseurl/etc. for the repository, to point to a working
upstream. This is most often useful if you are using a newer
distribution release than is supported by the repository (and the
packages for the previous distribution release still work).
3. Run the command with the repository temporarily disabled
yum --disablerepo=<repoid> ...
4. Disable the repository permanently, so yum won't use it by default. Yum
will then just ignore the repository until you permanently enable it
again or use --enablerepo for temporary usage:
yum-config-manager --disable <repoid>
or
subscription-manager repos --disable=<repoid>
5. Configure the failing repository to be skipped, if it is unavailable.
Note that yum will try to contact the repo. when it runs most commands,
so will have to try and fail each time (and thus. yum will be be much
slower). If it is a very temporary problem though, this is often a nice
compromise:
yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true
Cannot find a valid baseurl for repo: base/7/x86_64
Most of this cases is because you did a command:
yum clean all
or anything that causes a corruption or wrong pointing of repos in the /etc/yum.repos.d/
Normally, it should just be ok, but sometimes it results to corruption of yum such as the following as I tried to clean now one of the server yum repo.
I encountered this error multiple times in the 9 servers that I handled. You can check your repos at /etc/yum.repos.d/. You should be able to see this:
If you can't resolve it by checking all .repo files, backup all your .repo and download the following files and upload it to your /etc/yum.repos.d:
https://drive.google.com/open?id=1WsJ1e8stj76JWJi-6IHQ1DVTmM7OsYzW
This will be the result afterwards:
This is really a problem that causes you a lot of headache with a simple solution. I hope that this will really truly help you.

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!!!

installing ipython on rhel7

I'm a RHEL newbie. I'm used to a non-Linux Unix, which has a fundamentally different way of dealing with packages.
I want to install ipython for a user on a vanilla RHEL7 system with yum as the package manager.
"yum install python" was fairly straightforward, but given that I'm new to the OS and I don't completely understand what ipython is, I am stumped as to how to proceed.
"yum install ipython" obviously doesn't work and every possible solution seems to require the installation of something else that I don't know how to install in a reasonable manner.
I am trying to keep things as generic as possible so it will be obvious how to update/remove software in the future, so anything that can be done with yum, would be probably preferable.
Installation instructions refer to pip, which I don't have. I possibly need setuptools to run pip, but I can't figure out the appropriate way to get that either. Maybe I can get one or either by installation the EPEL bundle of packages, but I can't find those for RHEL7, at least not in a way that doesn't seem like a "download and install this random file, trust us" method, which seems irresponsible.
Another option is anaconda. Again, there doesn't seem to be a yum-related way to install this, and anaconda itself is only a means to an end to download ipython, so that'd be two levels of abstraction away from the goal.
Additionally, do I even want "ipython" these days, or do I want "jupyter"?
All I care about is that the user should be able to type in "ipython" at the prompt and get the thing he is expecting.
Also, the python installed by yum is 2.7.5-48.el7, which does not seem to be current. I don't care about using the current version unless that prevents me from successfully installing ipython in some other manner, but I thought it might be relevant.
Any suggestions for how to install this thing is the most easily maintainable way? Do I not want the yum version of python?
Thanks for your patience.
Install python-pip from EPEL repository first ( https://fedoraproject.org/wiki/EPEL - it's compatible with all Red Hat entrprise Linux distros - be it CentOS, RHEL, Oracl, ScientificLinux or whatever), (or if you don't trust EPEL repo providers you can use get-pip.py ( https://bootstrap.pypa.io/get-pip.py ) script, but then you have to trust its providers instead) then install via
pip install ipython

Download RPMs for all dependencies for package using yum

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