If you want to install something using yum for example abracadabra tool but get message “No package abracadabra available” it could mean that abracadabra tool does not exist at all, appropriate repository is not presented on your machine or repository is presented but not enabled. The first problem could not be fixed unless it is typo in tool name. But there is chance to fix last two. For example if you want to install some Microsoft tool on your Linux box you need to created Microsoft repository, if it is well-know Linux tool usually repository enabling can help.
This article is related to “How to edit Mac dmg file on Linux Platform“. Let us consider the situation that you cannot install some package on CentOS device because the yum command fails with the error “No package available”. However previously you successfully installed the same package on other CentOS machines without problem. Yes it is possible that the product you want to install has been discontinued and deleted from all repositories, but it is quite unlikely, probably the repositories are misconfigured or missing. Here two real examples with solving procedures. The first one is installation of genisoimage:
# yum install genisoimage Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile No package genisoimage available. Error: Nothing to do |
Let check repositories first, the yum repositories are located in /etc/yum.repos.d directory. Open /etc/yum.repos.d/CentOS-Base.repo in the text editor and change all “enabled=0” string to “enabled=1”, in other words we enable all repositories defined in /etc/yum.repos.d/CentOS-Base.repo file. Save the file. Try install genisoimage again and success: you can find where takes it from:
# yum install genisoimage Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: centosmirror.netcup.net * centosplus: mirror.centos.serverforge.org * extras: centos.mirror.rafal.ca * updates: mirror.calgah.com Resolving Dependencies –> Running transaction check —> Package genisoimage.x86_64 0:1.1.11-25.el7 will be installed –> Finished Dependency Resolution Dependencies Resolved ================================================================================ Transaction Summary Total download size: 299 k |
It is possible to enable or disable repositories using yum-config-manager command. for example to enable “base” repository in /etc/yum.repos.d/CentOS-Base.repo
[base] name=CentOS-$releasever – Base mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/ gpgcheck=1 repo_gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 enabled=0 |
execute the following command:
# yum-config-manager –enable base |
The “yum-config-manager –enable base” modifies value of “enabled” to one, similar as we did with text editor:
[base] name=CentOS-$releasever – Base mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/ gpgcheck=1 repo_gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 enabled=1 |
To disable this repository again, run:
# yum-config-manager –disable base |
To enable all repositories (I do not suggest to do it):
# yum-config-manager –enable \* |
However it is not always good, after enabling all repositories yum command begins to report errors something like this:
failure: repodata/repomd.xml.asc from C7.0.1406-base: [Errno 256] No more mirrors to try. http://vault.centos.org/7.0.1406/os/x86_64/repodata/repomd.xml.asc: [Errno 14] HTTP Error 404 – Not Found |
To fix these errors I disabled all repositories again:
# yum-config-manager –disable \* |
and started to enable them one per one beginning from /etc/yum.repos.d/CentOS-Base.repo, very time consuming.
Now the second example the installation of dmg2img.
After playing with repository enable/disabling I could not find the right one, so the conclusion was I need to add new repository for dmg2img installtion. After googling I found that the repository is
https://copr.fedorainfracloud.org/coprs/scx/dmg2img/repo/epel-7/scx-dmg2img-epel-7.repo. There are 2 way to add this repository:
yum-config-manager –add-repo https://copr.fedorainfracloud.org/coprs/scx/dmg2img/repo/epel-7/scx-dmg2img-epel-7.repo |
or
curl ‘https://copr.fedorainfracloud.org/coprs/scx/dmg2img/repo/epel-7/scx-dmg2img-epel-7.repo’ > ‘/etc/yum.repos.d/scx-dmg2img-epel-7.repo’ |
Verified that repository is enabled:
# cat scx-dmg2img-epel-7.repo [copr:copr.fedorainfracloud.org:scx:dmg2img] name=Copr repo for dmg2img owned by scx baseurl=https://copr-be.cloud.fedoraproject.org/results/scx/dmg2img/epel-7-$basearch/ type=rpm-md skip_if_unavailable=True gpgcheck=1 gpgkey=https://copr-be.cloud.fedoraproject.org/results/scx/dmg2img/pubkey.gpg repo_gpgcheck=0 enabled=1 enabled_metadata=1 |
and began installation of dmg2img:
# yum install dmg2img Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: centos.mirror.iweb.ca * centosplus: centos.mirror.iweb.ca * elrepo: ftp.osuosl.org * extras: mirror.calgah.com * updates: mirror.calgah.com base/7/x86_64/signature | 811 B 00:00 base/7/x86_64/signature | 3.6 kB 00:00 !!! centosplus/7/x86_64/signature | 811 B 00:00 centosplus/7/x86_64/signature | 3.4 kB 00:00 !!! copr:copr.fedorainfracloud.org:scx:dmg2img | 3.0 kB 00:00 elrepo | 2.9 kB 00:00 extras/7/x86_64/signature | 811 B 00:00 extras/7/x86_64/signature | 3.4 kB 00:00 !!! support/x86_64/signature | 490 B 00:00 support/x86_64/signature | 2.9 kB 00:00 !!! updates/7/x86_64/signature | 811 B 00:00 updates/7/x86_64/signature | 3.4 kB 00:00 !!! elrepo/primary_db | 390 kB 00:00 Resolving Dependencies –> Running transaction check —> Package dmg2img.x86_64 0:1.6.7-4.el7.centos will be installed –> Finished Dependency Resolution Dependencies Resolved ================================================================================ Transaction Summary Total download size: 32 k |
For more information about adding, enabling, and disabling a yum repositories.
Thank you Smike,it fixed the issue in my centos 7 machine
you are wellcome